diff --git a/client.go b/client.go index bb61a231..d174b8e0 100644 --- a/client.go +++ b/client.go @@ -60,8 +60,8 @@ type Client struct { // Variables determined at runtime. Version version.Number `json:"-"` - SystemInfo map[string]string `json:"-"` - Plugin []plugin.Info `json:"-"` + systemInfo map[string]string `json:"-"` + plugins []plugin.Info `json:"-"` // Internal variables. con *http.Client @@ -81,9 +81,24 @@ func (c *Client) Versioning() version.Number { return c.Version } -// Plugins returns the list of plugins. -func (c *Client) Plugins() []plugin.Info { - return c.Plugin +func (c *Client) SystemInfo(ctx context.Context) (map[string]string, error) { + if c.systemInfo == nil { + if err := c.RetrieveSystemInfo(ctx); err != nil { + return nil, err + } + } + + return c.systemInfo, nil +} + +func (c *Client) Plugins(ctx context.Context) ([]plugin.Info, error) { + if c.plugins == nil { + if err := c.RetrievePlugins(ctx); err != nil { + return nil, err + } + } + + return c.plugins, nil } // GetTarget returns the Target param, used in certain API calls. @@ -93,11 +108,11 @@ func (c *Client) GetTarget() string { // IsPanorama returns true if this is Panorama. func (c *Client) IsPanorama() (bool, error) { - if len(c.SystemInfo) == 0 { + if len(c.systemInfo) == 0 { return false, fmt.Errorf("SystemInfo is nil") } - model, ok := c.SystemInfo["model"] + model, ok := c.systemInfo["model"] if !ok { return false, fmt.Errorf("model not present in SystemInfo") } @@ -314,14 +329,6 @@ func (c *Client) Initialize(ctx context.Context) error { } } - if err = c.RetrieveSystemInfo(ctx); err != nil { - return err - } - - if err = c.RetrievePlugins(ctx); err != nil { - return err - } - return nil } @@ -352,12 +359,12 @@ func (c *Client) RetrieveSystemInfo(ctx context.Context) error { return err } - c.SystemInfo = make(map[string]string, len(ans.System.Tags)) + c.systemInfo = make(map[string]string, len(ans.System.Tags)) for _, t := range ans.System.Tags { if t.TrimmedText == nil { continue } - c.SystemInfo[t.XMLName.Local] = *t.TrimmedText + c.systemInfo[t.XMLName.Local] = *t.TrimmedText if t.XMLName.Local == "sw-version" { c.Version, err = version.New(*t.TrimmedText) if err != nil { @@ -453,7 +460,7 @@ func (c *Client) RetrievePlugins(ctx context.Context) error { return err } - c.Plugin = ans.Listing() + c.plugins = ans.Listing() return nil } @@ -1006,8 +1013,19 @@ func (c *Client) GetTechSupportFile(ctx context.Context) (string, []byte, error) func (c *Client) setupLogging(logging LoggingInfo) error { var logger *slog.Logger + var logLevel slog.Level + var levelStr string + if levelStr = os.Getenv("PANOS_LOG_LEVEL"); c.CheckEnvironment && levelStr != "" { + err := logLevel.UnmarshalText([]byte(levelStr)) + if err != nil { + return err + } + } else { + logLevel = slog.LevelInfo + } + if logging.SLogHandler == nil { - logger = slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: logging.LogLevel})) + logger = slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: logLevel})) logger.Info("No slog handler provided, creating default os.Stderr handler.", "LogLevel", logging.LogLevel.Level()) } else { logger = slog.New(logging.SLogHandler) @@ -1019,7 +1037,7 @@ func (c *Client) setupLogging(logging LoggingInfo) error { // 1. logging.LogCategories has the highest priority // 2. If logging.LogCategories is not set, we check logging.LogSymbols // 3. If logging.LogSymbols is empty and c.CheckEnvironment is true we consult - // PANOS_LOGGING environment variable. + // PANOS_LOG_CATEGORIES environment variable. // 4. If no logging categories have been selected, default to basic library logging // (i.e. "pango" category) logMask := logging.LogCategories @@ -1031,7 +1049,7 @@ func (c *Client) setupLogging(logging LoggingInfo) error { } if logMask == 0 { - if val := os.Getenv("PANOS_LOGGING"); c.CheckEnvironment && val != "" { + if val := os.Getenv("PANOS_LOG_CATEGORIES"); c.CheckEnvironment && val != "" { symbols := strings.Split(val, ",") logMask, err = LogCategoryFromStrings(symbols) if err != nil { diff --git a/crypto/ike/gateway/entry.go b/crypto/ike/gateway/entry.go new file mode 100644 index 00000000..0ce28268 --- /dev/null +++ b/crypto/ike/gateway/entry.go @@ -0,0 +1,1107 @@ +package gateway + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"network", "ike", "gateway"} +) + +type Entry struct { + Name string + Authentication *Authentication + Comment *string + Disabled *bool + Ipv6 *bool + LocalAddress *LocalAddress + LocalId *LocalId + PeerAddress *PeerAddress + PeerId *PeerId + Protocol *Protocol + ProtocolCommon *ProtocolCommon + + Misc map[string][]generic.Xml +} + +type Authentication struct { + Certificate *AuthenticationCertificate + PreSharedKey *AuthenticationPreSharedKey +} +type AuthenticationCertificate struct { + AllowIdPayloadMismatch *bool + CertificateProfile *string + LocalCertificate *AuthenticationCertificateLocalCertificate + StrictValidationRevocation *bool + UseManagementAsSource *bool +} +type AuthenticationCertificateLocalCertificate struct { + HashAndUrl *AuthenticationCertificateLocalCertificateHashAndUrl + Name *string +} +type AuthenticationCertificateLocalCertificateHashAndUrl struct { + BaseUrl *string + Enable *bool +} +type AuthenticationPreSharedKey struct { + Key *string +} +type LocalAddress struct { + Interface *string + FloatingIp *string + Ip *string +} +type LocalId struct { + Id *string + Type *string +} +type PeerAddress struct { + Dynamic *PeerAddressDynamic + Fqdn *string + Ip *string +} +type PeerAddressDynamic struct { +} +type PeerId struct { + Id *string + Matching *string + Type *string +} +type Protocol struct { + Ikev1 *ProtocolIkev1 + Ikev2 *ProtocolIkev2 + Version *string +} +type ProtocolCommon struct { + Fragmentation *ProtocolCommonFragmentation + NatTraversal *ProtocolCommonNatTraversal + PassiveMode *bool +} +type ProtocolCommonFragmentation struct { + Enable *bool +} +type ProtocolCommonNatTraversal struct { + Enable *bool + KeepAliveInterval *int64 + UdpChecksumEnable *bool +} +type ProtocolIkev1 struct { + Dpd *ProtocolIkev1Dpd + ExchangeMode *string + IkeCryptoProfile *string +} +type ProtocolIkev1Dpd struct { + Enable *bool + Interval *int64 + Retry *int64 +} +type ProtocolIkev2 struct { + Dpd *ProtocolIkev2Dpd + IkeCryptoProfile *string + RequireCookie *bool +} +type ProtocolIkev2Dpd struct { + Enable *bool + Interval *int64 +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Authentication *AuthenticationXml `xml:"authentication,omitempty"` + Comment *string `xml:"comment,omitempty"` + Disabled *string `xml:"disabled,omitempty"` + Ipv6 *string `xml:"ipv6,omitempty"` + LocalAddress *LocalAddressXml `xml:"local-address,omitempty"` + LocalId *LocalIdXml `xml:"local-id,omitempty"` + PeerAddress *PeerAddressXml `xml:"peer-address,omitempty"` + PeerId *PeerIdXml `xml:"peer-id,omitempty"` + Protocol *ProtocolXml `xml:"protocol,omitempty"` + ProtocolCommon *ProtocolCommonXml `xml:"protocol-common,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AuthenticationXml struct { + Certificate *AuthenticationCertificateXml `xml:"certificate,omitempty"` + PreSharedKey *AuthenticationPreSharedKeyXml `xml:"pre-shared-key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AuthenticationCertificateXml struct { + AllowIdPayloadMismatch *string `xml:"allow-id-payload-mismatch,omitempty"` + CertificateProfile *string `xml:"certificate-profile,omitempty"` + LocalCertificate *AuthenticationCertificateLocalCertificateXml `xml:"local-certificate,omitempty"` + StrictValidationRevocation *string `xml:"strict-validation-revocation,omitempty"` + UseManagementAsSource *string `xml:"use-management-as-source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AuthenticationCertificateLocalCertificateXml struct { + HashAndUrl *AuthenticationCertificateLocalCertificateHashAndUrlXml `xml:"hash-and-url,omitempty"` + XMLName xml.Name `xml:"entry"` + Name *string `xml:"name,attr,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AuthenticationCertificateLocalCertificateHashAndUrlXml struct { + BaseUrl *string `xml:"base-url,omitempty"` + Enable *string `xml:"enable,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AuthenticationPreSharedKeyXml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type LocalAddressXml struct { + Interface *string `xml:"interface,omitempty"` + FloatingIp *string `xml:"floating-ip,omitempty"` + Ip *string `xml:"ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type LocalIdXml struct { + Id *string `xml:"id,omitempty"` + Type *string `xml:"type,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type PeerAddressXml struct { + Dynamic *PeerAddressDynamicXml `xml:"dynamic,omitempty"` + Fqdn *string `xml:"fqdn,omitempty"` + Ip *string `xml:"ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type PeerAddressDynamicXml struct { + Misc []generic.Xml `xml:",any"` +} +type PeerIdXml struct { + Id *string `xml:"id,omitempty"` + Matching *string `xml:"matching,omitempty"` + Type *string `xml:"type,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolXml struct { + Ikev1 *ProtocolIkev1Xml `xml:"ikev1,omitempty"` + Ikev2 *ProtocolIkev2Xml `xml:"ikev2,omitempty"` + Version *string `xml:"version,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolCommonXml struct { + Fragmentation *ProtocolCommonFragmentationXml `xml:"fragmentation,omitempty"` + NatTraversal *ProtocolCommonNatTraversalXml `xml:"nat-traversal,omitempty"` + PassiveMode *string `xml:"passive-mode,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolCommonFragmentationXml struct { + Enable *string `xml:"enable,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolCommonNatTraversalXml struct { + Enable *string `xml:"enable,omitempty"` + KeepAliveInterval *int64 `xml:"keep-alive-interval,omitempty"` + UdpChecksumEnable *string `xml:"udp-checksum-enable,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolIkev1Xml struct { + Dpd *ProtocolIkev1DpdXml `xml:"dpd,omitempty"` + ExchangeMode *string `xml:"exchange-mode,omitempty"` + IkeCryptoProfile *string `xml:"ike-crypto-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolIkev1DpdXml struct { + Enable *string `xml:"enable,omitempty"` + Interval *int64 `xml:"interval,omitempty"` + Retry *int64 `xml:"retry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolIkev2Xml struct { + Dpd *ProtocolIkev2DpdXml `xml:"dpd,omitempty"` + IkeCryptoProfile *string `xml:"ike-crypto-profile,omitempty"` + RequireCookie *string `xml:"require-cookie,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolIkev2DpdXml struct { + Enable *string `xml:"enable,omitempty"` + Interval *int64 `xml:"interval,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "authentication" || v == "Authentication" { + return e.Authentication, nil + } + if v == "comment" || v == "Comment" { + return e.Comment, nil + } + if v == "disabled" || v == "Disabled" { + return e.Disabled, nil + } + if v == "ipv6" || v == "Ipv6" { + return e.Ipv6, nil + } + if v == "local_address" || v == "LocalAddress" { + return e.LocalAddress, nil + } + if v == "local_id" || v == "LocalId" { + return e.LocalId, nil + } + if v == "peer_address" || v == "PeerAddress" { + return e.PeerAddress, nil + } + if v == "peer_id" || v == "PeerId" { + return e.PeerId, nil + } + if v == "protocol" || v == "Protocol" { + return e.Protocol, nil + } + if v == "protocol_common" || v == "ProtocolCommon" { + return e.ProtocolCommon, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + var nestedAuthentication *AuthenticationXml + if o.Authentication != nil { + nestedAuthentication = &AuthenticationXml{} + if _, ok := o.Misc["Authentication"]; ok { + nestedAuthentication.Misc = o.Misc["Authentication"] + } + if o.Authentication.Certificate != nil { + nestedAuthentication.Certificate = &AuthenticationCertificateXml{} + if _, ok := o.Misc["AuthenticationCertificate"]; ok { + nestedAuthentication.Certificate.Misc = o.Misc["AuthenticationCertificate"] + } + if o.Authentication.Certificate.AllowIdPayloadMismatch != nil { + nestedAuthentication.Certificate.AllowIdPayloadMismatch = util.YesNo(o.Authentication.Certificate.AllowIdPayloadMismatch, nil) + } + if o.Authentication.Certificate.CertificateProfile != nil { + nestedAuthentication.Certificate.CertificateProfile = o.Authentication.Certificate.CertificateProfile + } + if o.Authentication.Certificate.LocalCertificate != nil { + nestedAuthentication.Certificate.LocalCertificate = &AuthenticationCertificateLocalCertificateXml{} + if _, ok := o.Misc["AuthenticationCertificateLocalCertificate"]; ok { + nestedAuthentication.Certificate.LocalCertificate.Misc = o.Misc["AuthenticationCertificateLocalCertificate"] + } + if o.Authentication.Certificate.LocalCertificate.HashAndUrl != nil { + nestedAuthentication.Certificate.LocalCertificate.HashAndUrl = &AuthenticationCertificateLocalCertificateHashAndUrlXml{} + if _, ok := o.Misc["AuthenticationCertificateLocalCertificateHashAndUrl"]; ok { + nestedAuthentication.Certificate.LocalCertificate.HashAndUrl.Misc = o.Misc["AuthenticationCertificateLocalCertificateHashAndUrl"] + } + if o.Authentication.Certificate.LocalCertificate.HashAndUrl.BaseUrl != nil { + nestedAuthentication.Certificate.LocalCertificate.HashAndUrl.BaseUrl = o.Authentication.Certificate.LocalCertificate.HashAndUrl.BaseUrl + } + if o.Authentication.Certificate.LocalCertificate.HashAndUrl.Enable != nil { + nestedAuthentication.Certificate.LocalCertificate.HashAndUrl.Enable = util.YesNo(o.Authentication.Certificate.LocalCertificate.HashAndUrl.Enable, nil) + } + } + if o.Authentication.Certificate.LocalCertificate.Name != nil { + nestedAuthentication.Certificate.LocalCertificate.Name = o.Authentication.Certificate.LocalCertificate.Name + } + } + if o.Authentication.Certificate.StrictValidationRevocation != nil { + nestedAuthentication.Certificate.StrictValidationRevocation = util.YesNo(o.Authentication.Certificate.StrictValidationRevocation, nil) + } + if o.Authentication.Certificate.UseManagementAsSource != nil { + nestedAuthentication.Certificate.UseManagementAsSource = util.YesNo(o.Authentication.Certificate.UseManagementAsSource, nil) + } + } + if o.Authentication.PreSharedKey != nil { + nestedAuthentication.PreSharedKey = &AuthenticationPreSharedKeyXml{} + if _, ok := o.Misc["AuthenticationPreSharedKey"]; ok { + nestedAuthentication.PreSharedKey.Misc = o.Misc["AuthenticationPreSharedKey"] + } + if o.Authentication.PreSharedKey.Key != nil { + nestedAuthentication.PreSharedKey.Key = o.Authentication.PreSharedKey.Key + } + } + } + entry.Authentication = nestedAuthentication + + entry.Comment = o.Comment + entry.Disabled = util.YesNo(o.Disabled, nil) + entry.Ipv6 = util.YesNo(o.Ipv6, nil) + var nestedLocalAddress *LocalAddressXml + if o.LocalAddress != nil { + nestedLocalAddress = &LocalAddressXml{} + if _, ok := o.Misc["LocalAddress"]; ok { + nestedLocalAddress.Misc = o.Misc["LocalAddress"] + } + if o.LocalAddress.Interface != nil { + nestedLocalAddress.Interface = o.LocalAddress.Interface + } + if o.LocalAddress.FloatingIp != nil { + nestedLocalAddress.FloatingIp = o.LocalAddress.FloatingIp + } + if o.LocalAddress.Ip != nil { + nestedLocalAddress.Ip = o.LocalAddress.Ip + } + } + entry.LocalAddress = nestedLocalAddress + + var nestedLocalId *LocalIdXml + if o.LocalId != nil { + nestedLocalId = &LocalIdXml{} + if _, ok := o.Misc["LocalId"]; ok { + nestedLocalId.Misc = o.Misc["LocalId"] + } + if o.LocalId.Id != nil { + nestedLocalId.Id = o.LocalId.Id + } + if o.LocalId.Type != nil { + nestedLocalId.Type = o.LocalId.Type + } + } + entry.LocalId = nestedLocalId + + var nestedPeerAddress *PeerAddressXml + if o.PeerAddress != nil { + nestedPeerAddress = &PeerAddressXml{} + if _, ok := o.Misc["PeerAddress"]; ok { + nestedPeerAddress.Misc = o.Misc["PeerAddress"] + } + if o.PeerAddress.Ip != nil { + nestedPeerAddress.Ip = o.PeerAddress.Ip + } + if o.PeerAddress.Dynamic != nil { + nestedPeerAddress.Dynamic = &PeerAddressDynamicXml{} + if _, ok := o.Misc["PeerAddressDynamic"]; ok { + nestedPeerAddress.Dynamic.Misc = o.Misc["PeerAddressDynamic"] + } + } + if o.PeerAddress.Fqdn != nil { + nestedPeerAddress.Fqdn = o.PeerAddress.Fqdn + } + } + entry.PeerAddress = nestedPeerAddress + + var nestedPeerId *PeerIdXml + if o.PeerId != nil { + nestedPeerId = &PeerIdXml{} + if _, ok := o.Misc["PeerId"]; ok { + nestedPeerId.Misc = o.Misc["PeerId"] + } + if o.PeerId.Id != nil { + nestedPeerId.Id = o.PeerId.Id + } + if o.PeerId.Matching != nil { + nestedPeerId.Matching = o.PeerId.Matching + } + if o.PeerId.Type != nil { + nestedPeerId.Type = o.PeerId.Type + } + } + entry.PeerId = nestedPeerId + + var nestedProtocol *ProtocolXml + if o.Protocol != nil { + nestedProtocol = &ProtocolXml{} + if _, ok := o.Misc["Protocol"]; ok { + nestedProtocol.Misc = o.Misc["Protocol"] + } + if o.Protocol.Ikev2 != nil { + nestedProtocol.Ikev2 = &ProtocolIkev2Xml{} + if _, ok := o.Misc["ProtocolIkev2"]; ok { + nestedProtocol.Ikev2.Misc = o.Misc["ProtocolIkev2"] + } + if o.Protocol.Ikev2.Dpd != nil { + nestedProtocol.Ikev2.Dpd = &ProtocolIkev2DpdXml{} + if _, ok := o.Misc["ProtocolIkev2Dpd"]; ok { + nestedProtocol.Ikev2.Dpd.Misc = o.Misc["ProtocolIkev2Dpd"] + } + if o.Protocol.Ikev2.Dpd.Enable != nil { + nestedProtocol.Ikev2.Dpd.Enable = util.YesNo(o.Protocol.Ikev2.Dpd.Enable, nil) + } + if o.Protocol.Ikev2.Dpd.Interval != nil { + nestedProtocol.Ikev2.Dpd.Interval = o.Protocol.Ikev2.Dpd.Interval + } + } + if o.Protocol.Ikev2.IkeCryptoProfile != nil { + nestedProtocol.Ikev2.IkeCryptoProfile = o.Protocol.Ikev2.IkeCryptoProfile + } + if o.Protocol.Ikev2.RequireCookie != nil { + nestedProtocol.Ikev2.RequireCookie = util.YesNo(o.Protocol.Ikev2.RequireCookie, nil) + } + } + if o.Protocol.Version != nil { + nestedProtocol.Version = o.Protocol.Version + } + if o.Protocol.Ikev1 != nil { + nestedProtocol.Ikev1 = &ProtocolIkev1Xml{} + if _, ok := o.Misc["ProtocolIkev1"]; ok { + nestedProtocol.Ikev1.Misc = o.Misc["ProtocolIkev1"] + } + if o.Protocol.Ikev1.Dpd != nil { + nestedProtocol.Ikev1.Dpd = &ProtocolIkev1DpdXml{} + if _, ok := o.Misc["ProtocolIkev1Dpd"]; ok { + nestedProtocol.Ikev1.Dpd.Misc = o.Misc["ProtocolIkev1Dpd"] + } + if o.Protocol.Ikev1.Dpd.Retry != nil { + nestedProtocol.Ikev1.Dpd.Retry = o.Protocol.Ikev1.Dpd.Retry + } + if o.Protocol.Ikev1.Dpd.Enable != nil { + nestedProtocol.Ikev1.Dpd.Enable = util.YesNo(o.Protocol.Ikev1.Dpd.Enable, nil) + } + if o.Protocol.Ikev1.Dpd.Interval != nil { + nestedProtocol.Ikev1.Dpd.Interval = o.Protocol.Ikev1.Dpd.Interval + } + } + if o.Protocol.Ikev1.ExchangeMode != nil { + nestedProtocol.Ikev1.ExchangeMode = o.Protocol.Ikev1.ExchangeMode + } + if o.Protocol.Ikev1.IkeCryptoProfile != nil { + nestedProtocol.Ikev1.IkeCryptoProfile = o.Protocol.Ikev1.IkeCryptoProfile + } + } + } + entry.Protocol = nestedProtocol + + var nestedProtocolCommon *ProtocolCommonXml + if o.ProtocolCommon != nil { + nestedProtocolCommon = &ProtocolCommonXml{} + if _, ok := o.Misc["ProtocolCommon"]; ok { + nestedProtocolCommon.Misc = o.Misc["ProtocolCommon"] + } + if o.ProtocolCommon.Fragmentation != nil { + nestedProtocolCommon.Fragmentation = &ProtocolCommonFragmentationXml{} + if _, ok := o.Misc["ProtocolCommonFragmentation"]; ok { + nestedProtocolCommon.Fragmentation.Misc = o.Misc["ProtocolCommonFragmentation"] + } + if o.ProtocolCommon.Fragmentation.Enable != nil { + nestedProtocolCommon.Fragmentation.Enable = util.YesNo(o.ProtocolCommon.Fragmentation.Enable, nil) + } + } + if o.ProtocolCommon.NatTraversal != nil { + nestedProtocolCommon.NatTraversal = &ProtocolCommonNatTraversalXml{} + if _, ok := o.Misc["ProtocolCommonNatTraversal"]; ok { + nestedProtocolCommon.NatTraversal.Misc = o.Misc["ProtocolCommonNatTraversal"] + } + if o.ProtocolCommon.NatTraversal.Enable != nil { + nestedProtocolCommon.NatTraversal.Enable = util.YesNo(o.ProtocolCommon.NatTraversal.Enable, nil) + } + if o.ProtocolCommon.NatTraversal.KeepAliveInterval != nil { + nestedProtocolCommon.NatTraversal.KeepAliveInterval = o.ProtocolCommon.NatTraversal.KeepAliveInterval + } + if o.ProtocolCommon.NatTraversal.UdpChecksumEnable != nil { + nestedProtocolCommon.NatTraversal.UdpChecksumEnable = util.YesNo(o.ProtocolCommon.NatTraversal.UdpChecksumEnable, nil) + } + } + if o.ProtocolCommon.PassiveMode != nil { + nestedProtocolCommon.PassiveMode = util.YesNo(o.ProtocolCommon.PassiveMode, nil) + } + } + entry.ProtocolCommon = nestedProtocolCommon + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + var nestedAuthentication *Authentication + if o.Authentication != nil { + nestedAuthentication = &Authentication{} + if o.Authentication.Misc != nil { + entry.Misc["Authentication"] = o.Authentication.Misc + } + if o.Authentication.PreSharedKey != nil { + nestedAuthentication.PreSharedKey = &AuthenticationPreSharedKey{} + if o.Authentication.PreSharedKey.Misc != nil { + entry.Misc["AuthenticationPreSharedKey"] = o.Authentication.PreSharedKey.Misc + } + if o.Authentication.PreSharedKey.Key != nil { + nestedAuthentication.PreSharedKey.Key = o.Authentication.PreSharedKey.Key + } + } + if o.Authentication.Certificate != nil { + nestedAuthentication.Certificate = &AuthenticationCertificate{} + if o.Authentication.Certificate.Misc != nil { + entry.Misc["AuthenticationCertificate"] = o.Authentication.Certificate.Misc + } + if o.Authentication.Certificate.AllowIdPayloadMismatch != nil { + nestedAuthentication.Certificate.AllowIdPayloadMismatch = util.AsBool(o.Authentication.Certificate.AllowIdPayloadMismatch, nil) + } + if o.Authentication.Certificate.CertificateProfile != nil { + nestedAuthentication.Certificate.CertificateProfile = o.Authentication.Certificate.CertificateProfile + } + if o.Authentication.Certificate.LocalCertificate != nil { + nestedAuthentication.Certificate.LocalCertificate = &AuthenticationCertificateLocalCertificate{} + if o.Authentication.Certificate.LocalCertificate.Misc != nil { + entry.Misc["AuthenticationCertificateLocalCertificate"] = o.Authentication.Certificate.LocalCertificate.Misc + } + if o.Authentication.Certificate.LocalCertificate.HashAndUrl != nil { + nestedAuthentication.Certificate.LocalCertificate.HashAndUrl = &AuthenticationCertificateLocalCertificateHashAndUrl{} + if o.Authentication.Certificate.LocalCertificate.HashAndUrl.Misc != nil { + entry.Misc["AuthenticationCertificateLocalCertificateHashAndUrl"] = o.Authentication.Certificate.LocalCertificate.HashAndUrl.Misc + } + if o.Authentication.Certificate.LocalCertificate.HashAndUrl.BaseUrl != nil { + nestedAuthentication.Certificate.LocalCertificate.HashAndUrl.BaseUrl = o.Authentication.Certificate.LocalCertificate.HashAndUrl.BaseUrl + } + if o.Authentication.Certificate.LocalCertificate.HashAndUrl.Enable != nil { + nestedAuthentication.Certificate.LocalCertificate.HashAndUrl.Enable = util.AsBool(o.Authentication.Certificate.LocalCertificate.HashAndUrl.Enable, nil) + } + } + if o.Authentication.Certificate.LocalCertificate.Name != nil { + nestedAuthentication.Certificate.LocalCertificate.Name = o.Authentication.Certificate.LocalCertificate.Name + } + } + if o.Authentication.Certificate.StrictValidationRevocation != nil { + nestedAuthentication.Certificate.StrictValidationRevocation = util.AsBool(o.Authentication.Certificate.StrictValidationRevocation, nil) + } + if o.Authentication.Certificate.UseManagementAsSource != nil { + nestedAuthentication.Certificate.UseManagementAsSource = util.AsBool(o.Authentication.Certificate.UseManagementAsSource, nil) + } + } + } + entry.Authentication = nestedAuthentication + + entry.Comment = o.Comment + entry.Disabled = util.AsBool(o.Disabled, nil) + entry.Ipv6 = util.AsBool(o.Ipv6, nil) + var nestedLocalAddress *LocalAddress + if o.LocalAddress != nil { + nestedLocalAddress = &LocalAddress{} + if o.LocalAddress.Misc != nil { + entry.Misc["LocalAddress"] = o.LocalAddress.Misc + } + if o.LocalAddress.Interface != nil { + nestedLocalAddress.Interface = o.LocalAddress.Interface + } + if o.LocalAddress.FloatingIp != nil { + nestedLocalAddress.FloatingIp = o.LocalAddress.FloatingIp + } + if o.LocalAddress.Ip != nil { + nestedLocalAddress.Ip = o.LocalAddress.Ip + } + } + entry.LocalAddress = nestedLocalAddress + + var nestedLocalId *LocalId + if o.LocalId != nil { + nestedLocalId = &LocalId{} + if o.LocalId.Misc != nil { + entry.Misc["LocalId"] = o.LocalId.Misc + } + if o.LocalId.Id != nil { + nestedLocalId.Id = o.LocalId.Id + } + if o.LocalId.Type != nil { + nestedLocalId.Type = o.LocalId.Type + } + } + entry.LocalId = nestedLocalId + + var nestedPeerAddress *PeerAddress + if o.PeerAddress != nil { + nestedPeerAddress = &PeerAddress{} + if o.PeerAddress.Misc != nil { + entry.Misc["PeerAddress"] = o.PeerAddress.Misc + } + if o.PeerAddress.Fqdn != nil { + nestedPeerAddress.Fqdn = o.PeerAddress.Fqdn + } + if o.PeerAddress.Ip != nil { + nestedPeerAddress.Ip = o.PeerAddress.Ip + } + if o.PeerAddress.Dynamic != nil { + nestedPeerAddress.Dynamic = &PeerAddressDynamic{} + if o.PeerAddress.Dynamic.Misc != nil { + entry.Misc["PeerAddressDynamic"] = o.PeerAddress.Dynamic.Misc + } + } + } + entry.PeerAddress = nestedPeerAddress + + var nestedPeerId *PeerId + if o.PeerId != nil { + nestedPeerId = &PeerId{} + if o.PeerId.Misc != nil { + entry.Misc["PeerId"] = o.PeerId.Misc + } + if o.PeerId.Id != nil { + nestedPeerId.Id = o.PeerId.Id + } + if o.PeerId.Matching != nil { + nestedPeerId.Matching = o.PeerId.Matching + } + if o.PeerId.Type != nil { + nestedPeerId.Type = o.PeerId.Type + } + } + entry.PeerId = nestedPeerId + + var nestedProtocol *Protocol + if o.Protocol != nil { + nestedProtocol = &Protocol{} + if o.Protocol.Misc != nil { + entry.Misc["Protocol"] = o.Protocol.Misc + } + if o.Protocol.Ikev1 != nil { + nestedProtocol.Ikev1 = &ProtocolIkev1{} + if o.Protocol.Ikev1.Misc != nil { + entry.Misc["ProtocolIkev1"] = o.Protocol.Ikev1.Misc + } + if o.Protocol.Ikev1.Dpd != nil { + nestedProtocol.Ikev1.Dpd = &ProtocolIkev1Dpd{} + if o.Protocol.Ikev1.Dpd.Misc != nil { + entry.Misc["ProtocolIkev1Dpd"] = o.Protocol.Ikev1.Dpd.Misc + } + if o.Protocol.Ikev1.Dpd.Retry != nil { + nestedProtocol.Ikev1.Dpd.Retry = o.Protocol.Ikev1.Dpd.Retry + } + if o.Protocol.Ikev1.Dpd.Enable != nil { + nestedProtocol.Ikev1.Dpd.Enable = util.AsBool(o.Protocol.Ikev1.Dpd.Enable, nil) + } + if o.Protocol.Ikev1.Dpd.Interval != nil { + nestedProtocol.Ikev1.Dpd.Interval = o.Protocol.Ikev1.Dpd.Interval + } + } + if o.Protocol.Ikev1.ExchangeMode != nil { + nestedProtocol.Ikev1.ExchangeMode = o.Protocol.Ikev1.ExchangeMode + } + if o.Protocol.Ikev1.IkeCryptoProfile != nil { + nestedProtocol.Ikev1.IkeCryptoProfile = o.Protocol.Ikev1.IkeCryptoProfile + } + } + if o.Protocol.Ikev2 != nil { + nestedProtocol.Ikev2 = &ProtocolIkev2{} + if o.Protocol.Ikev2.Misc != nil { + entry.Misc["ProtocolIkev2"] = o.Protocol.Ikev2.Misc + } + if o.Protocol.Ikev2.Dpd != nil { + nestedProtocol.Ikev2.Dpd = &ProtocolIkev2Dpd{} + if o.Protocol.Ikev2.Dpd.Misc != nil { + entry.Misc["ProtocolIkev2Dpd"] = o.Protocol.Ikev2.Dpd.Misc + } + if o.Protocol.Ikev2.Dpd.Enable != nil { + nestedProtocol.Ikev2.Dpd.Enable = util.AsBool(o.Protocol.Ikev2.Dpd.Enable, nil) + } + if o.Protocol.Ikev2.Dpd.Interval != nil { + nestedProtocol.Ikev2.Dpd.Interval = o.Protocol.Ikev2.Dpd.Interval + } + } + if o.Protocol.Ikev2.IkeCryptoProfile != nil { + nestedProtocol.Ikev2.IkeCryptoProfile = o.Protocol.Ikev2.IkeCryptoProfile + } + if o.Protocol.Ikev2.RequireCookie != nil { + nestedProtocol.Ikev2.RequireCookie = util.AsBool(o.Protocol.Ikev2.RequireCookie, nil) + } + } + if o.Protocol.Version != nil { + nestedProtocol.Version = o.Protocol.Version + } + } + entry.Protocol = nestedProtocol + + var nestedProtocolCommon *ProtocolCommon + if o.ProtocolCommon != nil { + nestedProtocolCommon = &ProtocolCommon{} + if o.ProtocolCommon.Misc != nil { + entry.Misc["ProtocolCommon"] = o.ProtocolCommon.Misc + } + if o.ProtocolCommon.PassiveMode != nil { + nestedProtocolCommon.PassiveMode = util.AsBool(o.ProtocolCommon.PassiveMode, nil) + } + if o.ProtocolCommon.Fragmentation != nil { + nestedProtocolCommon.Fragmentation = &ProtocolCommonFragmentation{} + if o.ProtocolCommon.Fragmentation.Misc != nil { + entry.Misc["ProtocolCommonFragmentation"] = o.ProtocolCommon.Fragmentation.Misc + } + if o.ProtocolCommon.Fragmentation.Enable != nil { + nestedProtocolCommon.Fragmentation.Enable = util.AsBool(o.ProtocolCommon.Fragmentation.Enable, nil) + } + } + if o.ProtocolCommon.NatTraversal != nil { + nestedProtocolCommon.NatTraversal = &ProtocolCommonNatTraversal{} + if o.ProtocolCommon.NatTraversal.Misc != nil { + entry.Misc["ProtocolCommonNatTraversal"] = o.ProtocolCommon.NatTraversal.Misc + } + if o.ProtocolCommon.NatTraversal.Enable != nil { + nestedProtocolCommon.NatTraversal.Enable = util.AsBool(o.ProtocolCommon.NatTraversal.Enable, nil) + } + if o.ProtocolCommon.NatTraversal.KeepAliveInterval != nil { + nestedProtocolCommon.NatTraversal.KeepAliveInterval = o.ProtocolCommon.NatTraversal.KeepAliveInterval + } + if o.ProtocolCommon.NatTraversal.UdpChecksumEnable != nil { + nestedProtocolCommon.NatTraversal.UdpChecksumEnable = util.AsBool(o.ProtocolCommon.NatTraversal.UdpChecksumEnable, nil) + } + } + } + entry.ProtocolCommon = nestedProtocolCommon + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !matchAuthentication(a.Authentication, b.Authentication) { + return false + } + if !util.StringsMatch(a.Comment, b.Comment) { + return false + } + if !util.BoolsMatch(a.Disabled, b.Disabled) { + return false + } + if !util.BoolsMatch(a.Ipv6, b.Ipv6) { + return false + } + if !matchLocalAddress(a.LocalAddress, b.LocalAddress) { + return false + } + if !matchLocalId(a.LocalId, b.LocalId) { + return false + } + if !matchPeerAddress(a.PeerAddress, b.PeerAddress) { + return false + } + if !matchPeerId(a.PeerId, b.PeerId) { + return false + } + if !matchProtocol(a.Protocol, b.Protocol) { + return false + } + if !matchProtocolCommon(a.ProtocolCommon, b.ProtocolCommon) { + return false + } + + return true +} + +func matchLocalAddress(a *LocalAddress, b *LocalAddress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Interface, b.Interface) { + return false + } + if !util.StringsMatch(a.FloatingIp, b.FloatingIp) { + return false + } + if !util.StringsMatch(a.Ip, b.Ip) { + return false + } + return true +} +func matchPeerAddressDynamic(a *PeerAddressDynamic, b *PeerAddressDynamic) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchPeerAddress(a *PeerAddress, b *PeerAddress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Ip, b.Ip) { + return false + } + if !matchPeerAddressDynamic(a.Dynamic, b.Dynamic) { + return false + } + if !util.StringsMatch(a.Fqdn, b.Fqdn) { + return false + } + return true +} +func matchPeerId(a *PeerId, b *PeerId) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Id, b.Id) { + return false + } + if !util.StringsMatch(a.Matching, b.Matching) { + return false + } + if !util.StringsMatch(a.Type, b.Type) { + return false + } + return true +} +func matchProtocolIkev1Dpd(a *ProtocolIkev1Dpd, b *ProtocolIkev1Dpd) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.Interval, b.Interval) { + return false + } + if !util.Ints64Match(a.Retry, b.Retry) { + return false + } + return true +} +func matchProtocolIkev1(a *ProtocolIkev1, b *ProtocolIkev1) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolIkev1Dpd(a.Dpd, b.Dpd) { + return false + } + if !util.StringsMatch(a.ExchangeMode, b.ExchangeMode) { + return false + } + if !util.StringsMatch(a.IkeCryptoProfile, b.IkeCryptoProfile) { + return false + } + return true +} +func matchProtocolIkev2Dpd(a *ProtocolIkev2Dpd, b *ProtocolIkev2Dpd) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.Interval, b.Interval) { + return false + } + return true +} +func matchProtocolIkev2(a *ProtocolIkev2, b *ProtocolIkev2) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolIkev2Dpd(a.Dpd, b.Dpd) { + return false + } + if !util.StringsMatch(a.IkeCryptoProfile, b.IkeCryptoProfile) { + return false + } + if !util.BoolsMatch(a.RequireCookie, b.RequireCookie) { + return false + } + return true +} +func matchProtocol(a *Protocol, b *Protocol) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolIkev1(a.Ikev1, b.Ikev1) { + return false + } + if !matchProtocolIkev2(a.Ikev2, b.Ikev2) { + return false + } + if !util.StringsMatch(a.Version, b.Version) { + return false + } + return true +} +func matchProtocolCommonNatTraversal(a *ProtocolCommonNatTraversal, b *ProtocolCommonNatTraversal) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.KeepAliveInterval, b.KeepAliveInterval) { + return false + } + if !util.BoolsMatch(a.UdpChecksumEnable, b.UdpChecksumEnable) { + return false + } + return true +} +func matchProtocolCommonFragmentation(a *ProtocolCommonFragmentation, b *ProtocolCommonFragmentation) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + return true +} +func matchProtocolCommon(a *ProtocolCommon, b *ProtocolCommon) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolCommonFragmentation(a.Fragmentation, b.Fragmentation) { + return false + } + if !matchProtocolCommonNatTraversal(a.NatTraversal, b.NatTraversal) { + return false + } + if !util.BoolsMatch(a.PassiveMode, b.PassiveMode) { + return false + } + return true +} +func matchLocalId(a *LocalId, b *LocalId) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Id, b.Id) { + return false + } + if !util.StringsMatch(a.Type, b.Type) { + return false + } + return true +} +func matchAuthenticationCertificateLocalCertificateHashAndUrl(a *AuthenticationCertificateLocalCertificateHashAndUrl, b *AuthenticationCertificateLocalCertificateHashAndUrl) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.BaseUrl, b.BaseUrl) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + return true +} +func matchAuthenticationCertificateLocalCertificate(a *AuthenticationCertificateLocalCertificate, b *AuthenticationCertificateLocalCertificate) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchAuthenticationCertificateLocalCertificateHashAndUrl(a.HashAndUrl, b.HashAndUrl) { + return false + } + if !util.StringsMatch(a.Name, b.Name) { + return false + } + return true +} +func matchAuthenticationCertificate(a *AuthenticationCertificate, b *AuthenticationCertificate) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchAuthenticationCertificateLocalCertificate(a.LocalCertificate, b.LocalCertificate) { + return false + } + if !util.BoolsMatch(a.StrictValidationRevocation, b.StrictValidationRevocation) { + return false + } + if !util.BoolsMatch(a.UseManagementAsSource, b.UseManagementAsSource) { + return false + } + if !util.BoolsMatch(a.AllowIdPayloadMismatch, b.AllowIdPayloadMismatch) { + return false + } + if !util.StringsMatch(a.CertificateProfile, b.CertificateProfile) { + return false + } + return true +} +func matchAuthenticationPreSharedKey(a *AuthenticationPreSharedKey, b *AuthenticationPreSharedKey) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Key, b.Key) { + return false + } + return true +} +func matchAuthentication(a *Authentication, b *Authentication) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchAuthenticationPreSharedKey(a.PreSharedKey, b.PreSharedKey) { + return false + } + if !matchAuthenticationCertificate(a.Certificate, b.Certificate) { + return false + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/crypto/ike/gateway/interfaces.go b/crypto/ike/gateway/interfaces.go new file mode 100644 index 00000000..aabd4b8f --- /dev/null +++ b/crypto/ike/gateway/interfaces.go @@ -0,0 +1,7 @@ +package gateway + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/crypto/ike/gateway/location.go b/crypto/ike/gateway/location.go new file mode 100644 index 00000000..d123f89d --- /dev/null +++ b/crypto/ike/gateway/location.go @@ -0,0 +1,187 @@ +package gateway + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + Ngfw *NgfwLocation `json:"ngfw,omitempty"` + Template *TemplateLocation `json:"template,omitempty"` + TemplateStack *TemplateStackLocation `json:"template_stack,omitempty"` +} + +type NgfwLocation struct { + NgfwDevice string `json:"ngfw_device"` +} + +type TemplateLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + Template string `json:"template"` +} + +type TemplateStackLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + TemplateStack string `json:"template_stack"` +} + +func NewNgfwLocation() *Location { + return &Location{Ngfw: &NgfwLocation{ + NgfwDevice: "localhost.localdomain", + }, + } +} +func NewTemplateLocation() *Location { + return &Location{Template: &TemplateLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + Template: "", + }, + } +} +func NewTemplateStackLocation() *Location { + return &Location{TemplateStack: &TemplateStackLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + TemplateStack: "", + }, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.Ngfw != nil: + if o.Ngfw.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + count++ + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return fmt.Errorf("Template is unspecified") + } + count++ + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return fmt.Errorf("TemplateStack is unspecified") + } + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.Ngfw != nil: + if o.Ngfw.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Ngfw.NgfwDevice}), + } + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return nil, fmt.Errorf("Template is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Template.PanoramaDevice}), + "template", + util.AsEntryXpath([]string{o.Template.Template}), + "config", + "devices", + util.AsEntryXpath([]string{o.Template.NgfwDevice}), + } + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return nil, fmt.Errorf("TemplateStack is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.PanoramaDevice}), + "template-stack", + util.AsEntryXpath([]string{o.TemplateStack.TemplateStack}), + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.NgfwDevice}), + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/crypto/ike/gateway/service.go b/crypto/ike/gateway/service.go new file mode 100644 index 00000000..ffb52947 --- /dev/null +++ b/crypto/ike/gateway/service.go @@ -0,0 +1,281 @@ +package gateway + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/device/adminrole/entry.go b/device/adminrole/entry.go new file mode 100644 index 00000000..12bc1628 --- /dev/null +++ b/device/adminrole/entry.go @@ -0,0 +1,8766 @@ +package adminrole + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"admin-role"} +) + +type Entry struct { + Name string + Description *string + Role *Role + + Misc map[string][]generic.Xml +} + +type Role struct { + Device *RoleDevice + Vsys *RoleVsys +} +type RoleDevice struct { + Cli *string + Restapi *RoleDeviceRestapi + Webui *RoleDeviceWebui + Xmlapi *RoleDeviceXmlapi +} +type RoleDeviceRestapi struct { + Device *RoleDeviceRestapiDevice + Network *RoleDeviceRestapiNetwork + Objects *RoleDeviceRestapiObjects + Policies *RoleDeviceRestapiPolicies + System *RoleDeviceRestapiSystem +} +type RoleDeviceRestapiDevice struct { + EmailServerProfiles *string + HttpServerProfiles *string + LdapServerProfiles *string + LogInterfaceSetting *string + SnmpTrapServerProfiles *string + SyslogServerProfiles *string + VirtualSystems *string +} +type RoleDeviceRestapiNetwork struct { + AggregateEthernetInterfaces *string + BfdNetworkProfiles *string + BgpRoutingProfiles *string + DhcpRelays *string + DhcpServers *string + DnsProxies *string + EthernetInterfaces *string + GlobalprotectClientlessAppGroups *string + GlobalprotectClientlessApps *string + GlobalprotectGateways *string + GlobalprotectIpsecCryptoNetworkProfiles *string + GlobalprotectMdmServers *string + GlobalprotectPortals *string + GreTunnels *string + IkeCryptoNetworkProfiles *string + IkeGatewayNetworkProfiles *string + InterfaceManagementNetworkProfiles *string + IpsecCryptoNetworkProfiles *string + IpsecTunnels *string + Lldp *string + LldpNetworkProfiles *string + LogicalRouters *string + LoopbackInterfaces *string + QosInterfaces *string + QosNetworkProfiles *string + SdwanInterfaceProfiles *string + SdwanInterfaces *string + TunnelInterfaces *string + TunnelMonitorNetworkProfiles *string + VirtualRouters *string + VirtualWires *string + VlanInterfaces *string + Vlans *string + ZoneProtectionNetworkProfiles *string + Zones *string +} +type RoleDeviceRestapiObjects struct { + AddressGroups *string + Addresses *string + AntiSpywareSecurityProfiles *string + AntivirusSecurityProfiles *string + ApplicationFilters *string + ApplicationGroups *string + Applications *string + AuthenticationEnforcements *string + CustomDataPatterns *string + CustomSpywareSignatures *string + CustomUrlCategories *string + CustomVulnerabilitySignatures *string + DataFilteringSecurityProfiles *string + DecryptionProfiles *string + Devices *string + DosProtectionSecurityProfiles *string + DynamicUserGroups *string + ExternalDynamicLists *string + FileBlockingSecurityProfiles *string + GlobalprotectHipObjects *string + GlobalprotectHipProfiles *string + GtpProtectionSecurityProfiles *string + LogForwardingProfiles *string + PacketBrokerProfiles *string + Regions *string + Schedules *string + SctpProtectionSecurityProfiles *string + SdwanErrorCorrectionProfiles *string + SdwanPathQualityProfiles *string + SdwanSaasQualityProfiles *string + SdwanTrafficDistributionProfiles *string + SecurityProfileGroups *string + ServiceGroups *string + Services *string + Tags *string + UrlFilteringSecurityProfiles *string + VulnerabilityProtectionSecurityProfiles *string + WildfireAnalysisSecurityProfiles *string +} +type RoleDeviceRestapiPolicies struct { + ApplicationOverrideRules *string + AuthenticationRules *string + DecryptionRules *string + DosRules *string + NatRules *string + NetworkPacketBrokerRules *string + PolicyBasedForwardingRules *string + QosRules *string + SdwanRules *string + SecurityRules *string + TunnelInspectionRules *string +} +type RoleDeviceRestapiSystem struct { + Configuration *string +} +type RoleDeviceWebui struct { + Acc *string + Commit *RoleDeviceWebuiCommit + Dashboard *string + Device *RoleDeviceWebuiDevice + Global *RoleDeviceWebuiGlobal + Monitor *RoleDeviceWebuiMonitor + Network *RoleDeviceWebuiNetwork + Objects *RoleDeviceWebuiObjects + Operations *RoleDeviceWebuiOperations + Policies *RoleDeviceWebuiPolicies + Privacy *RoleDeviceWebuiPrivacy + Save *RoleDeviceWebuiSave + Tasks *string + Validate *string +} +type RoleDeviceWebuiCommit struct { + CommitForOtherAdmins *string + Device *string + ObjectLevelChanges *string +} +type RoleDeviceWebuiDevice struct { + AccessDomain *string + AdminRoles *string + Administrators *string + AuthenticationProfile *string + AuthenticationSequence *string + BlockPages *string + CertificateManagement *RoleDeviceWebuiDeviceCertificateManagement + ConfigAudit *string + DataRedistribution *string + DeviceQuarantine *string + DhcpSyslogServer *string + DynamicUpdates *string + GlobalProtectClient *string + HighAvailability *string + Licenses *string + LocalUserDatabase *RoleDeviceWebuiDeviceLocalUserDatabase + LogFwdCard *string + LogSettings *RoleDeviceWebuiDeviceLogSettings + MasterKey *string + Plugins *string + PolicyRecommendations *RoleDeviceWebuiDevicePolicyRecommendations + ScheduledLogExport *string + ServerProfile *RoleDeviceWebuiDeviceServerProfile + Setup *RoleDeviceWebuiDeviceSetup + SharedGateways *string + Software *string + Support *string + Troubleshooting *string + UserIdentification *string + VirtualSystems *string + VmInfoSource *string +} +type RoleDeviceWebuiDeviceCertificateManagement struct { + CertificateProfile *string + Certificates *string + OcspResponder *string + Scep *string + SshServiceProfile *string + SslDecryptionExclusion *string + SslTlsServiceProfile *string +} +type RoleDeviceWebuiDeviceLocalUserDatabase struct { + UserGroups *string + Users *string +} +type RoleDeviceWebuiDeviceLogSettings struct { + CcAlarm *string + Config *string + Correlation *string + Globalprotect *string + Hipmatch *string + Iptag *string + ManageLog *string + System *string + UserId *string +} +type RoleDeviceWebuiDevicePolicyRecommendations struct { + Iot *string + Saas *string +} +type RoleDeviceWebuiDeviceServerProfile struct { + Dns *string + Email *string + Http *string + Kerberos *string + Ldap *string + Mfa *string + Netflow *string + Radius *string + SamlIdp *string + Scp *string + SnmpTrap *string + Syslog *string + Tacplus *string +} +type RoleDeviceWebuiDeviceSetup struct { + ContentId *string + Hsm *string + Interfaces *string + Management *string + Operations *string + Services *string + Session *string + Telemetry *string + Wildfire *string +} +type RoleDeviceWebuiGlobal struct { + SystemAlarms *string +} +type RoleDeviceWebuiMonitor struct { + AppScope *string + ApplicationReports *string + AutomatedCorrelationEngine *RoleDeviceWebuiMonitorAutomatedCorrelationEngine + BlockIpList *string + Botnet *string + CustomReports *RoleDeviceWebuiMonitorCustomReports + ExternalLogs *string + GtpReports *string + Logs *RoleDeviceWebuiMonitorLogs + PacketCapture *string + PdfReports *RoleDeviceWebuiMonitorPdfReports + SctpReports *string + SessionBrowser *string + ThreatReports *string + TrafficReports *string + UrlFilteringReports *string + ViewCustomReports *string +} +type RoleDeviceWebuiMonitorAutomatedCorrelationEngine struct { + CorrelatedEvents *string + CorrelationObjects *string +} +type RoleDeviceWebuiMonitorCustomReports struct { + ApplicationStatistics *string + Auth *string + DataFilteringLog *string + DecryptionLog *string + DecryptionSummary *string + Globalprotect *string + GtpLog *string + GtpSummary *string + Hipmatch *string + Iptag *string + SctpLog *string + SctpSummary *string + ThreatLog *string + ThreatSummary *string + TrafficLog *string + TrafficSummary *string + TunnelLog *string + TunnelSummary *string + UrlLog *string + UrlSummary *string + Userid *string + WildfireLog *string +} +type RoleDeviceWebuiMonitorLogs struct { + Alarm *string + Authentication *string + Configuration *string + DataFiltering *string + Decryption *string + Globalprotect *string + Gtp *string + Hipmatch *string + Iptag *string + Sctp *string + System *string + Threat *string + Traffic *string + Tunnel *string + Url *string + Userid *string + Wildfire *string +} +type RoleDeviceWebuiMonitorPdfReports struct { + EmailScheduler *string + ManagePdfSummary *string + PdfSummaryReports *string + ReportGroups *string + SaasApplicationUsageReport *string + UserActivityReport *string +} +type RoleDeviceWebuiNetwork struct { + Dhcp *string + DnsProxy *string + GlobalProtect *RoleDeviceWebuiNetworkGlobalProtect + GreTunnels *string + Interfaces *string + IpsecTunnels *string + Lldp *string + NetworkProfiles *RoleDeviceWebuiNetworkNetworkProfiles + Qos *string + Routing *RoleDeviceWebuiNetworkRouting + SdwanInterfaceProfile *string + SecureWebGateway *string + VirtualRouters *string + VirtualWires *string + Vlans *string + Zones *string +} +type RoleDeviceWebuiNetworkGlobalProtect struct { + ClientlessAppGroups *string + ClientlessApps *string + Gateways *string + Mdm *string + Portals *string +} +type RoleDeviceWebuiNetworkNetworkProfiles struct { + BfdProfile *string + GpAppIpsecCrypto *string + IkeCrypto *string + IkeGateways *string + InterfaceMgmt *string + IpsecCrypto *string + LldpProfile *string + QosProfile *string + TunnelMonitor *string + ZoneProtection *string +} +type RoleDeviceWebuiNetworkRouting struct { + LogicalRouters *string + RoutingProfiles *RoleDeviceWebuiNetworkRoutingRoutingProfiles +} +type RoleDeviceWebuiNetworkRoutingRoutingProfiles struct { + Bfd *string + Bgp *string + Filters *string + Multicast *string + Ospf *string + Ospfv3 *string + Ripv2 *string +} +type RoleDeviceWebuiObjects struct { + AddressGroups *string + Addresses *string + ApplicationFilters *string + ApplicationGroups *string + Applications *string + Authentication *string + CustomObjects *RoleDeviceWebuiObjectsCustomObjects + Decryption *RoleDeviceWebuiObjectsDecryption + Devices *string + DynamicBlockLists *string + DynamicUserGroups *string + GlobalProtect *RoleDeviceWebuiObjectsGlobalProtect + LogForwarding *string + PacketBrokerProfile *string + Regions *string + Schedules *string + Sdwan *RoleDeviceWebuiObjectsSdwan + SecurityProfileGroups *string + SecurityProfiles *RoleDeviceWebuiObjectsSecurityProfiles + ServiceGroups *string + Services *string + Tags *string +} +type RoleDeviceWebuiObjectsCustomObjects struct { + DataPatterns *string + Spyware *string + UrlCategory *string + Vulnerability *string +} +type RoleDeviceWebuiObjectsDecryption struct { + DecryptionProfile *string +} +type RoleDeviceWebuiObjectsGlobalProtect struct { + HipObjects *string + HipProfiles *string +} +type RoleDeviceWebuiObjectsSdwan struct { + SdwanDistProfile *string + SdwanErrorCorrectionProfile *string + SdwanProfile *string + SdwanSaasQualityProfile *string +} +type RoleDeviceWebuiObjectsSecurityProfiles struct { + AntiSpyware *string + Antivirus *string + DataFiltering *string + DosProtection *string + FileBlocking *string + GtpProtection *string + SctpProtection *string + UrlFiltering *string + VulnerabilityProtection *string + WildfireAnalysis *string +} +type RoleDeviceWebuiOperations struct { + DownloadCoreFiles *string + DownloadPcapFiles *string + GenerateStatsDumpFile *string + GenerateTechSupportFile *string + Reboot *string +} +type RoleDeviceWebuiPolicies struct { + ApplicationOverrideRulebase *string + AuthenticationRulebase *string + DosRulebase *string + NatRulebase *string + NetworkPacketBrokerRulebase *string + PbfRulebase *string + QosRulebase *string + RuleHitCountReset *string + SdwanRulebase *string + SecurityRulebase *string + SslDecryptionRulebase *string + TunnelInspectRulebase *string +} +type RoleDeviceWebuiPrivacy struct { + ShowFullIpAddresses *string + ShowUserNamesInLogsAndReports *string + ViewPcapFiles *string +} +type RoleDeviceWebuiSave struct { + ObjectLevelChanges *string + PartialSave *string + SaveForOtherAdmins *string +} +type RoleDeviceXmlapi struct { + Commit *string + Config *string + Export *string + Import *string + Iot *string + Log *string + Op *string + Report *string + UserId *string +} +type RoleVsys struct { + Cli *string + Restapi *RoleVsysRestapi + Webui *RoleVsysWebui + Xmlapi *RoleVsysXmlapi +} +type RoleVsysRestapi struct { + Device *RoleVsysRestapiDevice + Network *RoleVsysRestapiNetwork + Objects *RoleVsysRestapiObjects + Policies *RoleVsysRestapiPolicies + System *RoleVsysRestapiSystem +} +type RoleVsysRestapiDevice struct { + EmailServerProfiles *string + HttpServerProfiles *string + LdapServerProfiles *string + LogInterfaceSetting *string + SnmpTrapServerProfiles *string + SyslogServerProfiles *string + VirtualSystems *string +} +type RoleVsysRestapiNetwork struct { + GlobalprotectClientlessAppGroups *string + GlobalprotectClientlessApps *string + GlobalprotectGateways *string + GlobalprotectMdmServers *string + GlobalprotectPortals *string + SdwanInterfaceProfiles *string + Zones *string +} +type RoleVsysRestapiObjects struct { + AddressGroups *string + Addresses *string + AntiSpywareSecurityProfiles *string + AntivirusSecurityProfiles *string + ApplicationFilters *string + ApplicationGroups *string + Applications *string + AuthenticationEnforcements *string + CustomDataPatterns *string + CustomSpywareSignatures *string + CustomUrlCategories *string + CustomVulnerabilitySignatures *string + DataFilteringSecurityProfiles *string + DecryptionProfiles *string + Devices *string + DosProtectionSecurityProfiles *string + DynamicUserGroups *string + ExternalDynamicLists *string + FileBlockingSecurityProfiles *string + GlobalprotectHipObjects *string + GlobalprotectHipProfiles *string + GtpProtectionSecurityProfiles *string + LogForwardingProfiles *string + PacketBrokerProfiles *string + Regions *string + Schedules *string + SctpProtectionSecurityProfiles *string + SdwanErrorCorrectionProfiles *string + SdwanPathQualityProfiles *string + SdwanSaasQualityProfiles *string + SdwanTrafficDistributionProfiles *string + SecurityProfileGroups *string + ServiceGroups *string + Services *string + Tags *string + UrlFilteringSecurityProfiles *string + VulnerabilityProtectionSecurityProfiles *string + WildfireAnalysisSecurityProfiles *string +} +type RoleVsysRestapiPolicies struct { + ApplicationOverrideRules *string + AuthenticationRules *string + DecryptionRules *string + DosRules *string + NatRules *string + NetworkPacketBrokerRules *string + PolicyBasedForwardingRules *string + QosRules *string + SdwanRules *string + SecurityRules *string + TunnelInspectionRules *string +} +type RoleVsysRestapiSystem struct { + Configuration *string +} +type RoleVsysWebui struct { + Acc *string + Commit *RoleVsysWebuiCommit + Dashboard *string + Device *RoleVsysWebuiDevice + Monitor *RoleVsysWebuiMonitor + Network *RoleVsysWebuiNetwork + Objects *RoleVsysWebuiObjects + Operations *RoleVsysWebuiOperations + Policies *RoleVsysWebuiPolicies + Privacy *RoleVsysWebuiPrivacy + Save *RoleVsysWebuiSave + Tasks *string + Validate *string +} +type RoleVsysWebuiCommit struct { + CommitForOtherAdmins *string + VirtualSystems *string +} +type RoleVsysWebuiDevice struct { + Administrators *string + AuthenticationProfile *string + AuthenticationSequence *string + BlockPages *string + CertificateManagement *RoleVsysWebuiDeviceCertificateManagement + DataRedistribution *string + DeviceQuarantine *string + DhcpSyslogServer *string + LocalUserDatabase *RoleVsysWebuiDeviceLocalUserDatabase + LogSettings *RoleVsysWebuiDeviceLogSettings + PolicyRecommendations *RoleVsysWebuiDevicePolicyRecommendations + ServerProfile *RoleVsysWebuiDeviceServerProfile + Setup *RoleVsysWebuiDeviceSetup + Troubleshooting *string + UserIdentification *string + VmInfoSource *string +} +type RoleVsysWebuiDeviceCertificateManagement struct { + CertificateProfile *string + Certificates *string + OcspResponder *string + Scep *string + SshServiceProfile *string + SslDecryptionExclusion *string + SslTlsServiceProfile *string +} +type RoleVsysWebuiDeviceLocalUserDatabase struct { + UserGroups *string + Users *string +} +type RoleVsysWebuiDeviceLogSettings struct { + Config *string + Correlation *string + Globalprotect *string + Hipmatch *string + Iptag *string + System *string + UserId *string +} +type RoleVsysWebuiDevicePolicyRecommendations struct { + Iot *string + Saas *string +} +type RoleVsysWebuiDeviceServerProfile struct { + Dns *string + Email *string + Http *string + Kerberos *string + Ldap *string + Mfa *string + Netflow *string + Radius *string + SamlIdp *string + Scp *string + SnmpTrap *string + Syslog *string + Tacplus *string +} +type RoleVsysWebuiDeviceSetup struct { + ContentId *string + Hsm *string + Interfaces *string + Management *string + Operations *string + Services *string + Session *string + Telemetry *string + Wildfire *string +} +type RoleVsysWebuiMonitor struct { + AppScope *string + AutomatedCorrelationEngine *RoleVsysWebuiMonitorAutomatedCorrelationEngine + BlockIpList *string + CustomReports *RoleVsysWebuiMonitorCustomReports + ExternalLogs *string + Logs *RoleVsysWebuiMonitorLogs + PdfReports *RoleVsysWebuiMonitorPdfReports + SessionBrowser *string + ViewCustomReports *string +} +type RoleVsysWebuiMonitorAutomatedCorrelationEngine struct { + CorrelatedEvents *string + CorrelationObjects *string +} +type RoleVsysWebuiMonitorCustomReports struct { + ApplicationStatistics *string + Auth *string + DataFilteringLog *string + DecryptionLog *string + DecryptionSummary *string + Globalprotect *string + GtpLog *string + GtpSummary *string + Hipmatch *string + Iptag *string + SctpLog *string + SctpSummary *string + ThreatLog *string + ThreatSummary *string + TrafficLog *string + TrafficSummary *string + TunnelLog *string + TunnelSummary *string + UrlLog *string + UrlSummary *string + Userid *string + WildfireLog *string +} +type RoleVsysWebuiMonitorLogs struct { + Authentication *string + DataFiltering *string + Decryption *string + Globalprotect *string + Gtp *string + Hipmatch *string + Iptag *string + Sctp *string + Threat *string + Traffic *string + Tunnel *string + Url *string + Userid *string + Wildfire *string +} +type RoleVsysWebuiMonitorPdfReports struct { + EmailScheduler *string + ManagePdfSummary *string + PdfSummaryReports *string + ReportGroups *string + SaasApplicationUsageReport *string + UserActivityReport *string +} +type RoleVsysWebuiNetwork struct { + GlobalProtect *RoleVsysWebuiNetworkGlobalProtect + SdwanInterfaceProfile *string + Zones *string +} +type RoleVsysWebuiNetworkGlobalProtect struct { + ClientlessAppGroups *string + ClientlessApps *string + Gateways *string + Mdm *string + Portals *string +} +type RoleVsysWebuiObjects struct { + AddressGroups *string + Addresses *string + ApplicationFilters *string + ApplicationGroups *string + Applications *string + Authentication *string + CustomObjects *RoleVsysWebuiObjectsCustomObjects + Decryption *RoleVsysWebuiObjectsDecryption + Devices *string + DynamicBlockLists *string + DynamicUserGroups *string + GlobalProtect *RoleVsysWebuiObjectsGlobalProtect + LogForwarding *string + PacketBrokerProfile *string + Regions *string + Schedules *string + Sdwan *RoleVsysWebuiObjectsSdwan + SecurityProfileGroups *string + SecurityProfiles *RoleVsysWebuiObjectsSecurityProfiles + ServiceGroups *string + Services *string + Tags *string +} +type RoleVsysWebuiObjectsCustomObjects struct { + DataPatterns *string + Spyware *string + UrlCategory *string + Vulnerability *string +} +type RoleVsysWebuiObjectsDecryption struct { + DecryptionProfile *string +} +type RoleVsysWebuiObjectsGlobalProtect struct { + HipObjects *string + HipProfiles *string +} +type RoleVsysWebuiObjectsSdwan struct { + SdwanDistProfile *string + SdwanErrorCorrectionProfile *string + SdwanProfile *string + SdwanSaasQualityProfile *string +} +type RoleVsysWebuiObjectsSecurityProfiles struct { + AntiSpyware *string + Antivirus *string + DataFiltering *string + DosProtection *string + FileBlocking *string + GtpProtection *string + SctpProtection *string + UrlFiltering *string + VulnerabilityProtection *string + WildfireAnalysis *string +} +type RoleVsysWebuiOperations struct { + DownloadCoreFiles *string + DownloadPcapFiles *string + GenerateStatsDumpFile *string + GenerateTechSupportFile *string + Reboot *string +} +type RoleVsysWebuiPolicies struct { + ApplicationOverrideRulebase *string + AuthenticationRulebase *string + DosRulebase *string + NatRulebase *string + NetworkPacketBrokerRulebase *string + PbfRulebase *string + QosRulebase *string + RuleHitCountReset *string + SdwanRulebase *string + SecurityRulebase *string + SslDecryptionRulebase *string + TunnelInspectRulebase *string +} +type RoleVsysWebuiPrivacy struct { + ShowFullIpAddresses *string + ShowUserNamesInLogsAndReports *string + ViewPcapFiles *string +} +type RoleVsysWebuiSave struct { + ObjectLevelChanges *string + PartialSave *string + SaveForOtherAdmins *string +} +type RoleVsysXmlapi struct { + Commit *string + Config *string + Export *string + Import *string + Iot *string + Log *string + Op *string + Report *string + UserId *string +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Description *string `xml:"description,omitempty"` + Role *RoleXml `xml:"role,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleXml struct { + Device *RoleDeviceXml `xml:"device,omitempty"` + Vsys *RoleVsysXml `xml:"vsys,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceXml struct { + Cli *string `xml:"cli,omitempty"` + Restapi *RoleDeviceRestapiXml `xml:"restapi,omitempty"` + Webui *RoleDeviceWebuiXml `xml:"webui,omitempty"` + Xmlapi *RoleDeviceXmlapiXml `xml:"xmlapi,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceRestapiXml struct { + Device *RoleDeviceRestapiDeviceXml `xml:"device,omitempty"` + Network *RoleDeviceRestapiNetworkXml `xml:"network,omitempty"` + Objects *RoleDeviceRestapiObjectsXml `xml:"objects,omitempty"` + Policies *RoleDeviceRestapiPoliciesXml `xml:"policies,omitempty"` + System *RoleDeviceRestapiSystemXml `xml:"system,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceRestapiDeviceXml struct { + EmailServerProfiles *string `xml:"email-server-profiles,omitempty"` + HttpServerProfiles *string `xml:"http-server-profiles,omitempty"` + LdapServerProfiles *string `xml:"ldap-server-profiles,omitempty"` + LogInterfaceSetting *string `xml:"log-interface-setting,omitempty"` + SnmpTrapServerProfiles *string `xml:"snmp-trap-server-profiles,omitempty"` + SyslogServerProfiles *string `xml:"syslog-server-profiles,omitempty"` + VirtualSystems *string `xml:"virtual-systems,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceRestapiNetworkXml struct { + AggregateEthernetInterfaces *string `xml:"aggregate-ethernet-interfaces,omitempty"` + BfdNetworkProfiles *string `xml:"bfd-network-profiles,omitempty"` + BgpRoutingProfiles *string `xml:"bgp-routing-profiles,omitempty"` + DhcpRelays *string `xml:"dhcp-relays,omitempty"` + DhcpServers *string `xml:"dhcp-servers,omitempty"` + DnsProxies *string `xml:"dns-proxies,omitempty"` + EthernetInterfaces *string `xml:"ethernet-interfaces,omitempty"` + GlobalprotectClientlessAppGroups *string `xml:"globalprotect-clientless-app-groups,omitempty"` + GlobalprotectClientlessApps *string `xml:"globalprotect-clientless-apps,omitempty"` + GlobalprotectGateways *string `xml:"globalprotect-gateways,omitempty"` + GlobalprotectIpsecCryptoNetworkProfiles *string `xml:"globalprotect-ipsec-crypto-network-profiles,omitempty"` + GlobalprotectMdmServers *string `xml:"globalprotect-mdm-servers,omitempty"` + GlobalprotectPortals *string `xml:"globalprotect-portals,omitempty"` + GreTunnels *string `xml:"gre-tunnels,omitempty"` + IkeCryptoNetworkProfiles *string `xml:"ike-crypto-network-profiles,omitempty"` + IkeGatewayNetworkProfiles *string `xml:"ike-gateway-network-profiles,omitempty"` + InterfaceManagementNetworkProfiles *string `xml:"interface-management-network-profiles,omitempty"` + IpsecCryptoNetworkProfiles *string `xml:"ipsec-crypto-network-profiles,omitempty"` + IpsecTunnels *string `xml:"ipsec-tunnels,omitempty"` + Lldp *string `xml:"lldp,omitempty"` + LldpNetworkProfiles *string `xml:"lldp-network-profiles,omitempty"` + LogicalRouters *string `xml:"logical-routers,omitempty"` + LoopbackInterfaces *string `xml:"loopback-interfaces,omitempty"` + QosInterfaces *string `xml:"qos-interfaces,omitempty"` + QosNetworkProfiles *string `xml:"qos-network-profiles,omitempty"` + SdwanInterfaceProfiles *string `xml:"sdwan-interface-profiles,omitempty"` + SdwanInterfaces *string `xml:"sdwan-interfaces,omitempty"` + TunnelInterfaces *string `xml:"tunnel-interfaces,omitempty"` + TunnelMonitorNetworkProfiles *string `xml:"tunnel-monitor-network-profiles,omitempty"` + VirtualRouters *string `xml:"virtual-routers,omitempty"` + VirtualWires *string `xml:"virtual-wires,omitempty"` + VlanInterfaces *string `xml:"vlan-interfaces,omitempty"` + Vlans *string `xml:"vlans,omitempty"` + ZoneProtectionNetworkProfiles *string `xml:"zone-protection-network-profiles,omitempty"` + Zones *string `xml:"zones,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceRestapiObjectsXml struct { + AddressGroups *string `xml:"address-groups,omitempty"` + Addresses *string `xml:"addresses,omitempty"` + AntiSpywareSecurityProfiles *string `xml:"anti-spyware-security-profiles,omitempty"` + AntivirusSecurityProfiles *string `xml:"antivirus-security-profiles,omitempty"` + ApplicationFilters *string `xml:"application-filters,omitempty"` + ApplicationGroups *string `xml:"application-groups,omitempty"` + Applications *string `xml:"applications,omitempty"` + AuthenticationEnforcements *string `xml:"authentication-enforcements,omitempty"` + CustomDataPatterns *string `xml:"custom-data-patterns,omitempty"` + CustomSpywareSignatures *string `xml:"custom-spyware-signatures,omitempty"` + CustomUrlCategories *string `xml:"custom-url-categories,omitempty"` + CustomVulnerabilitySignatures *string `xml:"custom-vulnerability-signatures,omitempty"` + DataFilteringSecurityProfiles *string `xml:"data-filtering-security-profiles,omitempty"` + DecryptionProfiles *string `xml:"decryption-profiles,omitempty"` + Devices *string `xml:"devices,omitempty"` + DosProtectionSecurityProfiles *string `xml:"dos-protection-security-profiles,omitempty"` + DynamicUserGroups *string `xml:"dynamic-user-groups,omitempty"` + ExternalDynamicLists *string `xml:"external-dynamic-lists,omitempty"` + FileBlockingSecurityProfiles *string `xml:"file-blocking-security-profiles,omitempty"` + GlobalprotectHipObjects *string `xml:"globalprotect-hip-objects,omitempty"` + GlobalprotectHipProfiles *string `xml:"globalprotect-hip-profiles,omitempty"` + GtpProtectionSecurityProfiles *string `xml:"gtp-protection-security-profiles,omitempty"` + LogForwardingProfiles *string `xml:"log-forwarding-profiles,omitempty"` + PacketBrokerProfiles *string `xml:"packet-broker-profiles,omitempty"` + Regions *string `xml:"regions,omitempty"` + Schedules *string `xml:"schedules,omitempty"` + SctpProtectionSecurityProfiles *string `xml:"sctp-protection-security-profiles,omitempty"` + SdwanErrorCorrectionProfiles *string `xml:"sdwan-error-correction-profiles,omitempty"` + SdwanPathQualityProfiles *string `xml:"sdwan-path-quality-profiles,omitempty"` + SdwanSaasQualityProfiles *string `xml:"sdwan-saas-quality-profiles,omitempty"` + SdwanTrafficDistributionProfiles *string `xml:"sdwan-traffic-distribution-profiles,omitempty"` + SecurityProfileGroups *string `xml:"security-profile-groups,omitempty"` + ServiceGroups *string `xml:"service-groups,omitempty"` + Services *string `xml:"services,omitempty"` + Tags *string `xml:"tags,omitempty"` + UrlFilteringSecurityProfiles *string `xml:"url-filtering-security-profiles,omitempty"` + VulnerabilityProtectionSecurityProfiles *string `xml:"vulnerability-protection-security-profiles,omitempty"` + WildfireAnalysisSecurityProfiles *string `xml:"wildfire-analysis-security-profiles,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceRestapiPoliciesXml struct { + ApplicationOverrideRules *string `xml:"application-override-rules,omitempty"` + AuthenticationRules *string `xml:"authentication-rules,omitempty"` + DecryptionRules *string `xml:"decryption-rules,omitempty"` + DosRules *string `xml:"dos-rules,omitempty"` + NatRules *string `xml:"nat-rules,omitempty"` + NetworkPacketBrokerRules *string `xml:"network-packet-broker-rules,omitempty"` + PolicyBasedForwardingRules *string `xml:"policy-based-forwarding-rules,omitempty"` + QosRules *string `xml:"qos-rules,omitempty"` + SdwanRules *string `xml:"sdwan-rules,omitempty"` + SecurityRules *string `xml:"security-rules,omitempty"` + TunnelInspectionRules *string `xml:"tunnel-inspection-rules,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceRestapiSystemXml struct { + Configuration *string `xml:"configuration,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiXml struct { + Acc *string `xml:"acc,omitempty"` + Commit *RoleDeviceWebuiCommitXml `xml:"commit,omitempty"` + Dashboard *string `xml:"dashboard,omitempty"` + Device *RoleDeviceWebuiDeviceXml `xml:"device,omitempty"` + Global *RoleDeviceWebuiGlobalXml `xml:"global,omitempty"` + Monitor *RoleDeviceWebuiMonitorXml `xml:"monitor,omitempty"` + Network *RoleDeviceWebuiNetworkXml `xml:"network,omitempty"` + Objects *RoleDeviceWebuiObjectsXml `xml:"objects,omitempty"` + Operations *RoleDeviceWebuiOperationsXml `xml:"operations,omitempty"` + Policies *RoleDeviceWebuiPoliciesXml `xml:"policies,omitempty"` + Privacy *RoleDeviceWebuiPrivacyXml `xml:"privacy,omitempty"` + Save *RoleDeviceWebuiSaveXml `xml:"save,omitempty"` + Tasks *string `xml:"tasks,omitempty"` + Validate *string `xml:"validate,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiCommitXml struct { + CommitForOtherAdmins *string `xml:"commit-for-other-admins,omitempty"` + Device *string `xml:"device,omitempty"` + ObjectLevelChanges *string `xml:"object-level-changes,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiDeviceXml struct { + AccessDomain *string `xml:"access-domain,omitempty"` + AdminRoles *string `xml:"admin-roles,omitempty"` + Administrators *string `xml:"administrators,omitempty"` + AuthenticationProfile *string `xml:"authentication-profile,omitempty"` + AuthenticationSequence *string `xml:"authentication-sequence,omitempty"` + BlockPages *string `xml:"block-pages,omitempty"` + CertificateManagement *RoleDeviceWebuiDeviceCertificateManagementXml `xml:"certificate-management,omitempty"` + ConfigAudit *string `xml:"config-audit,omitempty"` + DataRedistribution *string `xml:"data-redistribution,omitempty"` + DeviceQuarantine *string `xml:"device-quarantine,omitempty"` + DhcpSyslogServer *string `xml:"dhcp-syslog-server,omitempty"` + DynamicUpdates *string `xml:"dynamic-updates,omitempty"` + GlobalProtectClient *string `xml:"global-protect-client,omitempty"` + HighAvailability *string `xml:"high-availability,omitempty"` + Licenses *string `xml:"licenses,omitempty"` + LocalUserDatabase *RoleDeviceWebuiDeviceLocalUserDatabaseXml `xml:"local-user-database,omitempty"` + LogFwdCard *string `xml:"log-fwd-card,omitempty"` + LogSettings *RoleDeviceWebuiDeviceLogSettingsXml `xml:"log-settings,omitempty"` + MasterKey *string `xml:"master-key,omitempty"` + Plugins *string `xml:"plugins,omitempty"` + PolicyRecommendations *RoleDeviceWebuiDevicePolicyRecommendationsXml `xml:"policy-recommendations,omitempty"` + ScheduledLogExport *string `xml:"scheduled-log-export,omitempty"` + ServerProfile *RoleDeviceWebuiDeviceServerProfileXml `xml:"server-profile,omitempty"` + Setup *RoleDeviceWebuiDeviceSetupXml `xml:"setup,omitempty"` + SharedGateways *string `xml:"shared-gateways,omitempty"` + Software *string `xml:"software,omitempty"` + Support *string `xml:"support,omitempty"` + Troubleshooting *string `xml:"troubleshooting,omitempty"` + UserIdentification *string `xml:"user-identification,omitempty"` + VirtualSystems *string `xml:"virtual-systems,omitempty"` + VmInfoSource *string `xml:"vm-info-source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiDeviceCertificateManagementXml struct { + CertificateProfile *string `xml:"certificate-profile,omitempty"` + Certificates *string `xml:"certificates,omitempty"` + OcspResponder *string `xml:"ocsp-responder,omitempty"` + Scep *string `xml:"scep,omitempty"` + SshServiceProfile *string `xml:"ssh-service-profile,omitempty"` + SslDecryptionExclusion *string `xml:"ssl-decryption-exclusion,omitempty"` + SslTlsServiceProfile *string `xml:"ssl-tls-service-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiDeviceLocalUserDatabaseXml struct { + UserGroups *string `xml:"user-groups,omitempty"` + Users *string `xml:"users,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiDeviceLogSettingsXml struct { + CcAlarm *string `xml:"cc-alarm,omitempty"` + Config *string `xml:"config,omitempty"` + Correlation *string `xml:"correlation,omitempty"` + Globalprotect *string `xml:"globalprotect,omitempty"` + Hipmatch *string `xml:"hipmatch,omitempty"` + Iptag *string `xml:"iptag,omitempty"` + ManageLog *string `xml:"manage-log,omitempty"` + System *string `xml:"system,omitempty"` + UserId *string `xml:"user-id,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiDevicePolicyRecommendationsXml struct { + Iot *string `xml:"iot,omitempty"` + Saas *string `xml:"saas,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiDeviceServerProfileXml struct { + Dns *string `xml:"dns,omitempty"` + Email *string `xml:"email,omitempty"` + Http *string `xml:"http,omitempty"` + Kerberos *string `xml:"kerberos,omitempty"` + Ldap *string `xml:"ldap,omitempty"` + Mfa *string `xml:"mfa,omitempty"` + Netflow *string `xml:"netflow,omitempty"` + Radius *string `xml:"radius,omitempty"` + SamlIdp *string `xml:"saml_idp,omitempty"` + Scp *string `xml:"scp,omitempty"` + SnmpTrap *string `xml:"snmp-trap,omitempty"` + Syslog *string `xml:"syslog,omitempty"` + Tacplus *string `xml:"tacplus,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiDeviceSetupXml struct { + ContentId *string `xml:"content-id,omitempty"` + Hsm *string `xml:"hsm,omitempty"` + Interfaces *string `xml:"interfaces,omitempty"` + Management *string `xml:"management,omitempty"` + Operations *string `xml:"operations,omitempty"` + Services *string `xml:"services,omitempty"` + Session *string `xml:"session,omitempty"` + Telemetry *string `xml:"telemetry,omitempty"` + Wildfire *string `xml:"wildfire,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiGlobalXml struct { + SystemAlarms *string `xml:"system-alarms,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiMonitorXml struct { + AppScope *string `xml:"app-scope,omitempty"` + ApplicationReports *string `xml:"application-reports,omitempty"` + AutomatedCorrelationEngine *RoleDeviceWebuiMonitorAutomatedCorrelationEngineXml `xml:"automated-correlation-engine,omitempty"` + BlockIpList *string `xml:"block-ip-list,omitempty"` + Botnet *string `xml:"botnet,omitempty"` + CustomReports *RoleDeviceWebuiMonitorCustomReportsXml `xml:"custom-reports,omitempty"` + ExternalLogs *string `xml:"external-logs,omitempty"` + GtpReports *string `xml:"gtp-reports,omitempty"` + Logs *RoleDeviceWebuiMonitorLogsXml `xml:"logs,omitempty"` + PacketCapture *string `xml:"packet-capture,omitempty"` + PdfReports *RoleDeviceWebuiMonitorPdfReportsXml `xml:"pdf-reports,omitempty"` + SctpReports *string `xml:"sctp-reports,omitempty"` + SessionBrowser *string `xml:"session-browser,omitempty"` + ThreatReports *string `xml:"threat-reports,omitempty"` + TrafficReports *string `xml:"traffic-reports,omitempty"` + UrlFilteringReports *string `xml:"url-filtering-reports,omitempty"` + ViewCustomReports *string `xml:"view-custom-reports,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiMonitorAutomatedCorrelationEngineXml struct { + CorrelatedEvents *string `xml:"correlated-events,omitempty"` + CorrelationObjects *string `xml:"correlation-objects,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiMonitorCustomReportsXml struct { + ApplicationStatistics *string `xml:"application-statistics,omitempty"` + Auth *string `xml:"auth,omitempty"` + DataFilteringLog *string `xml:"data-filtering-log,omitempty"` + DecryptionLog *string `xml:"decryption-log,omitempty"` + DecryptionSummary *string `xml:"decryption-summary,omitempty"` + Globalprotect *string `xml:"globalprotect,omitempty"` + GtpLog *string `xml:"gtp-log,omitempty"` + GtpSummary *string `xml:"gtp-summary,omitempty"` + Hipmatch *string `xml:"hipmatch,omitempty"` + Iptag *string `xml:"iptag,omitempty"` + SctpLog *string `xml:"sctp-log,omitempty"` + SctpSummary *string `xml:"sctp-summary,omitempty"` + ThreatLog *string `xml:"threat-log,omitempty"` + ThreatSummary *string `xml:"threat-summary,omitempty"` + TrafficLog *string `xml:"traffic-log,omitempty"` + TrafficSummary *string `xml:"traffic-summary,omitempty"` + TunnelLog *string `xml:"tunnel-log,omitempty"` + TunnelSummary *string `xml:"tunnel-summary,omitempty"` + UrlLog *string `xml:"url-log,omitempty"` + UrlSummary *string `xml:"url-summary,omitempty"` + Userid *string `xml:"userid,omitempty"` + WildfireLog *string `xml:"wildfire-log,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiMonitorLogsXml struct { + Alarm *string `xml:"alarm,omitempty"` + Authentication *string `xml:"authentication,omitempty"` + Configuration *string `xml:"configuration,omitempty"` + DataFiltering *string `xml:"data-filtering,omitempty"` + Decryption *string `xml:"decryption,omitempty"` + Globalprotect *string `xml:"globalprotect,omitempty"` + Gtp *string `xml:"gtp,omitempty"` + Hipmatch *string `xml:"hipmatch,omitempty"` + Iptag *string `xml:"iptag,omitempty"` + Sctp *string `xml:"sctp,omitempty"` + System *string `xml:"system,omitempty"` + Threat *string `xml:"threat,omitempty"` + Traffic *string `xml:"traffic,omitempty"` + Tunnel *string `xml:"tunnel,omitempty"` + Url *string `xml:"url,omitempty"` + Userid *string `xml:"userid,omitempty"` + Wildfire *string `xml:"wildfire,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiMonitorPdfReportsXml struct { + EmailScheduler *string `xml:"email-scheduler,omitempty"` + ManagePdfSummary *string `xml:"manage-pdf-summary,omitempty"` + PdfSummaryReports *string `xml:"pdf-summary-reports,omitempty"` + ReportGroups *string `xml:"report-groups,omitempty"` + SaasApplicationUsageReport *string `xml:"saas-application-usage-report,omitempty"` + UserActivityReport *string `xml:"user-activity-report,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiNetworkXml struct { + Dhcp *string `xml:"dhcp,omitempty"` + DnsProxy *string `xml:"dns-proxy,omitempty"` + GlobalProtect *RoleDeviceWebuiNetworkGlobalProtectXml `xml:"global-protect,omitempty"` + GreTunnels *string `xml:"gre-tunnels,omitempty"` + Interfaces *string `xml:"interfaces,omitempty"` + IpsecTunnels *string `xml:"ipsec-tunnels,omitempty"` + Lldp *string `xml:"lldp,omitempty"` + NetworkProfiles *RoleDeviceWebuiNetworkNetworkProfilesXml `xml:"network-profiles,omitempty"` + Qos *string `xml:"qos,omitempty"` + Routing *RoleDeviceWebuiNetworkRoutingXml `xml:"routing,omitempty"` + SdwanInterfaceProfile *string `xml:"sdwan-interface-profile,omitempty"` + SecureWebGateway *string `xml:"secure-web-gateway,omitempty"` + VirtualRouters *string `xml:"virtual-routers,omitempty"` + VirtualWires *string `xml:"virtual-wires,omitempty"` + Vlans *string `xml:"vlans,omitempty"` + Zones *string `xml:"zones,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiNetworkGlobalProtectXml struct { + ClientlessAppGroups *string `xml:"clientless-app-groups,omitempty"` + ClientlessApps *string `xml:"clientless-apps,omitempty"` + Gateways *string `xml:"gateways,omitempty"` + Mdm *string `xml:"mdm,omitempty"` + Portals *string `xml:"portals,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiNetworkNetworkProfilesXml struct { + BfdProfile *string `xml:"bfd-profile,omitempty"` + GpAppIpsecCrypto *string `xml:"gp-app-ipsec-crypto,omitempty"` + IkeCrypto *string `xml:"ike-crypto,omitempty"` + IkeGateways *string `xml:"ike-gateways,omitempty"` + InterfaceMgmt *string `xml:"interface-mgmt,omitempty"` + IpsecCrypto *string `xml:"ipsec-crypto,omitempty"` + LldpProfile *string `xml:"lldp-profile,omitempty"` + QosProfile *string `xml:"qos-profile,omitempty"` + TunnelMonitor *string `xml:"tunnel-monitor,omitempty"` + ZoneProtection *string `xml:"zone-protection,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiNetworkRoutingXml struct { + LogicalRouters *string `xml:"logical-routers,omitempty"` + RoutingProfiles *RoleDeviceWebuiNetworkRoutingRoutingProfilesXml `xml:"routing-profiles,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiNetworkRoutingRoutingProfilesXml struct { + Bfd *string `xml:"bfd,omitempty"` + Bgp *string `xml:"bgp,omitempty"` + Filters *string `xml:"filters,omitempty"` + Multicast *string `xml:"multicast,omitempty"` + Ospf *string `xml:"ospf,omitempty"` + Ospfv3 *string `xml:"ospfv3,omitempty"` + Ripv2 *string `xml:"ripv2,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiObjectsXml struct { + AddressGroups *string `xml:"address-groups,omitempty"` + Addresses *string `xml:"addresses,omitempty"` + ApplicationFilters *string `xml:"application-filters,omitempty"` + ApplicationGroups *string `xml:"application-groups,omitempty"` + Applications *string `xml:"applications,omitempty"` + Authentication *string `xml:"authentication,omitempty"` + CustomObjects *RoleDeviceWebuiObjectsCustomObjectsXml `xml:"custom-objects,omitempty"` + Decryption *RoleDeviceWebuiObjectsDecryptionXml `xml:"decryption,omitempty"` + Devices *string `xml:"devices,omitempty"` + DynamicBlockLists *string `xml:"dynamic-block-lists,omitempty"` + DynamicUserGroups *string `xml:"dynamic-user-groups,omitempty"` + GlobalProtect *RoleDeviceWebuiObjectsGlobalProtectXml `xml:"global-protect,omitempty"` + LogForwarding *string `xml:"log-forwarding,omitempty"` + PacketBrokerProfile *string `xml:"packet-broker-profile,omitempty"` + Regions *string `xml:"regions,omitempty"` + Schedules *string `xml:"schedules,omitempty"` + Sdwan *RoleDeviceWebuiObjectsSdwanXml `xml:"sdwan,omitempty"` + SecurityProfileGroups *string `xml:"security-profile-groups,omitempty"` + SecurityProfiles *RoleDeviceWebuiObjectsSecurityProfilesXml `xml:"security-profiles,omitempty"` + ServiceGroups *string `xml:"service-groups,omitempty"` + Services *string `xml:"services,omitempty"` + Tags *string `xml:"tags,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiObjectsCustomObjectsXml struct { + DataPatterns *string `xml:"data-patterns,omitempty"` + Spyware *string `xml:"spyware,omitempty"` + UrlCategory *string `xml:"url-category,omitempty"` + Vulnerability *string `xml:"vulnerability,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiObjectsDecryptionXml struct { + DecryptionProfile *string `xml:"decryption-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiObjectsGlobalProtectXml struct { + HipObjects *string `xml:"hip-objects,omitempty"` + HipProfiles *string `xml:"hip-profiles,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiObjectsSdwanXml struct { + SdwanDistProfile *string `xml:"sdwan-dist-profile,omitempty"` + SdwanErrorCorrectionProfile *string `xml:"sdwan-error-correction-profile,omitempty"` + SdwanProfile *string `xml:"sdwan-profile,omitempty"` + SdwanSaasQualityProfile *string `xml:"sdwan-saas-quality-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiObjectsSecurityProfilesXml struct { + AntiSpyware *string `xml:"anti-spyware,omitempty"` + Antivirus *string `xml:"antivirus,omitempty"` + DataFiltering *string `xml:"data-filtering,omitempty"` + DosProtection *string `xml:"dos-protection,omitempty"` + FileBlocking *string `xml:"file-blocking,omitempty"` + GtpProtection *string `xml:"gtp-protection,omitempty"` + SctpProtection *string `xml:"sctp-protection,omitempty"` + UrlFiltering *string `xml:"url-filtering,omitempty"` + VulnerabilityProtection *string `xml:"vulnerability-protection,omitempty"` + WildfireAnalysis *string `xml:"wildfire-analysis,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiOperationsXml struct { + DownloadCoreFiles *string `xml:"download-core-files,omitempty"` + DownloadPcapFiles *string `xml:"download-pcap-files,omitempty"` + GenerateStatsDumpFile *string `xml:"generate-stats-dump-file,omitempty"` + GenerateTechSupportFile *string `xml:"generate-tech-support-file,omitempty"` + Reboot *string `xml:"reboot,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiPoliciesXml struct { + ApplicationOverrideRulebase *string `xml:"application-override-rulebase,omitempty"` + AuthenticationRulebase *string `xml:"authentication-rulebase,omitempty"` + DosRulebase *string `xml:"dos-rulebase,omitempty"` + NatRulebase *string `xml:"nat-rulebase,omitempty"` + NetworkPacketBrokerRulebase *string `xml:"network-packet-broker-rulebase,omitempty"` + PbfRulebase *string `xml:"pbf-rulebase,omitempty"` + QosRulebase *string `xml:"qos-rulebase,omitempty"` + RuleHitCountReset *string `xml:"rule-hit-count-reset,omitempty"` + SdwanRulebase *string `xml:"sdwan-rulebase,omitempty"` + SecurityRulebase *string `xml:"security-rulebase,omitempty"` + SslDecryptionRulebase *string `xml:"ssl-decryption-rulebase,omitempty"` + TunnelInspectRulebase *string `xml:"tunnel-inspect-rulebase,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiPrivacyXml struct { + ShowFullIpAddresses *string `xml:"show-full-ip-addresses,omitempty"` + ShowUserNamesInLogsAndReports *string `xml:"show-user-names-in-logs-and-reports,omitempty"` + ViewPcapFiles *string `xml:"view-pcap-files,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceWebuiSaveXml struct { + ObjectLevelChanges *string `xml:"object-level-changes,omitempty"` + PartialSave *string `xml:"partial-save,omitempty"` + SaveForOtherAdmins *string `xml:"save-for-other-admins,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleDeviceXmlapiXml struct { + Commit *string `xml:"commit,omitempty"` + Config *string `xml:"config,omitempty"` + Export *string `xml:"export,omitempty"` + Import *string `xml:"import,omitempty"` + Iot *string `xml:"iot,omitempty"` + Log *string `xml:"log,omitempty"` + Op *string `xml:"op,omitempty"` + Report *string `xml:"report,omitempty"` + UserId *string `xml:"user-id,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysXml struct { + Cli *string `xml:"cli,omitempty"` + Restapi *RoleVsysRestapiXml `xml:"restapi,omitempty"` + Webui *RoleVsysWebuiXml `xml:"webui,omitempty"` + Xmlapi *RoleVsysXmlapiXml `xml:"xmlapi,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysRestapiXml struct { + Device *RoleVsysRestapiDeviceXml `xml:"device,omitempty"` + Network *RoleVsysRestapiNetworkXml `xml:"network,omitempty"` + Objects *RoleVsysRestapiObjectsXml `xml:"objects,omitempty"` + Policies *RoleVsysRestapiPoliciesXml `xml:"policies,omitempty"` + System *RoleVsysRestapiSystemXml `xml:"system,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysRestapiDeviceXml struct { + EmailServerProfiles *string `xml:"email-server-profiles,omitempty"` + HttpServerProfiles *string `xml:"http-server-profiles,omitempty"` + LdapServerProfiles *string `xml:"ldap-server-profiles,omitempty"` + LogInterfaceSetting *string `xml:"log-interface-setting,omitempty"` + SnmpTrapServerProfiles *string `xml:"snmp-trap-server-profiles,omitempty"` + SyslogServerProfiles *string `xml:"syslog-server-profiles,omitempty"` + VirtualSystems *string `xml:"virtual-systems,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysRestapiNetworkXml struct { + GlobalprotectClientlessAppGroups *string `xml:"globalprotect-clientless-app-groups,omitempty"` + GlobalprotectClientlessApps *string `xml:"globalprotect-clientless-apps,omitempty"` + GlobalprotectGateways *string `xml:"globalprotect-gateways,omitempty"` + GlobalprotectMdmServers *string `xml:"globalprotect-mdm-servers,omitempty"` + GlobalprotectPortals *string `xml:"globalprotect-portals,omitempty"` + SdwanInterfaceProfiles *string `xml:"sdwan-interface-profiles,omitempty"` + Zones *string `xml:"zones,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysRestapiObjectsXml struct { + AddressGroups *string `xml:"address-groups,omitempty"` + Addresses *string `xml:"addresses,omitempty"` + AntiSpywareSecurityProfiles *string `xml:"anti-spyware-security-profiles,omitempty"` + AntivirusSecurityProfiles *string `xml:"antivirus-security-profiles,omitempty"` + ApplicationFilters *string `xml:"application-filters,omitempty"` + ApplicationGroups *string `xml:"application-groups,omitempty"` + Applications *string `xml:"applications,omitempty"` + AuthenticationEnforcements *string `xml:"authentication-enforcements,omitempty"` + CustomDataPatterns *string `xml:"custom-data-patterns,omitempty"` + CustomSpywareSignatures *string `xml:"custom-spyware-signatures,omitempty"` + CustomUrlCategories *string `xml:"custom-url-categories,omitempty"` + CustomVulnerabilitySignatures *string `xml:"custom-vulnerability-signatures,omitempty"` + DataFilteringSecurityProfiles *string `xml:"data-filtering-security-profiles,omitempty"` + DecryptionProfiles *string `xml:"decryption-profiles,omitempty"` + Devices *string `xml:"devices,omitempty"` + DosProtectionSecurityProfiles *string `xml:"dos-protection-security-profiles,omitempty"` + DynamicUserGroups *string `xml:"dynamic-user-groups,omitempty"` + ExternalDynamicLists *string `xml:"external-dynamic-lists,omitempty"` + FileBlockingSecurityProfiles *string `xml:"file-blocking-security-profiles,omitempty"` + GlobalprotectHipObjects *string `xml:"globalprotect-hip-objects,omitempty"` + GlobalprotectHipProfiles *string `xml:"globalprotect-hip-profiles,omitempty"` + GtpProtectionSecurityProfiles *string `xml:"gtp-protection-security-profiles,omitempty"` + LogForwardingProfiles *string `xml:"log-forwarding-profiles,omitempty"` + PacketBrokerProfiles *string `xml:"packet-broker-profiles,omitempty"` + Regions *string `xml:"regions,omitempty"` + Schedules *string `xml:"schedules,omitempty"` + SctpProtectionSecurityProfiles *string `xml:"sctp-protection-security-profiles,omitempty"` + SdwanErrorCorrectionProfiles *string `xml:"sdwan-error-correction-profiles,omitempty"` + SdwanPathQualityProfiles *string `xml:"sdwan-path-quality-profiles,omitempty"` + SdwanSaasQualityProfiles *string `xml:"sdwan-saas-quality-profiles,omitempty"` + SdwanTrafficDistributionProfiles *string `xml:"sdwan-traffic-distribution-profiles,omitempty"` + SecurityProfileGroups *string `xml:"security-profile-groups,omitempty"` + ServiceGroups *string `xml:"service-groups,omitempty"` + Services *string `xml:"services,omitempty"` + Tags *string `xml:"tags,omitempty"` + UrlFilteringSecurityProfiles *string `xml:"url-filtering-security-profiles,omitempty"` + VulnerabilityProtectionSecurityProfiles *string `xml:"vulnerability-protection-security-profiles,omitempty"` + WildfireAnalysisSecurityProfiles *string `xml:"wildfire-analysis-security-profiles,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysRestapiPoliciesXml struct { + ApplicationOverrideRules *string `xml:"application-override-rules,omitempty"` + AuthenticationRules *string `xml:"authentication-rules,omitempty"` + DecryptionRules *string `xml:"decryption-rules,omitempty"` + DosRules *string `xml:"dos-rules,omitempty"` + NatRules *string `xml:"nat-rules,omitempty"` + NetworkPacketBrokerRules *string `xml:"network-packet-broker-rules,omitempty"` + PolicyBasedForwardingRules *string `xml:"policy-based-forwarding-rules,omitempty"` + QosRules *string `xml:"qos-rules,omitempty"` + SdwanRules *string `xml:"sdwan-rules,omitempty"` + SecurityRules *string `xml:"security-rules,omitempty"` + TunnelInspectionRules *string `xml:"tunnel-inspection-rules,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysRestapiSystemXml struct { + Configuration *string `xml:"configuration,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiXml struct { + Acc *string `xml:"acc,omitempty"` + Commit *RoleVsysWebuiCommitXml `xml:"commit,omitempty"` + Dashboard *string `xml:"dashboard,omitempty"` + Device *RoleVsysWebuiDeviceXml `xml:"device,omitempty"` + Monitor *RoleVsysWebuiMonitorXml `xml:"monitor,omitempty"` + Network *RoleVsysWebuiNetworkXml `xml:"network,omitempty"` + Objects *RoleVsysWebuiObjectsXml `xml:"objects,omitempty"` + Operations *RoleVsysWebuiOperationsXml `xml:"operations,omitempty"` + Policies *RoleVsysWebuiPoliciesXml `xml:"policies,omitempty"` + Privacy *RoleVsysWebuiPrivacyXml `xml:"privacy,omitempty"` + Save *RoleVsysWebuiSaveXml `xml:"save,omitempty"` + Tasks *string `xml:"tasks,omitempty"` + Validate *string `xml:"validate,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiCommitXml struct { + CommitForOtherAdmins *string `xml:"commit-for-other-admins,omitempty"` + VirtualSystems *string `xml:"virtual-systems,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiDeviceXml struct { + Administrators *string `xml:"administrators,omitempty"` + AuthenticationProfile *string `xml:"authentication-profile,omitempty"` + AuthenticationSequence *string `xml:"authentication-sequence,omitempty"` + BlockPages *string `xml:"block-pages,omitempty"` + CertificateManagement *RoleVsysWebuiDeviceCertificateManagementXml `xml:"certificate-management,omitempty"` + DataRedistribution *string `xml:"data-redistribution,omitempty"` + DeviceQuarantine *string `xml:"device-quarantine,omitempty"` + DhcpSyslogServer *string `xml:"dhcp-syslog-server,omitempty"` + LocalUserDatabase *RoleVsysWebuiDeviceLocalUserDatabaseXml `xml:"local-user-database,omitempty"` + LogSettings *RoleVsysWebuiDeviceLogSettingsXml `xml:"log-settings,omitempty"` + PolicyRecommendations *RoleVsysWebuiDevicePolicyRecommendationsXml `xml:"policy-recommendations,omitempty"` + ServerProfile *RoleVsysWebuiDeviceServerProfileXml `xml:"server-profile,omitempty"` + Setup *RoleVsysWebuiDeviceSetupXml `xml:"setup,omitempty"` + Troubleshooting *string `xml:"troubleshooting,omitempty"` + UserIdentification *string `xml:"user-identification,omitempty"` + VmInfoSource *string `xml:"vm-info-source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiDeviceCertificateManagementXml struct { + CertificateProfile *string `xml:"certificate-profile,omitempty"` + Certificates *string `xml:"certificates,omitempty"` + OcspResponder *string `xml:"ocsp-responder,omitempty"` + Scep *string `xml:"scep,omitempty"` + SshServiceProfile *string `xml:"ssh-service-profile,omitempty"` + SslDecryptionExclusion *string `xml:"ssl-decryption-exclusion,omitempty"` + SslTlsServiceProfile *string `xml:"ssl-tls-service-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiDeviceLocalUserDatabaseXml struct { + UserGroups *string `xml:"user-groups,omitempty"` + Users *string `xml:"users,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiDeviceLogSettingsXml struct { + Config *string `xml:"config,omitempty"` + Correlation *string `xml:"correlation,omitempty"` + Globalprotect *string `xml:"globalprotect,omitempty"` + Hipmatch *string `xml:"hipmatch,omitempty"` + Iptag *string `xml:"iptag,omitempty"` + System *string `xml:"system,omitempty"` + UserId *string `xml:"user-id,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiDevicePolicyRecommendationsXml struct { + Iot *string `xml:"iot,omitempty"` + Saas *string `xml:"saas,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiDeviceServerProfileXml struct { + Dns *string `xml:"dns,omitempty"` + Email *string `xml:"email,omitempty"` + Http *string `xml:"http,omitempty"` + Kerberos *string `xml:"kerberos,omitempty"` + Ldap *string `xml:"ldap,omitempty"` + Mfa *string `xml:"mfa,omitempty"` + Netflow *string `xml:"netflow,omitempty"` + Radius *string `xml:"radius,omitempty"` + SamlIdp *string `xml:"saml_idp,omitempty"` + Scp *string `xml:"scp,omitempty"` + SnmpTrap *string `xml:"snmp-trap,omitempty"` + Syslog *string `xml:"syslog,omitempty"` + Tacplus *string `xml:"tacplus,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiDeviceSetupXml struct { + ContentId *string `xml:"content-id,omitempty"` + Hsm *string `xml:"hsm,omitempty"` + Interfaces *string `xml:"interfaces,omitempty"` + Management *string `xml:"management,omitempty"` + Operations *string `xml:"operations,omitempty"` + Services *string `xml:"services,omitempty"` + Session *string `xml:"session,omitempty"` + Telemetry *string `xml:"telemetry,omitempty"` + Wildfire *string `xml:"wildfire,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiMonitorXml struct { + AppScope *string `xml:"app-scope,omitempty"` + AutomatedCorrelationEngine *RoleVsysWebuiMonitorAutomatedCorrelationEngineXml `xml:"automated-correlation-engine,omitempty"` + BlockIpList *string `xml:"block-ip-list,omitempty"` + CustomReports *RoleVsysWebuiMonitorCustomReportsXml `xml:"custom-reports,omitempty"` + ExternalLogs *string `xml:"external-logs,omitempty"` + Logs *RoleVsysWebuiMonitorLogsXml `xml:"logs,omitempty"` + PdfReports *RoleVsysWebuiMonitorPdfReportsXml `xml:"pdf-reports,omitempty"` + SessionBrowser *string `xml:"session-browser,omitempty"` + ViewCustomReports *string `xml:"view-custom-reports,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiMonitorAutomatedCorrelationEngineXml struct { + CorrelatedEvents *string `xml:"correlated-events,omitempty"` + CorrelationObjects *string `xml:"correlation-objects,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiMonitorCustomReportsXml struct { + ApplicationStatistics *string `xml:"application-statistics,omitempty"` + Auth *string `xml:"auth,omitempty"` + DataFilteringLog *string `xml:"data-filtering-log,omitempty"` + DecryptionLog *string `xml:"decryption-log,omitempty"` + DecryptionSummary *string `xml:"decryption-summary,omitempty"` + Globalprotect *string `xml:"globalprotect,omitempty"` + GtpLog *string `xml:"gtp-log,omitempty"` + GtpSummary *string `xml:"gtp-summary,omitempty"` + Hipmatch *string `xml:"hipmatch,omitempty"` + Iptag *string `xml:"iptag,omitempty"` + SctpLog *string `xml:"sctp-log,omitempty"` + SctpSummary *string `xml:"sctp-summary,omitempty"` + ThreatLog *string `xml:"threat-log,omitempty"` + ThreatSummary *string `xml:"threat-summary,omitempty"` + TrafficLog *string `xml:"traffic-log,omitempty"` + TrafficSummary *string `xml:"traffic-summary,omitempty"` + TunnelLog *string `xml:"tunnel-log,omitempty"` + TunnelSummary *string `xml:"tunnel-summary,omitempty"` + UrlLog *string `xml:"url-log,omitempty"` + UrlSummary *string `xml:"url-summary,omitempty"` + Userid *string `xml:"userid,omitempty"` + WildfireLog *string `xml:"wildfire-log,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiMonitorLogsXml struct { + Authentication *string `xml:"authentication,omitempty"` + DataFiltering *string `xml:"data-filtering,omitempty"` + Decryption *string `xml:"decryption,omitempty"` + Globalprotect *string `xml:"globalprotect,omitempty"` + Gtp *string `xml:"gtp,omitempty"` + Hipmatch *string `xml:"hipmatch,omitempty"` + Iptag *string `xml:"iptag,omitempty"` + Sctp *string `xml:"sctp,omitempty"` + Threat *string `xml:"threat,omitempty"` + Traffic *string `xml:"traffic,omitempty"` + Tunnel *string `xml:"tunnel,omitempty"` + Url *string `xml:"url,omitempty"` + Userid *string `xml:"userid,omitempty"` + Wildfire *string `xml:"wildfire,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiMonitorPdfReportsXml struct { + EmailScheduler *string `xml:"email-scheduler,omitempty"` + ManagePdfSummary *string `xml:"manage-pdf-summary,omitempty"` + PdfSummaryReports *string `xml:"pdf-summary-reports,omitempty"` + ReportGroups *string `xml:"report-groups,omitempty"` + SaasApplicationUsageReport *string `xml:"saas-application-usage-report,omitempty"` + UserActivityReport *string `xml:"user-activity-report,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiNetworkXml struct { + GlobalProtect *RoleVsysWebuiNetworkGlobalProtectXml `xml:"global-protect,omitempty"` + SdwanInterfaceProfile *string `xml:"sdwan-interface-profile,omitempty"` + Zones *string `xml:"zones,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiNetworkGlobalProtectXml struct { + ClientlessAppGroups *string `xml:"clientless-app-groups,omitempty"` + ClientlessApps *string `xml:"clientless-apps,omitempty"` + Gateways *string `xml:"gateways,omitempty"` + Mdm *string `xml:"mdm,omitempty"` + Portals *string `xml:"portals,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiObjectsXml struct { + AddressGroups *string `xml:"address-groups,omitempty"` + Addresses *string `xml:"addresses,omitempty"` + ApplicationFilters *string `xml:"application-filters,omitempty"` + ApplicationGroups *string `xml:"application-groups,omitempty"` + Applications *string `xml:"applications,omitempty"` + Authentication *string `xml:"authentication,omitempty"` + CustomObjects *RoleVsysWebuiObjectsCustomObjectsXml `xml:"custom-objects,omitempty"` + Decryption *RoleVsysWebuiObjectsDecryptionXml `xml:"decryption,omitempty"` + Devices *string `xml:"devices,omitempty"` + DynamicBlockLists *string `xml:"dynamic-block-lists,omitempty"` + DynamicUserGroups *string `xml:"dynamic-user-groups,omitempty"` + GlobalProtect *RoleVsysWebuiObjectsGlobalProtectXml `xml:"global-protect,omitempty"` + LogForwarding *string `xml:"log-forwarding,omitempty"` + PacketBrokerProfile *string `xml:"packet-broker-profile,omitempty"` + Regions *string `xml:"regions,omitempty"` + Schedules *string `xml:"schedules,omitempty"` + Sdwan *RoleVsysWebuiObjectsSdwanXml `xml:"sdwan,omitempty"` + SecurityProfileGroups *string `xml:"security-profile-groups,omitempty"` + SecurityProfiles *RoleVsysWebuiObjectsSecurityProfilesXml `xml:"security-profiles,omitempty"` + ServiceGroups *string `xml:"service-groups,omitempty"` + Services *string `xml:"services,omitempty"` + Tags *string `xml:"tags,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiObjectsCustomObjectsXml struct { + DataPatterns *string `xml:"data-patterns,omitempty"` + Spyware *string `xml:"spyware,omitempty"` + UrlCategory *string `xml:"url-category,omitempty"` + Vulnerability *string `xml:"vulnerability,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiObjectsDecryptionXml struct { + DecryptionProfile *string `xml:"decryption-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiObjectsGlobalProtectXml struct { + HipObjects *string `xml:"hip-objects,omitempty"` + HipProfiles *string `xml:"hip-profiles,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiObjectsSdwanXml struct { + SdwanDistProfile *string `xml:"sdwan-dist-profile,omitempty"` + SdwanErrorCorrectionProfile *string `xml:"sdwan-error-correction-profile,omitempty"` + SdwanProfile *string `xml:"sdwan-profile,omitempty"` + SdwanSaasQualityProfile *string `xml:"sdwan-saas-quality-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiObjectsSecurityProfilesXml struct { + AntiSpyware *string `xml:"anti-spyware,omitempty"` + Antivirus *string `xml:"antivirus,omitempty"` + DataFiltering *string `xml:"data-filtering,omitempty"` + DosProtection *string `xml:"dos-protection,omitempty"` + FileBlocking *string `xml:"file-blocking,omitempty"` + GtpProtection *string `xml:"gtp-protection,omitempty"` + SctpProtection *string `xml:"sctp-protection,omitempty"` + UrlFiltering *string `xml:"url-filtering,omitempty"` + VulnerabilityProtection *string `xml:"vulnerability-protection,omitempty"` + WildfireAnalysis *string `xml:"wildfire-analysis,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiOperationsXml struct { + DownloadCoreFiles *string `xml:"download-core-files,omitempty"` + DownloadPcapFiles *string `xml:"download-pcap-files,omitempty"` + GenerateStatsDumpFile *string `xml:"generate-stats-dump-file,omitempty"` + GenerateTechSupportFile *string `xml:"generate-tech-support-file,omitempty"` + Reboot *string `xml:"reboot,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiPoliciesXml struct { + ApplicationOverrideRulebase *string `xml:"application-override-rulebase,omitempty"` + AuthenticationRulebase *string `xml:"authentication-rulebase,omitempty"` + DosRulebase *string `xml:"dos-rulebase,omitempty"` + NatRulebase *string `xml:"nat-rulebase,omitempty"` + NetworkPacketBrokerRulebase *string `xml:"network-packet-broker-rulebase,omitempty"` + PbfRulebase *string `xml:"pbf-rulebase,omitempty"` + QosRulebase *string `xml:"qos-rulebase,omitempty"` + RuleHitCountReset *string `xml:"rule-hit-count-reset,omitempty"` + SdwanRulebase *string `xml:"sdwan-rulebase,omitempty"` + SecurityRulebase *string `xml:"security-rulebase,omitempty"` + SslDecryptionRulebase *string `xml:"ssl-decryption-rulebase,omitempty"` + TunnelInspectRulebase *string `xml:"tunnel-inspect-rulebase,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiPrivacyXml struct { + ShowFullIpAddresses *string `xml:"show-full-ip-addresses,omitempty"` + ShowUserNamesInLogsAndReports *string `xml:"show-user-names-in-logs-and-reports,omitempty"` + ViewPcapFiles *string `xml:"view-pcap-files,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysWebuiSaveXml struct { + ObjectLevelChanges *string `xml:"object-level-changes,omitempty"` + PartialSave *string `xml:"partial-save,omitempty"` + SaveForOtherAdmins *string `xml:"save-for-other-admins,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoleVsysXmlapiXml struct { + Commit *string `xml:"commit,omitempty"` + Config *string `xml:"config,omitempty"` + Export *string `xml:"export,omitempty"` + Import *string `xml:"import,omitempty"` + Iot *string `xml:"iot,omitempty"` + Log *string `xml:"log,omitempty"` + Op *string `xml:"op,omitempty"` + Report *string `xml:"report,omitempty"` + UserId *string `xml:"user-id,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "description" || v == "Description" { + return e.Description, nil + } + if v == "role" || v == "Role" { + return e.Role, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.Description = o.Description + var nestedRole *RoleXml + if o.Role != nil { + nestedRole = &RoleXml{} + if _, ok := o.Misc["Role"]; ok { + nestedRole.Misc = o.Misc["Role"] + } + if o.Role.Device != nil { + nestedRole.Device = &RoleDeviceXml{} + if _, ok := o.Misc["RoleDevice"]; ok { + nestedRole.Device.Misc = o.Misc["RoleDevice"] + } + if o.Role.Device.Cli != nil { + nestedRole.Device.Cli = o.Role.Device.Cli + } + if o.Role.Device.Restapi != nil { + nestedRole.Device.Restapi = &RoleDeviceRestapiXml{} + if _, ok := o.Misc["RoleDeviceRestapi"]; ok { + nestedRole.Device.Restapi.Misc = o.Misc["RoleDeviceRestapi"] + } + if o.Role.Device.Restapi.Network != nil { + nestedRole.Device.Restapi.Network = &RoleDeviceRestapiNetworkXml{} + if _, ok := o.Misc["RoleDeviceRestapiNetwork"]; ok { + nestedRole.Device.Restapi.Network.Misc = o.Misc["RoleDeviceRestapiNetwork"] + } + if o.Role.Device.Restapi.Network.DhcpRelays != nil { + nestedRole.Device.Restapi.Network.DhcpRelays = o.Role.Device.Restapi.Network.DhcpRelays + } + if o.Role.Device.Restapi.Network.GlobalprotectMdmServers != nil { + nestedRole.Device.Restapi.Network.GlobalprotectMdmServers = o.Role.Device.Restapi.Network.GlobalprotectMdmServers + } + if o.Role.Device.Restapi.Network.InterfaceManagementNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.InterfaceManagementNetworkProfiles = o.Role.Device.Restapi.Network.InterfaceManagementNetworkProfiles + } + if o.Role.Device.Restapi.Network.QosNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.QosNetworkProfiles = o.Role.Device.Restapi.Network.QosNetworkProfiles + } + if o.Role.Device.Restapi.Network.GlobalprotectClientlessAppGroups != nil { + nestedRole.Device.Restapi.Network.GlobalprotectClientlessAppGroups = o.Role.Device.Restapi.Network.GlobalprotectClientlessAppGroups + } + if o.Role.Device.Restapi.Network.TunnelInterfaces != nil { + nestedRole.Device.Restapi.Network.TunnelInterfaces = o.Role.Device.Restapi.Network.TunnelInterfaces + } + if o.Role.Device.Restapi.Network.VirtualWires != nil { + nestedRole.Device.Restapi.Network.VirtualWires = o.Role.Device.Restapi.Network.VirtualWires + } + if o.Role.Device.Restapi.Network.BgpRoutingProfiles != nil { + nestedRole.Device.Restapi.Network.BgpRoutingProfiles = o.Role.Device.Restapi.Network.BgpRoutingProfiles + } + if o.Role.Device.Restapi.Network.GlobalprotectClientlessApps != nil { + nestedRole.Device.Restapi.Network.GlobalprotectClientlessApps = o.Role.Device.Restapi.Network.GlobalprotectClientlessApps + } + if o.Role.Device.Restapi.Network.GreTunnels != nil { + nestedRole.Device.Restapi.Network.GreTunnels = o.Role.Device.Restapi.Network.GreTunnels + } + if o.Role.Device.Restapi.Network.IkeCryptoNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.IkeCryptoNetworkProfiles = o.Role.Device.Restapi.Network.IkeCryptoNetworkProfiles + } + if o.Role.Device.Restapi.Network.LogicalRouters != nil { + nestedRole.Device.Restapi.Network.LogicalRouters = o.Role.Device.Restapi.Network.LogicalRouters + } + if o.Role.Device.Restapi.Network.LoopbackInterfaces != nil { + nestedRole.Device.Restapi.Network.LoopbackInterfaces = o.Role.Device.Restapi.Network.LoopbackInterfaces + } + if o.Role.Device.Restapi.Network.SdwanInterfaceProfiles != nil { + nestedRole.Device.Restapi.Network.SdwanInterfaceProfiles = o.Role.Device.Restapi.Network.SdwanInterfaceProfiles + } + if o.Role.Device.Restapi.Network.AggregateEthernetInterfaces != nil { + nestedRole.Device.Restapi.Network.AggregateEthernetInterfaces = o.Role.Device.Restapi.Network.AggregateEthernetInterfaces + } + if o.Role.Device.Restapi.Network.GlobalprotectPortals != nil { + nestedRole.Device.Restapi.Network.GlobalprotectPortals = o.Role.Device.Restapi.Network.GlobalprotectPortals + } + if o.Role.Device.Restapi.Network.TunnelMonitorNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.TunnelMonitorNetworkProfiles = o.Role.Device.Restapi.Network.TunnelMonitorNetworkProfiles + } + if o.Role.Device.Restapi.Network.BfdNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.BfdNetworkProfiles = o.Role.Device.Restapi.Network.BfdNetworkProfiles + } + if o.Role.Device.Restapi.Network.EthernetInterfaces != nil { + nestedRole.Device.Restapi.Network.EthernetInterfaces = o.Role.Device.Restapi.Network.EthernetInterfaces + } + if o.Role.Device.Restapi.Network.DhcpServers != nil { + nestedRole.Device.Restapi.Network.DhcpServers = o.Role.Device.Restapi.Network.DhcpServers + } + if o.Role.Device.Restapi.Network.LldpNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.LldpNetworkProfiles = o.Role.Device.Restapi.Network.LldpNetworkProfiles + } + if o.Role.Device.Restapi.Network.ZoneProtectionNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.ZoneProtectionNetworkProfiles = o.Role.Device.Restapi.Network.ZoneProtectionNetworkProfiles + } + if o.Role.Device.Restapi.Network.Zones != nil { + nestedRole.Device.Restapi.Network.Zones = o.Role.Device.Restapi.Network.Zones + } + if o.Role.Device.Restapi.Network.GlobalprotectIpsecCryptoNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.GlobalprotectIpsecCryptoNetworkProfiles = o.Role.Device.Restapi.Network.GlobalprotectIpsecCryptoNetworkProfiles + } + if o.Role.Device.Restapi.Network.IpsecTunnels != nil { + nestedRole.Device.Restapi.Network.IpsecTunnels = o.Role.Device.Restapi.Network.IpsecTunnels + } + if o.Role.Device.Restapi.Network.QosInterfaces != nil { + nestedRole.Device.Restapi.Network.QosInterfaces = o.Role.Device.Restapi.Network.QosInterfaces + } + if o.Role.Device.Restapi.Network.SdwanInterfaces != nil { + nestedRole.Device.Restapi.Network.SdwanInterfaces = o.Role.Device.Restapi.Network.SdwanInterfaces + } + if o.Role.Device.Restapi.Network.VirtualRouters != nil { + nestedRole.Device.Restapi.Network.VirtualRouters = o.Role.Device.Restapi.Network.VirtualRouters + } + if o.Role.Device.Restapi.Network.VlanInterfaces != nil { + nestedRole.Device.Restapi.Network.VlanInterfaces = o.Role.Device.Restapi.Network.VlanInterfaces + } + if o.Role.Device.Restapi.Network.Vlans != nil { + nestedRole.Device.Restapi.Network.Vlans = o.Role.Device.Restapi.Network.Vlans + } + if o.Role.Device.Restapi.Network.DnsProxies != nil { + nestedRole.Device.Restapi.Network.DnsProxies = o.Role.Device.Restapi.Network.DnsProxies + } + if o.Role.Device.Restapi.Network.GlobalprotectGateways != nil { + nestedRole.Device.Restapi.Network.GlobalprotectGateways = o.Role.Device.Restapi.Network.GlobalprotectGateways + } + if o.Role.Device.Restapi.Network.IkeGatewayNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.IkeGatewayNetworkProfiles = o.Role.Device.Restapi.Network.IkeGatewayNetworkProfiles + } + if o.Role.Device.Restapi.Network.IpsecCryptoNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.IpsecCryptoNetworkProfiles = o.Role.Device.Restapi.Network.IpsecCryptoNetworkProfiles + } + if o.Role.Device.Restapi.Network.Lldp != nil { + nestedRole.Device.Restapi.Network.Lldp = o.Role.Device.Restapi.Network.Lldp + } + } + if o.Role.Device.Restapi.Objects != nil { + nestedRole.Device.Restapi.Objects = &RoleDeviceRestapiObjectsXml{} + if _, ok := o.Misc["RoleDeviceRestapiObjects"]; ok { + nestedRole.Device.Restapi.Objects.Misc = o.Misc["RoleDeviceRestapiObjects"] + } + if o.Role.Device.Restapi.Objects.Regions != nil { + nestedRole.Device.Restapi.Objects.Regions = o.Role.Device.Restapi.Objects.Regions + } + if o.Role.Device.Restapi.Objects.Services != nil { + nestedRole.Device.Restapi.Objects.Services = o.Role.Device.Restapi.Objects.Services + } + if o.Role.Device.Restapi.Objects.GlobalprotectHipObjects != nil { + nestedRole.Device.Restapi.Objects.GlobalprotectHipObjects = o.Role.Device.Restapi.Objects.GlobalprotectHipObjects + } + if o.Role.Device.Restapi.Objects.PacketBrokerProfiles != nil { + nestedRole.Device.Restapi.Objects.PacketBrokerProfiles = o.Role.Device.Restapi.Objects.PacketBrokerProfiles + } + if o.Role.Device.Restapi.Objects.AntivirusSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.AntivirusSecurityProfiles = o.Role.Device.Restapi.Objects.AntivirusSecurityProfiles + } + if o.Role.Device.Restapi.Objects.CustomSpywareSignatures != nil { + nestedRole.Device.Restapi.Objects.CustomSpywareSignatures = o.Role.Device.Restapi.Objects.CustomSpywareSignatures + } + if o.Role.Device.Restapi.Objects.DecryptionProfiles != nil { + nestedRole.Device.Restapi.Objects.DecryptionProfiles = o.Role.Device.Restapi.Objects.DecryptionProfiles + } + if o.Role.Device.Restapi.Objects.Devices != nil { + nestedRole.Device.Restapi.Objects.Devices = o.Role.Device.Restapi.Objects.Devices + } + if o.Role.Device.Restapi.Objects.ExternalDynamicLists != nil { + nestedRole.Device.Restapi.Objects.ExternalDynamicLists = o.Role.Device.Restapi.Objects.ExternalDynamicLists + } + if o.Role.Device.Restapi.Objects.ServiceGroups != nil { + nestedRole.Device.Restapi.Objects.ServiceGroups = o.Role.Device.Restapi.Objects.ServiceGroups + } + if o.Role.Device.Restapi.Objects.Addresses != nil { + nestedRole.Device.Restapi.Objects.Addresses = o.Role.Device.Restapi.Objects.Addresses + } + if o.Role.Device.Restapi.Objects.AntiSpywareSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.AntiSpywareSecurityProfiles = o.Role.Device.Restapi.Objects.AntiSpywareSecurityProfiles + } + if o.Role.Device.Restapi.Objects.Tags != nil { + nestedRole.Device.Restapi.Objects.Tags = o.Role.Device.Restapi.Objects.Tags + } + if o.Role.Device.Restapi.Objects.DynamicUserGroups != nil { + nestedRole.Device.Restapi.Objects.DynamicUserGroups = o.Role.Device.Restapi.Objects.DynamicUserGroups + } + if o.Role.Device.Restapi.Objects.SdwanPathQualityProfiles != nil { + nestedRole.Device.Restapi.Objects.SdwanPathQualityProfiles = o.Role.Device.Restapi.Objects.SdwanPathQualityProfiles + } + if o.Role.Device.Restapi.Objects.SdwanTrafficDistributionProfiles != nil { + nestedRole.Device.Restapi.Objects.SdwanTrafficDistributionProfiles = o.Role.Device.Restapi.Objects.SdwanTrafficDistributionProfiles + } + if o.Role.Device.Restapi.Objects.ApplicationFilters != nil { + nestedRole.Device.Restapi.Objects.ApplicationFilters = o.Role.Device.Restapi.Objects.ApplicationFilters + } + if o.Role.Device.Restapi.Objects.CustomUrlCategories != nil { + nestedRole.Device.Restapi.Objects.CustomUrlCategories = o.Role.Device.Restapi.Objects.CustomUrlCategories + } + if o.Role.Device.Restapi.Objects.DosProtectionSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.DosProtectionSecurityProfiles = o.Role.Device.Restapi.Objects.DosProtectionSecurityProfiles + } + if o.Role.Device.Restapi.Objects.SdwanErrorCorrectionProfiles != nil { + nestedRole.Device.Restapi.Objects.SdwanErrorCorrectionProfiles = o.Role.Device.Restapi.Objects.SdwanErrorCorrectionProfiles + } + if o.Role.Device.Restapi.Objects.VulnerabilityProtectionSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.VulnerabilityProtectionSecurityProfiles = o.Role.Device.Restapi.Objects.VulnerabilityProtectionSecurityProfiles + } + if o.Role.Device.Restapi.Objects.AddressGroups != nil { + nestedRole.Device.Restapi.Objects.AddressGroups = o.Role.Device.Restapi.Objects.AddressGroups + } + if o.Role.Device.Restapi.Objects.DataFilteringSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.DataFilteringSecurityProfiles = o.Role.Device.Restapi.Objects.DataFilteringSecurityProfiles + } + if o.Role.Device.Restapi.Objects.GlobalprotectHipProfiles != nil { + nestedRole.Device.Restapi.Objects.GlobalprotectHipProfiles = o.Role.Device.Restapi.Objects.GlobalprotectHipProfiles + } + if o.Role.Device.Restapi.Objects.LogForwardingProfiles != nil { + nestedRole.Device.Restapi.Objects.LogForwardingProfiles = o.Role.Device.Restapi.Objects.LogForwardingProfiles + } + if o.Role.Device.Restapi.Objects.SctpProtectionSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.SctpProtectionSecurityProfiles = o.Role.Device.Restapi.Objects.SctpProtectionSecurityProfiles + } + if o.Role.Device.Restapi.Objects.WildfireAnalysisSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.WildfireAnalysisSecurityProfiles = o.Role.Device.Restapi.Objects.WildfireAnalysisSecurityProfiles + } + if o.Role.Device.Restapi.Objects.ApplicationGroups != nil { + nestedRole.Device.Restapi.Objects.ApplicationGroups = o.Role.Device.Restapi.Objects.ApplicationGroups + } + if o.Role.Device.Restapi.Objects.FileBlockingSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.FileBlockingSecurityProfiles = o.Role.Device.Restapi.Objects.FileBlockingSecurityProfiles + } + if o.Role.Device.Restapi.Objects.CustomVulnerabilitySignatures != nil { + nestedRole.Device.Restapi.Objects.CustomVulnerabilitySignatures = o.Role.Device.Restapi.Objects.CustomVulnerabilitySignatures + } + if o.Role.Device.Restapi.Objects.GtpProtectionSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.GtpProtectionSecurityProfiles = o.Role.Device.Restapi.Objects.GtpProtectionSecurityProfiles + } + if o.Role.Device.Restapi.Objects.SdwanSaasQualityProfiles != nil { + nestedRole.Device.Restapi.Objects.SdwanSaasQualityProfiles = o.Role.Device.Restapi.Objects.SdwanSaasQualityProfiles + } + if o.Role.Device.Restapi.Objects.SecurityProfileGroups != nil { + nestedRole.Device.Restapi.Objects.SecurityProfileGroups = o.Role.Device.Restapi.Objects.SecurityProfileGroups + } + if o.Role.Device.Restapi.Objects.Applications != nil { + nestedRole.Device.Restapi.Objects.Applications = o.Role.Device.Restapi.Objects.Applications + } + if o.Role.Device.Restapi.Objects.CustomDataPatterns != nil { + nestedRole.Device.Restapi.Objects.CustomDataPatterns = o.Role.Device.Restapi.Objects.CustomDataPatterns + } + if o.Role.Device.Restapi.Objects.UrlFilteringSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.UrlFilteringSecurityProfiles = o.Role.Device.Restapi.Objects.UrlFilteringSecurityProfiles + } + if o.Role.Device.Restapi.Objects.AuthenticationEnforcements != nil { + nestedRole.Device.Restapi.Objects.AuthenticationEnforcements = o.Role.Device.Restapi.Objects.AuthenticationEnforcements + } + if o.Role.Device.Restapi.Objects.Schedules != nil { + nestedRole.Device.Restapi.Objects.Schedules = o.Role.Device.Restapi.Objects.Schedules + } + } + if o.Role.Device.Restapi.Policies != nil { + nestedRole.Device.Restapi.Policies = &RoleDeviceRestapiPoliciesXml{} + if _, ok := o.Misc["RoleDeviceRestapiPolicies"]; ok { + nestedRole.Device.Restapi.Policies.Misc = o.Misc["RoleDeviceRestapiPolicies"] + } + if o.Role.Device.Restapi.Policies.TunnelInspectionRules != nil { + nestedRole.Device.Restapi.Policies.TunnelInspectionRules = o.Role.Device.Restapi.Policies.TunnelInspectionRules + } + if o.Role.Device.Restapi.Policies.DecryptionRules != nil { + nestedRole.Device.Restapi.Policies.DecryptionRules = o.Role.Device.Restapi.Policies.DecryptionRules + } + if o.Role.Device.Restapi.Policies.DosRules != nil { + nestedRole.Device.Restapi.Policies.DosRules = o.Role.Device.Restapi.Policies.DosRules + } + if o.Role.Device.Restapi.Policies.NetworkPacketBrokerRules != nil { + nestedRole.Device.Restapi.Policies.NetworkPacketBrokerRules = o.Role.Device.Restapi.Policies.NetworkPacketBrokerRules + } + if o.Role.Device.Restapi.Policies.SdwanRules != nil { + nestedRole.Device.Restapi.Policies.SdwanRules = o.Role.Device.Restapi.Policies.SdwanRules + } + if o.Role.Device.Restapi.Policies.SecurityRules != nil { + nestedRole.Device.Restapi.Policies.SecurityRules = o.Role.Device.Restapi.Policies.SecurityRules + } + if o.Role.Device.Restapi.Policies.ApplicationOverrideRules != nil { + nestedRole.Device.Restapi.Policies.ApplicationOverrideRules = o.Role.Device.Restapi.Policies.ApplicationOverrideRules + } + if o.Role.Device.Restapi.Policies.AuthenticationRules != nil { + nestedRole.Device.Restapi.Policies.AuthenticationRules = o.Role.Device.Restapi.Policies.AuthenticationRules + } + if o.Role.Device.Restapi.Policies.NatRules != nil { + nestedRole.Device.Restapi.Policies.NatRules = o.Role.Device.Restapi.Policies.NatRules + } + if o.Role.Device.Restapi.Policies.PolicyBasedForwardingRules != nil { + nestedRole.Device.Restapi.Policies.PolicyBasedForwardingRules = o.Role.Device.Restapi.Policies.PolicyBasedForwardingRules + } + if o.Role.Device.Restapi.Policies.QosRules != nil { + nestedRole.Device.Restapi.Policies.QosRules = o.Role.Device.Restapi.Policies.QosRules + } + } + if o.Role.Device.Restapi.System != nil { + nestedRole.Device.Restapi.System = &RoleDeviceRestapiSystemXml{} + if _, ok := o.Misc["RoleDeviceRestapiSystem"]; ok { + nestedRole.Device.Restapi.System.Misc = o.Misc["RoleDeviceRestapiSystem"] + } + if o.Role.Device.Restapi.System.Configuration != nil { + nestedRole.Device.Restapi.System.Configuration = o.Role.Device.Restapi.System.Configuration + } + } + if o.Role.Device.Restapi.Device != nil { + nestedRole.Device.Restapi.Device = &RoleDeviceRestapiDeviceXml{} + if _, ok := o.Misc["RoleDeviceRestapiDevice"]; ok { + nestedRole.Device.Restapi.Device.Misc = o.Misc["RoleDeviceRestapiDevice"] + } + if o.Role.Device.Restapi.Device.HttpServerProfiles != nil { + nestedRole.Device.Restapi.Device.HttpServerProfiles = o.Role.Device.Restapi.Device.HttpServerProfiles + } + if o.Role.Device.Restapi.Device.LdapServerProfiles != nil { + nestedRole.Device.Restapi.Device.LdapServerProfiles = o.Role.Device.Restapi.Device.LdapServerProfiles + } + if o.Role.Device.Restapi.Device.LogInterfaceSetting != nil { + nestedRole.Device.Restapi.Device.LogInterfaceSetting = o.Role.Device.Restapi.Device.LogInterfaceSetting + } + if o.Role.Device.Restapi.Device.SnmpTrapServerProfiles != nil { + nestedRole.Device.Restapi.Device.SnmpTrapServerProfiles = o.Role.Device.Restapi.Device.SnmpTrapServerProfiles + } + if o.Role.Device.Restapi.Device.SyslogServerProfiles != nil { + nestedRole.Device.Restapi.Device.SyslogServerProfiles = o.Role.Device.Restapi.Device.SyslogServerProfiles + } + if o.Role.Device.Restapi.Device.VirtualSystems != nil { + nestedRole.Device.Restapi.Device.VirtualSystems = o.Role.Device.Restapi.Device.VirtualSystems + } + if o.Role.Device.Restapi.Device.EmailServerProfiles != nil { + nestedRole.Device.Restapi.Device.EmailServerProfiles = o.Role.Device.Restapi.Device.EmailServerProfiles + } + } + } + if o.Role.Device.Webui != nil { + nestedRole.Device.Webui = &RoleDeviceWebuiXml{} + if _, ok := o.Misc["RoleDeviceWebui"]; ok { + nestedRole.Device.Webui.Misc = o.Misc["RoleDeviceWebui"] + } + if o.Role.Device.Webui.Monitor != nil { + nestedRole.Device.Webui.Monitor = &RoleDeviceWebuiMonitorXml{} + if _, ok := o.Misc["RoleDeviceWebuiMonitor"]; ok { + nestedRole.Device.Webui.Monitor.Misc = o.Misc["RoleDeviceWebuiMonitor"] + } + if o.Role.Device.Webui.Monitor.ApplicationReports != nil { + nestedRole.Device.Webui.Monitor.ApplicationReports = o.Role.Device.Webui.Monitor.ApplicationReports + } + if o.Role.Device.Webui.Monitor.PdfReports != nil { + nestedRole.Device.Webui.Monitor.PdfReports = &RoleDeviceWebuiMonitorPdfReportsXml{} + if _, ok := o.Misc["RoleDeviceWebuiMonitorPdfReports"]; ok { + nestedRole.Device.Webui.Monitor.PdfReports.Misc = o.Misc["RoleDeviceWebuiMonitorPdfReports"] + } + if o.Role.Device.Webui.Monitor.PdfReports.PdfSummaryReports != nil { + nestedRole.Device.Webui.Monitor.PdfReports.PdfSummaryReports = o.Role.Device.Webui.Monitor.PdfReports.PdfSummaryReports + } + if o.Role.Device.Webui.Monitor.PdfReports.ReportGroups != nil { + nestedRole.Device.Webui.Monitor.PdfReports.ReportGroups = o.Role.Device.Webui.Monitor.PdfReports.ReportGroups + } + if o.Role.Device.Webui.Monitor.PdfReports.SaasApplicationUsageReport != nil { + nestedRole.Device.Webui.Monitor.PdfReports.SaasApplicationUsageReport = o.Role.Device.Webui.Monitor.PdfReports.SaasApplicationUsageReport + } + if o.Role.Device.Webui.Monitor.PdfReports.UserActivityReport != nil { + nestedRole.Device.Webui.Monitor.PdfReports.UserActivityReport = o.Role.Device.Webui.Monitor.PdfReports.UserActivityReport + } + if o.Role.Device.Webui.Monitor.PdfReports.EmailScheduler != nil { + nestedRole.Device.Webui.Monitor.PdfReports.EmailScheduler = o.Role.Device.Webui.Monitor.PdfReports.EmailScheduler + } + if o.Role.Device.Webui.Monitor.PdfReports.ManagePdfSummary != nil { + nestedRole.Device.Webui.Monitor.PdfReports.ManagePdfSummary = o.Role.Device.Webui.Monitor.PdfReports.ManagePdfSummary + } + } + if o.Role.Device.Webui.Monitor.SessionBrowser != nil { + nestedRole.Device.Webui.Monitor.SessionBrowser = o.Role.Device.Webui.Monitor.SessionBrowser + } + if o.Role.Device.Webui.Monitor.ViewCustomReports != nil { + nestedRole.Device.Webui.Monitor.ViewCustomReports = o.Role.Device.Webui.Monitor.ViewCustomReports + } + if o.Role.Device.Webui.Monitor.AppScope != nil { + nestedRole.Device.Webui.Monitor.AppScope = o.Role.Device.Webui.Monitor.AppScope + } + if o.Role.Device.Webui.Monitor.AutomatedCorrelationEngine != nil { + nestedRole.Device.Webui.Monitor.AutomatedCorrelationEngine = &RoleDeviceWebuiMonitorAutomatedCorrelationEngineXml{} + if _, ok := o.Misc["RoleDeviceWebuiMonitorAutomatedCorrelationEngine"]; ok { + nestedRole.Device.Webui.Monitor.AutomatedCorrelationEngine.Misc = o.Misc["RoleDeviceWebuiMonitorAutomatedCorrelationEngine"] + } + if o.Role.Device.Webui.Monitor.AutomatedCorrelationEngine.CorrelatedEvents != nil { + nestedRole.Device.Webui.Monitor.AutomatedCorrelationEngine.CorrelatedEvents = o.Role.Device.Webui.Monitor.AutomatedCorrelationEngine.CorrelatedEvents + } + if o.Role.Device.Webui.Monitor.AutomatedCorrelationEngine.CorrelationObjects != nil { + nestedRole.Device.Webui.Monitor.AutomatedCorrelationEngine.CorrelationObjects = o.Role.Device.Webui.Monitor.AutomatedCorrelationEngine.CorrelationObjects + } + } + if o.Role.Device.Webui.Monitor.BlockIpList != nil { + nestedRole.Device.Webui.Monitor.BlockIpList = o.Role.Device.Webui.Monitor.BlockIpList + } + if o.Role.Device.Webui.Monitor.ExternalLogs != nil { + nestedRole.Device.Webui.Monitor.ExternalLogs = o.Role.Device.Webui.Monitor.ExternalLogs + } + if o.Role.Device.Webui.Monitor.Logs != nil { + nestedRole.Device.Webui.Monitor.Logs = &RoleDeviceWebuiMonitorLogsXml{} + if _, ok := o.Misc["RoleDeviceWebuiMonitorLogs"]; ok { + nestedRole.Device.Webui.Monitor.Logs.Misc = o.Misc["RoleDeviceWebuiMonitorLogs"] + } + if o.Role.Device.Webui.Monitor.Logs.Configuration != nil { + nestedRole.Device.Webui.Monitor.Logs.Configuration = o.Role.Device.Webui.Monitor.Logs.Configuration + } + if o.Role.Device.Webui.Monitor.Logs.DataFiltering != nil { + nestedRole.Device.Webui.Monitor.Logs.DataFiltering = o.Role.Device.Webui.Monitor.Logs.DataFiltering + } + if o.Role.Device.Webui.Monitor.Logs.Gtp != nil { + nestedRole.Device.Webui.Monitor.Logs.Gtp = o.Role.Device.Webui.Monitor.Logs.Gtp + } + if o.Role.Device.Webui.Monitor.Logs.Sctp != nil { + nestedRole.Device.Webui.Monitor.Logs.Sctp = o.Role.Device.Webui.Monitor.Logs.Sctp + } + if o.Role.Device.Webui.Monitor.Logs.Alarm != nil { + nestedRole.Device.Webui.Monitor.Logs.Alarm = o.Role.Device.Webui.Monitor.Logs.Alarm + } + if o.Role.Device.Webui.Monitor.Logs.System != nil { + nestedRole.Device.Webui.Monitor.Logs.System = o.Role.Device.Webui.Monitor.Logs.System + } + if o.Role.Device.Webui.Monitor.Logs.Threat != nil { + nestedRole.Device.Webui.Monitor.Logs.Threat = o.Role.Device.Webui.Monitor.Logs.Threat + } + if o.Role.Device.Webui.Monitor.Logs.Url != nil { + nestedRole.Device.Webui.Monitor.Logs.Url = o.Role.Device.Webui.Monitor.Logs.Url + } + if o.Role.Device.Webui.Monitor.Logs.Wildfire != nil { + nestedRole.Device.Webui.Monitor.Logs.Wildfire = o.Role.Device.Webui.Monitor.Logs.Wildfire + } + if o.Role.Device.Webui.Monitor.Logs.Decryption != nil { + nestedRole.Device.Webui.Monitor.Logs.Decryption = o.Role.Device.Webui.Monitor.Logs.Decryption + } + if o.Role.Device.Webui.Monitor.Logs.Globalprotect != nil { + nestedRole.Device.Webui.Monitor.Logs.Globalprotect = o.Role.Device.Webui.Monitor.Logs.Globalprotect + } + if o.Role.Device.Webui.Monitor.Logs.Hipmatch != nil { + nestedRole.Device.Webui.Monitor.Logs.Hipmatch = o.Role.Device.Webui.Monitor.Logs.Hipmatch + } + if o.Role.Device.Webui.Monitor.Logs.Iptag != nil { + nestedRole.Device.Webui.Monitor.Logs.Iptag = o.Role.Device.Webui.Monitor.Logs.Iptag + } + if o.Role.Device.Webui.Monitor.Logs.Tunnel != nil { + nestedRole.Device.Webui.Monitor.Logs.Tunnel = o.Role.Device.Webui.Monitor.Logs.Tunnel + } + if o.Role.Device.Webui.Monitor.Logs.Authentication != nil { + nestedRole.Device.Webui.Monitor.Logs.Authentication = o.Role.Device.Webui.Monitor.Logs.Authentication + } + if o.Role.Device.Webui.Monitor.Logs.Traffic != nil { + nestedRole.Device.Webui.Monitor.Logs.Traffic = o.Role.Device.Webui.Monitor.Logs.Traffic + } + if o.Role.Device.Webui.Monitor.Logs.Userid != nil { + nestedRole.Device.Webui.Monitor.Logs.Userid = o.Role.Device.Webui.Monitor.Logs.Userid + } + } + if o.Role.Device.Webui.Monitor.UrlFilteringReports != nil { + nestedRole.Device.Webui.Monitor.UrlFilteringReports = o.Role.Device.Webui.Monitor.UrlFilteringReports + } + if o.Role.Device.Webui.Monitor.Botnet != nil { + nestedRole.Device.Webui.Monitor.Botnet = o.Role.Device.Webui.Monitor.Botnet + } + if o.Role.Device.Webui.Monitor.CustomReports != nil { + nestedRole.Device.Webui.Monitor.CustomReports = &RoleDeviceWebuiMonitorCustomReportsXml{} + if _, ok := o.Misc["RoleDeviceWebuiMonitorCustomReports"]; ok { + nestedRole.Device.Webui.Monitor.CustomReports.Misc = o.Misc["RoleDeviceWebuiMonitorCustomReports"] + } + if o.Role.Device.Webui.Monitor.CustomReports.Auth != nil { + nestedRole.Device.Webui.Monitor.CustomReports.Auth = o.Role.Device.Webui.Monitor.CustomReports.Auth + } + if o.Role.Device.Webui.Monitor.CustomReports.DataFilteringLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.DataFilteringLog = o.Role.Device.Webui.Monitor.CustomReports.DataFilteringLog + } + if o.Role.Device.Webui.Monitor.CustomReports.Globalprotect != nil { + nestedRole.Device.Webui.Monitor.CustomReports.Globalprotect = o.Role.Device.Webui.Monitor.CustomReports.Globalprotect + } + if o.Role.Device.Webui.Monitor.CustomReports.UrlSummary != nil { + nestedRole.Device.Webui.Monitor.CustomReports.UrlSummary = o.Role.Device.Webui.Monitor.CustomReports.UrlSummary + } + if o.Role.Device.Webui.Monitor.CustomReports.WildfireLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.WildfireLog = o.Role.Device.Webui.Monitor.CustomReports.WildfireLog + } + if o.Role.Device.Webui.Monitor.CustomReports.ApplicationStatistics != nil { + nestedRole.Device.Webui.Monitor.CustomReports.ApplicationStatistics = o.Role.Device.Webui.Monitor.CustomReports.ApplicationStatistics + } + if o.Role.Device.Webui.Monitor.CustomReports.SctpSummary != nil { + nestedRole.Device.Webui.Monitor.CustomReports.SctpSummary = o.Role.Device.Webui.Monitor.CustomReports.SctpSummary + } + if o.Role.Device.Webui.Monitor.CustomReports.ThreatSummary != nil { + nestedRole.Device.Webui.Monitor.CustomReports.ThreatSummary = o.Role.Device.Webui.Monitor.CustomReports.ThreatSummary + } + if o.Role.Device.Webui.Monitor.CustomReports.TunnelLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.TunnelLog = o.Role.Device.Webui.Monitor.CustomReports.TunnelLog + } + if o.Role.Device.Webui.Monitor.CustomReports.UrlLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.UrlLog = o.Role.Device.Webui.Monitor.CustomReports.UrlLog + } + if o.Role.Device.Webui.Monitor.CustomReports.GtpSummary != nil { + nestedRole.Device.Webui.Monitor.CustomReports.GtpSummary = o.Role.Device.Webui.Monitor.CustomReports.GtpSummary + } + if o.Role.Device.Webui.Monitor.CustomReports.Iptag != nil { + nestedRole.Device.Webui.Monitor.CustomReports.Iptag = o.Role.Device.Webui.Monitor.CustomReports.Iptag + } + if o.Role.Device.Webui.Monitor.CustomReports.TrafficSummary != nil { + nestedRole.Device.Webui.Monitor.CustomReports.TrafficSummary = o.Role.Device.Webui.Monitor.CustomReports.TrafficSummary + } + if o.Role.Device.Webui.Monitor.CustomReports.TrafficLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.TrafficLog = o.Role.Device.Webui.Monitor.CustomReports.TrafficLog + } + if o.Role.Device.Webui.Monitor.CustomReports.TunnelSummary != nil { + nestedRole.Device.Webui.Monitor.CustomReports.TunnelSummary = o.Role.Device.Webui.Monitor.CustomReports.TunnelSummary + } + if o.Role.Device.Webui.Monitor.CustomReports.DecryptionLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.DecryptionLog = o.Role.Device.Webui.Monitor.CustomReports.DecryptionLog + } + if o.Role.Device.Webui.Monitor.CustomReports.DecryptionSummary != nil { + nestedRole.Device.Webui.Monitor.CustomReports.DecryptionSummary = o.Role.Device.Webui.Monitor.CustomReports.DecryptionSummary + } + if o.Role.Device.Webui.Monitor.CustomReports.GtpLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.GtpLog = o.Role.Device.Webui.Monitor.CustomReports.GtpLog + } + if o.Role.Device.Webui.Monitor.CustomReports.Hipmatch != nil { + nestedRole.Device.Webui.Monitor.CustomReports.Hipmatch = o.Role.Device.Webui.Monitor.CustomReports.Hipmatch + } + if o.Role.Device.Webui.Monitor.CustomReports.SctpLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.SctpLog = o.Role.Device.Webui.Monitor.CustomReports.SctpLog + } + if o.Role.Device.Webui.Monitor.CustomReports.ThreatLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.ThreatLog = o.Role.Device.Webui.Monitor.CustomReports.ThreatLog + } + if o.Role.Device.Webui.Monitor.CustomReports.Userid != nil { + nestedRole.Device.Webui.Monitor.CustomReports.Userid = o.Role.Device.Webui.Monitor.CustomReports.Userid + } + } + if o.Role.Device.Webui.Monitor.GtpReports != nil { + nestedRole.Device.Webui.Monitor.GtpReports = o.Role.Device.Webui.Monitor.GtpReports + } + if o.Role.Device.Webui.Monitor.PacketCapture != nil { + nestedRole.Device.Webui.Monitor.PacketCapture = o.Role.Device.Webui.Monitor.PacketCapture + } + if o.Role.Device.Webui.Monitor.SctpReports != nil { + nestedRole.Device.Webui.Monitor.SctpReports = o.Role.Device.Webui.Monitor.SctpReports + } + if o.Role.Device.Webui.Monitor.ThreatReports != nil { + nestedRole.Device.Webui.Monitor.ThreatReports = o.Role.Device.Webui.Monitor.ThreatReports + } + if o.Role.Device.Webui.Monitor.TrafficReports != nil { + nestedRole.Device.Webui.Monitor.TrafficReports = o.Role.Device.Webui.Monitor.TrafficReports + } + } + if o.Role.Device.Webui.Objects != nil { + nestedRole.Device.Webui.Objects = &RoleDeviceWebuiObjectsXml{} + if _, ok := o.Misc["RoleDeviceWebuiObjects"]; ok { + nestedRole.Device.Webui.Objects.Misc = o.Misc["RoleDeviceWebuiObjects"] + } + if o.Role.Device.Webui.Objects.Decryption != nil { + nestedRole.Device.Webui.Objects.Decryption = &RoleDeviceWebuiObjectsDecryptionXml{} + if _, ok := o.Misc["RoleDeviceWebuiObjectsDecryption"]; ok { + nestedRole.Device.Webui.Objects.Decryption.Misc = o.Misc["RoleDeviceWebuiObjectsDecryption"] + } + if o.Role.Device.Webui.Objects.Decryption.DecryptionProfile != nil { + nestedRole.Device.Webui.Objects.Decryption.DecryptionProfile = o.Role.Device.Webui.Objects.Decryption.DecryptionProfile + } + } + if o.Role.Device.Webui.Objects.Tags != nil { + nestedRole.Device.Webui.Objects.Tags = o.Role.Device.Webui.Objects.Tags + } + if o.Role.Device.Webui.Objects.AddressGroups != nil { + nestedRole.Device.Webui.Objects.AddressGroups = o.Role.Device.Webui.Objects.AddressGroups + } + if o.Role.Device.Webui.Objects.ApplicationFilters != nil { + nestedRole.Device.Webui.Objects.ApplicationFilters = o.Role.Device.Webui.Objects.ApplicationFilters + } + if o.Role.Device.Webui.Objects.Devices != nil { + nestedRole.Device.Webui.Objects.Devices = o.Role.Device.Webui.Objects.Devices + } + if o.Role.Device.Webui.Objects.DynamicUserGroups != nil { + nestedRole.Device.Webui.Objects.DynamicUserGroups = o.Role.Device.Webui.Objects.DynamicUserGroups + } + if o.Role.Device.Webui.Objects.Regions != nil { + nestedRole.Device.Webui.Objects.Regions = o.Role.Device.Webui.Objects.Regions + } + if o.Role.Device.Webui.Objects.Schedules != nil { + nestedRole.Device.Webui.Objects.Schedules = o.Role.Device.Webui.Objects.Schedules + } + if o.Role.Device.Webui.Objects.ServiceGroups != nil { + nestedRole.Device.Webui.Objects.ServiceGroups = o.Role.Device.Webui.Objects.ServiceGroups + } + if o.Role.Device.Webui.Objects.ApplicationGroups != nil { + nestedRole.Device.Webui.Objects.ApplicationGroups = o.Role.Device.Webui.Objects.ApplicationGroups + } + if o.Role.Device.Webui.Objects.Applications != nil { + nestedRole.Device.Webui.Objects.Applications = o.Role.Device.Webui.Objects.Applications + } + if o.Role.Device.Webui.Objects.Authentication != nil { + nestedRole.Device.Webui.Objects.Authentication = o.Role.Device.Webui.Objects.Authentication + } + if o.Role.Device.Webui.Objects.CustomObjects != nil { + nestedRole.Device.Webui.Objects.CustomObjects = &RoleDeviceWebuiObjectsCustomObjectsXml{} + if _, ok := o.Misc["RoleDeviceWebuiObjectsCustomObjects"]; ok { + nestedRole.Device.Webui.Objects.CustomObjects.Misc = o.Misc["RoleDeviceWebuiObjectsCustomObjects"] + } + if o.Role.Device.Webui.Objects.CustomObjects.UrlCategory != nil { + nestedRole.Device.Webui.Objects.CustomObjects.UrlCategory = o.Role.Device.Webui.Objects.CustomObjects.UrlCategory + } + if o.Role.Device.Webui.Objects.CustomObjects.Vulnerability != nil { + nestedRole.Device.Webui.Objects.CustomObjects.Vulnerability = o.Role.Device.Webui.Objects.CustomObjects.Vulnerability + } + if o.Role.Device.Webui.Objects.CustomObjects.DataPatterns != nil { + nestedRole.Device.Webui.Objects.CustomObjects.DataPatterns = o.Role.Device.Webui.Objects.CustomObjects.DataPatterns + } + if o.Role.Device.Webui.Objects.CustomObjects.Spyware != nil { + nestedRole.Device.Webui.Objects.CustomObjects.Spyware = o.Role.Device.Webui.Objects.CustomObjects.Spyware + } + } + if o.Role.Device.Webui.Objects.SecurityProfiles != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles = &RoleDeviceWebuiObjectsSecurityProfilesXml{} + if _, ok := o.Misc["RoleDeviceWebuiObjectsSecurityProfiles"]; ok { + nestedRole.Device.Webui.Objects.SecurityProfiles.Misc = o.Misc["RoleDeviceWebuiObjectsSecurityProfiles"] + } + if o.Role.Device.Webui.Objects.SecurityProfiles.AntiSpyware != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.AntiSpyware = o.Role.Device.Webui.Objects.SecurityProfiles.AntiSpyware + } + if o.Role.Device.Webui.Objects.SecurityProfiles.Antivirus != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.Antivirus = o.Role.Device.Webui.Objects.SecurityProfiles.Antivirus + } + if o.Role.Device.Webui.Objects.SecurityProfiles.UrlFiltering != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.UrlFiltering = o.Role.Device.Webui.Objects.SecurityProfiles.UrlFiltering + } + if o.Role.Device.Webui.Objects.SecurityProfiles.VulnerabilityProtection != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.VulnerabilityProtection = o.Role.Device.Webui.Objects.SecurityProfiles.VulnerabilityProtection + } + if o.Role.Device.Webui.Objects.SecurityProfiles.DataFiltering != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.DataFiltering = o.Role.Device.Webui.Objects.SecurityProfiles.DataFiltering + } + if o.Role.Device.Webui.Objects.SecurityProfiles.DosProtection != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.DosProtection = o.Role.Device.Webui.Objects.SecurityProfiles.DosProtection + } + if o.Role.Device.Webui.Objects.SecurityProfiles.FileBlocking != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.FileBlocking = o.Role.Device.Webui.Objects.SecurityProfiles.FileBlocking + } + if o.Role.Device.Webui.Objects.SecurityProfiles.GtpProtection != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.GtpProtection = o.Role.Device.Webui.Objects.SecurityProfiles.GtpProtection + } + if o.Role.Device.Webui.Objects.SecurityProfiles.SctpProtection != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.SctpProtection = o.Role.Device.Webui.Objects.SecurityProfiles.SctpProtection + } + if o.Role.Device.Webui.Objects.SecurityProfiles.WildfireAnalysis != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.WildfireAnalysis = o.Role.Device.Webui.Objects.SecurityProfiles.WildfireAnalysis + } + } + if o.Role.Device.Webui.Objects.Services != nil { + nestedRole.Device.Webui.Objects.Services = o.Role.Device.Webui.Objects.Services + } + if o.Role.Device.Webui.Objects.Addresses != nil { + nestedRole.Device.Webui.Objects.Addresses = o.Role.Device.Webui.Objects.Addresses + } + if o.Role.Device.Webui.Objects.DynamicBlockLists != nil { + nestedRole.Device.Webui.Objects.DynamicBlockLists = o.Role.Device.Webui.Objects.DynamicBlockLists + } + if o.Role.Device.Webui.Objects.GlobalProtect != nil { + nestedRole.Device.Webui.Objects.GlobalProtect = &RoleDeviceWebuiObjectsGlobalProtectXml{} + if _, ok := o.Misc["RoleDeviceWebuiObjectsGlobalProtect"]; ok { + nestedRole.Device.Webui.Objects.GlobalProtect.Misc = o.Misc["RoleDeviceWebuiObjectsGlobalProtect"] + } + if o.Role.Device.Webui.Objects.GlobalProtect.HipObjects != nil { + nestedRole.Device.Webui.Objects.GlobalProtect.HipObjects = o.Role.Device.Webui.Objects.GlobalProtect.HipObjects + } + if o.Role.Device.Webui.Objects.GlobalProtect.HipProfiles != nil { + nestedRole.Device.Webui.Objects.GlobalProtect.HipProfiles = o.Role.Device.Webui.Objects.GlobalProtect.HipProfiles + } + } + if o.Role.Device.Webui.Objects.LogForwarding != nil { + nestedRole.Device.Webui.Objects.LogForwarding = o.Role.Device.Webui.Objects.LogForwarding + } + if o.Role.Device.Webui.Objects.PacketBrokerProfile != nil { + nestedRole.Device.Webui.Objects.PacketBrokerProfile = o.Role.Device.Webui.Objects.PacketBrokerProfile + } + if o.Role.Device.Webui.Objects.Sdwan != nil { + nestedRole.Device.Webui.Objects.Sdwan = &RoleDeviceWebuiObjectsSdwanXml{} + if _, ok := o.Misc["RoleDeviceWebuiObjectsSdwan"]; ok { + nestedRole.Device.Webui.Objects.Sdwan.Misc = o.Misc["RoleDeviceWebuiObjectsSdwan"] + } + if o.Role.Device.Webui.Objects.Sdwan.SdwanDistProfile != nil { + nestedRole.Device.Webui.Objects.Sdwan.SdwanDistProfile = o.Role.Device.Webui.Objects.Sdwan.SdwanDistProfile + } + if o.Role.Device.Webui.Objects.Sdwan.SdwanErrorCorrectionProfile != nil { + nestedRole.Device.Webui.Objects.Sdwan.SdwanErrorCorrectionProfile = o.Role.Device.Webui.Objects.Sdwan.SdwanErrorCorrectionProfile + } + if o.Role.Device.Webui.Objects.Sdwan.SdwanProfile != nil { + nestedRole.Device.Webui.Objects.Sdwan.SdwanProfile = o.Role.Device.Webui.Objects.Sdwan.SdwanProfile + } + if o.Role.Device.Webui.Objects.Sdwan.SdwanSaasQualityProfile != nil { + nestedRole.Device.Webui.Objects.Sdwan.SdwanSaasQualityProfile = o.Role.Device.Webui.Objects.Sdwan.SdwanSaasQualityProfile + } + } + if o.Role.Device.Webui.Objects.SecurityProfileGroups != nil { + nestedRole.Device.Webui.Objects.SecurityProfileGroups = o.Role.Device.Webui.Objects.SecurityProfileGroups + } + } + if o.Role.Device.Webui.Operations != nil { + nestedRole.Device.Webui.Operations = &RoleDeviceWebuiOperationsXml{} + if _, ok := o.Misc["RoleDeviceWebuiOperations"]; ok { + nestedRole.Device.Webui.Operations.Misc = o.Misc["RoleDeviceWebuiOperations"] + } + if o.Role.Device.Webui.Operations.DownloadCoreFiles != nil { + nestedRole.Device.Webui.Operations.DownloadCoreFiles = o.Role.Device.Webui.Operations.DownloadCoreFiles + } + if o.Role.Device.Webui.Operations.DownloadPcapFiles != nil { + nestedRole.Device.Webui.Operations.DownloadPcapFiles = o.Role.Device.Webui.Operations.DownloadPcapFiles + } + if o.Role.Device.Webui.Operations.GenerateStatsDumpFile != nil { + nestedRole.Device.Webui.Operations.GenerateStatsDumpFile = o.Role.Device.Webui.Operations.GenerateStatsDumpFile + } + if o.Role.Device.Webui.Operations.GenerateTechSupportFile != nil { + nestedRole.Device.Webui.Operations.GenerateTechSupportFile = o.Role.Device.Webui.Operations.GenerateTechSupportFile + } + if o.Role.Device.Webui.Operations.Reboot != nil { + nestedRole.Device.Webui.Operations.Reboot = o.Role.Device.Webui.Operations.Reboot + } + } + if o.Role.Device.Webui.Commit != nil { + nestedRole.Device.Webui.Commit = &RoleDeviceWebuiCommitXml{} + if _, ok := o.Misc["RoleDeviceWebuiCommit"]; ok { + nestedRole.Device.Webui.Commit.Misc = o.Misc["RoleDeviceWebuiCommit"] + } + if o.Role.Device.Webui.Commit.Device != nil { + nestedRole.Device.Webui.Commit.Device = o.Role.Device.Webui.Commit.Device + } + if o.Role.Device.Webui.Commit.ObjectLevelChanges != nil { + nestedRole.Device.Webui.Commit.ObjectLevelChanges = o.Role.Device.Webui.Commit.ObjectLevelChanges + } + if o.Role.Device.Webui.Commit.CommitForOtherAdmins != nil { + nestedRole.Device.Webui.Commit.CommitForOtherAdmins = o.Role.Device.Webui.Commit.CommitForOtherAdmins + } + } + if o.Role.Device.Webui.Device != nil { + nestedRole.Device.Webui.Device = &RoleDeviceWebuiDeviceXml{} + if _, ok := o.Misc["RoleDeviceWebuiDevice"]; ok { + nestedRole.Device.Webui.Device.Misc = o.Misc["RoleDeviceWebuiDevice"] + } + if o.Role.Device.Webui.Device.SharedGateways != nil { + nestedRole.Device.Webui.Device.SharedGateways = o.Role.Device.Webui.Device.SharedGateways + } + if o.Role.Device.Webui.Device.BlockPages != nil { + nestedRole.Device.Webui.Device.BlockPages = o.Role.Device.Webui.Device.BlockPages + } + if o.Role.Device.Webui.Device.Licenses != nil { + nestedRole.Device.Webui.Device.Licenses = o.Role.Device.Webui.Device.Licenses + } + if o.Role.Device.Webui.Device.DataRedistribution != nil { + nestedRole.Device.Webui.Device.DataRedistribution = o.Role.Device.Webui.Device.DataRedistribution + } + if o.Role.Device.Webui.Device.MasterKey != nil { + nestedRole.Device.Webui.Device.MasterKey = o.Role.Device.Webui.Device.MasterKey + } + if o.Role.Device.Webui.Device.Setup != nil { + nestedRole.Device.Webui.Device.Setup = &RoleDeviceWebuiDeviceSetupXml{} + if _, ok := o.Misc["RoleDeviceWebuiDeviceSetup"]; ok { + nestedRole.Device.Webui.Device.Setup.Misc = o.Misc["RoleDeviceWebuiDeviceSetup"] + } + if o.Role.Device.Webui.Device.Setup.Management != nil { + nestedRole.Device.Webui.Device.Setup.Management = o.Role.Device.Webui.Device.Setup.Management + } + if o.Role.Device.Webui.Device.Setup.Operations != nil { + nestedRole.Device.Webui.Device.Setup.Operations = o.Role.Device.Webui.Device.Setup.Operations + } + if o.Role.Device.Webui.Device.Setup.Services != nil { + nestedRole.Device.Webui.Device.Setup.Services = o.Role.Device.Webui.Device.Setup.Services + } + if o.Role.Device.Webui.Device.Setup.Wildfire != nil { + nestedRole.Device.Webui.Device.Setup.Wildfire = o.Role.Device.Webui.Device.Setup.Wildfire + } + if o.Role.Device.Webui.Device.Setup.ContentId != nil { + nestedRole.Device.Webui.Device.Setup.ContentId = o.Role.Device.Webui.Device.Setup.ContentId + } + if o.Role.Device.Webui.Device.Setup.Hsm != nil { + nestedRole.Device.Webui.Device.Setup.Hsm = o.Role.Device.Webui.Device.Setup.Hsm + } + if o.Role.Device.Webui.Device.Setup.Interfaces != nil { + nestedRole.Device.Webui.Device.Setup.Interfaces = o.Role.Device.Webui.Device.Setup.Interfaces + } + if o.Role.Device.Webui.Device.Setup.Session != nil { + nestedRole.Device.Webui.Device.Setup.Session = o.Role.Device.Webui.Device.Setup.Session + } + if o.Role.Device.Webui.Device.Setup.Telemetry != nil { + nestedRole.Device.Webui.Device.Setup.Telemetry = o.Role.Device.Webui.Device.Setup.Telemetry + } + } + if o.Role.Device.Webui.Device.Support != nil { + nestedRole.Device.Webui.Device.Support = o.Role.Device.Webui.Device.Support + } + if o.Role.Device.Webui.Device.Troubleshooting != nil { + nestedRole.Device.Webui.Device.Troubleshooting = o.Role.Device.Webui.Device.Troubleshooting + } + if o.Role.Device.Webui.Device.AccessDomain != nil { + nestedRole.Device.Webui.Device.AccessDomain = o.Role.Device.Webui.Device.AccessDomain + } + if o.Role.Device.Webui.Device.DynamicUpdates != nil { + nestedRole.Device.Webui.Device.DynamicUpdates = o.Role.Device.Webui.Device.DynamicUpdates + } + if o.Role.Device.Webui.Device.HighAvailability != nil { + nestedRole.Device.Webui.Device.HighAvailability = o.Role.Device.Webui.Device.HighAvailability + } + if o.Role.Device.Webui.Device.AuthenticationProfile != nil { + nestedRole.Device.Webui.Device.AuthenticationProfile = o.Role.Device.Webui.Device.AuthenticationProfile + } + if o.Role.Device.Webui.Device.ConfigAudit != nil { + nestedRole.Device.Webui.Device.ConfigAudit = o.Role.Device.Webui.Device.ConfigAudit + } + if o.Role.Device.Webui.Device.ServerProfile != nil { + nestedRole.Device.Webui.Device.ServerProfile = &RoleDeviceWebuiDeviceServerProfileXml{} + if _, ok := o.Misc["RoleDeviceWebuiDeviceServerProfile"]; ok { + nestedRole.Device.Webui.Device.ServerProfile.Misc = o.Misc["RoleDeviceWebuiDeviceServerProfile"] + } + if o.Role.Device.Webui.Device.ServerProfile.Netflow != nil { + nestedRole.Device.Webui.Device.ServerProfile.Netflow = o.Role.Device.Webui.Device.ServerProfile.Netflow + } + if o.Role.Device.Webui.Device.ServerProfile.Radius != nil { + nestedRole.Device.Webui.Device.ServerProfile.Radius = o.Role.Device.Webui.Device.ServerProfile.Radius + } + if o.Role.Device.Webui.Device.ServerProfile.Scp != nil { + nestedRole.Device.Webui.Device.ServerProfile.Scp = o.Role.Device.Webui.Device.ServerProfile.Scp + } + if o.Role.Device.Webui.Device.ServerProfile.Syslog != nil { + nestedRole.Device.Webui.Device.ServerProfile.Syslog = o.Role.Device.Webui.Device.ServerProfile.Syslog + } + if o.Role.Device.Webui.Device.ServerProfile.Email != nil { + nestedRole.Device.Webui.Device.ServerProfile.Email = o.Role.Device.Webui.Device.ServerProfile.Email + } + if o.Role.Device.Webui.Device.ServerProfile.Http != nil { + nestedRole.Device.Webui.Device.ServerProfile.Http = o.Role.Device.Webui.Device.ServerProfile.Http + } + if o.Role.Device.Webui.Device.ServerProfile.Ldap != nil { + nestedRole.Device.Webui.Device.ServerProfile.Ldap = o.Role.Device.Webui.Device.ServerProfile.Ldap + } + if o.Role.Device.Webui.Device.ServerProfile.Mfa != nil { + nestedRole.Device.Webui.Device.ServerProfile.Mfa = o.Role.Device.Webui.Device.ServerProfile.Mfa + } + if o.Role.Device.Webui.Device.ServerProfile.Tacplus != nil { + nestedRole.Device.Webui.Device.ServerProfile.Tacplus = o.Role.Device.Webui.Device.ServerProfile.Tacplus + } + if o.Role.Device.Webui.Device.ServerProfile.Dns != nil { + nestedRole.Device.Webui.Device.ServerProfile.Dns = o.Role.Device.Webui.Device.ServerProfile.Dns + } + if o.Role.Device.Webui.Device.ServerProfile.Kerberos != nil { + nestedRole.Device.Webui.Device.ServerProfile.Kerberos = o.Role.Device.Webui.Device.ServerProfile.Kerberos + } + if o.Role.Device.Webui.Device.ServerProfile.SamlIdp != nil { + nestedRole.Device.Webui.Device.ServerProfile.SamlIdp = o.Role.Device.Webui.Device.ServerProfile.SamlIdp + } + if o.Role.Device.Webui.Device.ServerProfile.SnmpTrap != nil { + nestedRole.Device.Webui.Device.ServerProfile.SnmpTrap = o.Role.Device.Webui.Device.ServerProfile.SnmpTrap + } + } + if o.Role.Device.Webui.Device.UserIdentification != nil { + nestedRole.Device.Webui.Device.UserIdentification = o.Role.Device.Webui.Device.UserIdentification + } + if o.Role.Device.Webui.Device.VmInfoSource != nil { + nestedRole.Device.Webui.Device.VmInfoSource = o.Role.Device.Webui.Device.VmInfoSource + } + if o.Role.Device.Webui.Device.AuthenticationSequence != nil { + nestedRole.Device.Webui.Device.AuthenticationSequence = o.Role.Device.Webui.Device.AuthenticationSequence + } + if o.Role.Device.Webui.Device.DeviceQuarantine != nil { + nestedRole.Device.Webui.Device.DeviceQuarantine = o.Role.Device.Webui.Device.DeviceQuarantine + } + if o.Role.Device.Webui.Device.Plugins != nil { + nestedRole.Device.Webui.Device.Plugins = o.Role.Device.Webui.Device.Plugins + } + if o.Role.Device.Webui.Device.DhcpSyslogServer != nil { + nestedRole.Device.Webui.Device.DhcpSyslogServer = o.Role.Device.Webui.Device.DhcpSyslogServer + } + if o.Role.Device.Webui.Device.GlobalProtectClient != nil { + nestedRole.Device.Webui.Device.GlobalProtectClient = o.Role.Device.Webui.Device.GlobalProtectClient + } + if o.Role.Device.Webui.Device.LocalUserDatabase != nil { + nestedRole.Device.Webui.Device.LocalUserDatabase = &RoleDeviceWebuiDeviceLocalUserDatabaseXml{} + if _, ok := o.Misc["RoleDeviceWebuiDeviceLocalUserDatabase"]; ok { + nestedRole.Device.Webui.Device.LocalUserDatabase.Misc = o.Misc["RoleDeviceWebuiDeviceLocalUserDatabase"] + } + if o.Role.Device.Webui.Device.LocalUserDatabase.UserGroups != nil { + nestedRole.Device.Webui.Device.LocalUserDatabase.UserGroups = o.Role.Device.Webui.Device.LocalUserDatabase.UserGroups + } + if o.Role.Device.Webui.Device.LocalUserDatabase.Users != nil { + nestedRole.Device.Webui.Device.LocalUserDatabase.Users = o.Role.Device.Webui.Device.LocalUserDatabase.Users + } + } + if o.Role.Device.Webui.Device.PolicyRecommendations != nil { + nestedRole.Device.Webui.Device.PolicyRecommendations = &RoleDeviceWebuiDevicePolicyRecommendationsXml{} + if _, ok := o.Misc["RoleDeviceWebuiDevicePolicyRecommendations"]; ok { + nestedRole.Device.Webui.Device.PolicyRecommendations.Misc = o.Misc["RoleDeviceWebuiDevicePolicyRecommendations"] + } + if o.Role.Device.Webui.Device.PolicyRecommendations.Iot != nil { + nestedRole.Device.Webui.Device.PolicyRecommendations.Iot = o.Role.Device.Webui.Device.PolicyRecommendations.Iot + } + if o.Role.Device.Webui.Device.PolicyRecommendations.Saas != nil { + nestedRole.Device.Webui.Device.PolicyRecommendations.Saas = o.Role.Device.Webui.Device.PolicyRecommendations.Saas + } + } + if o.Role.Device.Webui.Device.Software != nil { + nestedRole.Device.Webui.Device.Software = o.Role.Device.Webui.Device.Software + } + if o.Role.Device.Webui.Device.CertificateManagement != nil { + nestedRole.Device.Webui.Device.CertificateManagement = &RoleDeviceWebuiDeviceCertificateManagementXml{} + if _, ok := o.Misc["RoleDeviceWebuiDeviceCertificateManagement"]; ok { + nestedRole.Device.Webui.Device.CertificateManagement.Misc = o.Misc["RoleDeviceWebuiDeviceCertificateManagement"] + } + if o.Role.Device.Webui.Device.CertificateManagement.CertificateProfile != nil { + nestedRole.Device.Webui.Device.CertificateManagement.CertificateProfile = o.Role.Device.Webui.Device.CertificateManagement.CertificateProfile + } + if o.Role.Device.Webui.Device.CertificateManagement.Certificates != nil { + nestedRole.Device.Webui.Device.CertificateManagement.Certificates = o.Role.Device.Webui.Device.CertificateManagement.Certificates + } + if o.Role.Device.Webui.Device.CertificateManagement.OcspResponder != nil { + nestedRole.Device.Webui.Device.CertificateManagement.OcspResponder = o.Role.Device.Webui.Device.CertificateManagement.OcspResponder + } + if o.Role.Device.Webui.Device.CertificateManagement.Scep != nil { + nestedRole.Device.Webui.Device.CertificateManagement.Scep = o.Role.Device.Webui.Device.CertificateManagement.Scep + } + if o.Role.Device.Webui.Device.CertificateManagement.SshServiceProfile != nil { + nestedRole.Device.Webui.Device.CertificateManagement.SshServiceProfile = o.Role.Device.Webui.Device.CertificateManagement.SshServiceProfile + } + if o.Role.Device.Webui.Device.CertificateManagement.SslDecryptionExclusion != nil { + nestedRole.Device.Webui.Device.CertificateManagement.SslDecryptionExclusion = o.Role.Device.Webui.Device.CertificateManagement.SslDecryptionExclusion + } + if o.Role.Device.Webui.Device.CertificateManagement.SslTlsServiceProfile != nil { + nestedRole.Device.Webui.Device.CertificateManagement.SslTlsServiceProfile = o.Role.Device.Webui.Device.CertificateManagement.SslTlsServiceProfile + } + } + if o.Role.Device.Webui.Device.LogFwdCard != nil { + nestedRole.Device.Webui.Device.LogFwdCard = o.Role.Device.Webui.Device.LogFwdCard + } + if o.Role.Device.Webui.Device.LogSettings != nil { + nestedRole.Device.Webui.Device.LogSettings = &RoleDeviceWebuiDeviceLogSettingsXml{} + if _, ok := o.Misc["RoleDeviceWebuiDeviceLogSettings"]; ok { + nestedRole.Device.Webui.Device.LogSettings.Misc = o.Misc["RoleDeviceWebuiDeviceLogSettings"] + } + if o.Role.Device.Webui.Device.LogSettings.Hipmatch != nil { + nestedRole.Device.Webui.Device.LogSettings.Hipmatch = o.Role.Device.Webui.Device.LogSettings.Hipmatch + } + if o.Role.Device.Webui.Device.LogSettings.Iptag != nil { + nestedRole.Device.Webui.Device.LogSettings.Iptag = o.Role.Device.Webui.Device.LogSettings.Iptag + } + if o.Role.Device.Webui.Device.LogSettings.ManageLog != nil { + nestedRole.Device.Webui.Device.LogSettings.ManageLog = o.Role.Device.Webui.Device.LogSettings.ManageLog + } + if o.Role.Device.Webui.Device.LogSettings.System != nil { + nestedRole.Device.Webui.Device.LogSettings.System = o.Role.Device.Webui.Device.LogSettings.System + } + if o.Role.Device.Webui.Device.LogSettings.UserId != nil { + nestedRole.Device.Webui.Device.LogSettings.UserId = o.Role.Device.Webui.Device.LogSettings.UserId + } + if o.Role.Device.Webui.Device.LogSettings.Correlation != nil { + nestedRole.Device.Webui.Device.LogSettings.Correlation = o.Role.Device.Webui.Device.LogSettings.Correlation + } + if o.Role.Device.Webui.Device.LogSettings.Globalprotect != nil { + nestedRole.Device.Webui.Device.LogSettings.Globalprotect = o.Role.Device.Webui.Device.LogSettings.Globalprotect + } + if o.Role.Device.Webui.Device.LogSettings.CcAlarm != nil { + nestedRole.Device.Webui.Device.LogSettings.CcAlarm = o.Role.Device.Webui.Device.LogSettings.CcAlarm + } + if o.Role.Device.Webui.Device.LogSettings.Config != nil { + nestedRole.Device.Webui.Device.LogSettings.Config = o.Role.Device.Webui.Device.LogSettings.Config + } + } + if o.Role.Device.Webui.Device.ScheduledLogExport != nil { + nestedRole.Device.Webui.Device.ScheduledLogExport = o.Role.Device.Webui.Device.ScheduledLogExport + } + if o.Role.Device.Webui.Device.VirtualSystems != nil { + nestedRole.Device.Webui.Device.VirtualSystems = o.Role.Device.Webui.Device.VirtualSystems + } + if o.Role.Device.Webui.Device.AdminRoles != nil { + nestedRole.Device.Webui.Device.AdminRoles = o.Role.Device.Webui.Device.AdminRoles + } + if o.Role.Device.Webui.Device.Administrators != nil { + nestedRole.Device.Webui.Device.Administrators = o.Role.Device.Webui.Device.Administrators + } + } + if o.Role.Device.Webui.Global != nil { + nestedRole.Device.Webui.Global = &RoleDeviceWebuiGlobalXml{} + if _, ok := o.Misc["RoleDeviceWebuiGlobal"]; ok { + nestedRole.Device.Webui.Global.Misc = o.Misc["RoleDeviceWebuiGlobal"] + } + if o.Role.Device.Webui.Global.SystemAlarms != nil { + nestedRole.Device.Webui.Global.SystemAlarms = o.Role.Device.Webui.Global.SystemAlarms + } + } + if o.Role.Device.Webui.Save != nil { + nestedRole.Device.Webui.Save = &RoleDeviceWebuiSaveXml{} + if _, ok := o.Misc["RoleDeviceWebuiSave"]; ok { + nestedRole.Device.Webui.Save.Misc = o.Misc["RoleDeviceWebuiSave"] + } + if o.Role.Device.Webui.Save.PartialSave != nil { + nestedRole.Device.Webui.Save.PartialSave = o.Role.Device.Webui.Save.PartialSave + } + if o.Role.Device.Webui.Save.SaveForOtherAdmins != nil { + nestedRole.Device.Webui.Save.SaveForOtherAdmins = o.Role.Device.Webui.Save.SaveForOtherAdmins + } + if o.Role.Device.Webui.Save.ObjectLevelChanges != nil { + nestedRole.Device.Webui.Save.ObjectLevelChanges = o.Role.Device.Webui.Save.ObjectLevelChanges + } + } + if o.Role.Device.Webui.Tasks != nil { + nestedRole.Device.Webui.Tasks = o.Role.Device.Webui.Tasks + } + if o.Role.Device.Webui.Acc != nil { + nestedRole.Device.Webui.Acc = o.Role.Device.Webui.Acc + } + if o.Role.Device.Webui.Network != nil { + nestedRole.Device.Webui.Network = &RoleDeviceWebuiNetworkXml{} + if _, ok := o.Misc["RoleDeviceWebuiNetwork"]; ok { + nestedRole.Device.Webui.Network.Misc = o.Misc["RoleDeviceWebuiNetwork"] + } + if o.Role.Device.Webui.Network.SecureWebGateway != nil { + nestedRole.Device.Webui.Network.SecureWebGateway = o.Role.Device.Webui.Network.SecureWebGateway + } + if o.Role.Device.Webui.Network.DnsProxy != nil { + nestedRole.Device.Webui.Network.DnsProxy = o.Role.Device.Webui.Network.DnsProxy + } + if o.Role.Device.Webui.Network.Interfaces != nil { + nestedRole.Device.Webui.Network.Interfaces = o.Role.Device.Webui.Network.Interfaces + } + if o.Role.Device.Webui.Network.Routing != nil { + nestedRole.Device.Webui.Network.Routing = &RoleDeviceWebuiNetworkRoutingXml{} + if _, ok := o.Misc["RoleDeviceWebuiNetworkRouting"]; ok { + nestedRole.Device.Webui.Network.Routing.Misc = o.Misc["RoleDeviceWebuiNetworkRouting"] + } + if o.Role.Device.Webui.Network.Routing.LogicalRouters != nil { + nestedRole.Device.Webui.Network.Routing.LogicalRouters = o.Role.Device.Webui.Network.Routing.LogicalRouters + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles = &RoleDeviceWebuiNetworkRoutingRoutingProfilesXml{} + if _, ok := o.Misc["RoleDeviceWebuiNetworkRoutingRoutingProfiles"]; ok { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles.Misc = o.Misc["RoleDeviceWebuiNetworkRoutingRoutingProfiles"] + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles.Bfd != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles.Bfd = o.Role.Device.Webui.Network.Routing.RoutingProfiles.Bfd + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles.Bgp != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles.Bgp = o.Role.Device.Webui.Network.Routing.RoutingProfiles.Bgp + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles.Filters != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles.Filters = o.Role.Device.Webui.Network.Routing.RoutingProfiles.Filters + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles.Multicast != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles.Multicast = o.Role.Device.Webui.Network.Routing.RoutingProfiles.Multicast + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles.Ospf != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles.Ospf = o.Role.Device.Webui.Network.Routing.RoutingProfiles.Ospf + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles.Ospfv3 != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles.Ospfv3 = o.Role.Device.Webui.Network.Routing.RoutingProfiles.Ospfv3 + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles.Ripv2 != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles.Ripv2 = o.Role.Device.Webui.Network.Routing.RoutingProfiles.Ripv2 + } + } + } + if o.Role.Device.Webui.Network.VirtualRouters != nil { + nestedRole.Device.Webui.Network.VirtualRouters = o.Role.Device.Webui.Network.VirtualRouters + } + if o.Role.Device.Webui.Network.VirtualWires != nil { + nestedRole.Device.Webui.Network.VirtualWires = o.Role.Device.Webui.Network.VirtualWires + } + if o.Role.Device.Webui.Network.GlobalProtect != nil { + nestedRole.Device.Webui.Network.GlobalProtect = &RoleDeviceWebuiNetworkGlobalProtectXml{} + if _, ok := o.Misc["RoleDeviceWebuiNetworkGlobalProtect"]; ok { + nestedRole.Device.Webui.Network.GlobalProtect.Misc = o.Misc["RoleDeviceWebuiNetworkGlobalProtect"] + } + if o.Role.Device.Webui.Network.GlobalProtect.ClientlessAppGroups != nil { + nestedRole.Device.Webui.Network.GlobalProtect.ClientlessAppGroups = o.Role.Device.Webui.Network.GlobalProtect.ClientlessAppGroups + } + if o.Role.Device.Webui.Network.GlobalProtect.ClientlessApps != nil { + nestedRole.Device.Webui.Network.GlobalProtect.ClientlessApps = o.Role.Device.Webui.Network.GlobalProtect.ClientlessApps + } + if o.Role.Device.Webui.Network.GlobalProtect.Gateways != nil { + nestedRole.Device.Webui.Network.GlobalProtect.Gateways = o.Role.Device.Webui.Network.GlobalProtect.Gateways + } + if o.Role.Device.Webui.Network.GlobalProtect.Mdm != nil { + nestedRole.Device.Webui.Network.GlobalProtect.Mdm = o.Role.Device.Webui.Network.GlobalProtect.Mdm + } + if o.Role.Device.Webui.Network.GlobalProtect.Portals != nil { + nestedRole.Device.Webui.Network.GlobalProtect.Portals = o.Role.Device.Webui.Network.GlobalProtect.Portals + } + } + if o.Role.Device.Webui.Network.NetworkProfiles != nil { + nestedRole.Device.Webui.Network.NetworkProfiles = &RoleDeviceWebuiNetworkNetworkProfilesXml{} + if _, ok := o.Misc["RoleDeviceWebuiNetworkNetworkProfiles"]; ok { + nestedRole.Device.Webui.Network.NetworkProfiles.Misc = o.Misc["RoleDeviceWebuiNetworkNetworkProfiles"] + } + if o.Role.Device.Webui.Network.NetworkProfiles.InterfaceMgmt != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.InterfaceMgmt = o.Role.Device.Webui.Network.NetworkProfiles.InterfaceMgmt + } + if o.Role.Device.Webui.Network.NetworkProfiles.LldpProfile != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.LldpProfile = o.Role.Device.Webui.Network.NetworkProfiles.LldpProfile + } + if o.Role.Device.Webui.Network.NetworkProfiles.IkeCrypto != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.IkeCrypto = o.Role.Device.Webui.Network.NetworkProfiles.IkeCrypto + } + if o.Role.Device.Webui.Network.NetworkProfiles.IkeGateways != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.IkeGateways = o.Role.Device.Webui.Network.NetworkProfiles.IkeGateways + } + if o.Role.Device.Webui.Network.NetworkProfiles.IpsecCrypto != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.IpsecCrypto = o.Role.Device.Webui.Network.NetworkProfiles.IpsecCrypto + } + if o.Role.Device.Webui.Network.NetworkProfiles.QosProfile != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.QosProfile = o.Role.Device.Webui.Network.NetworkProfiles.QosProfile + } + if o.Role.Device.Webui.Network.NetworkProfiles.TunnelMonitor != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.TunnelMonitor = o.Role.Device.Webui.Network.NetworkProfiles.TunnelMonitor + } + if o.Role.Device.Webui.Network.NetworkProfiles.ZoneProtection != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.ZoneProtection = o.Role.Device.Webui.Network.NetworkProfiles.ZoneProtection + } + if o.Role.Device.Webui.Network.NetworkProfiles.BfdProfile != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.BfdProfile = o.Role.Device.Webui.Network.NetworkProfiles.BfdProfile + } + if o.Role.Device.Webui.Network.NetworkProfiles.GpAppIpsecCrypto != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.GpAppIpsecCrypto = o.Role.Device.Webui.Network.NetworkProfiles.GpAppIpsecCrypto + } + } + if o.Role.Device.Webui.Network.Zones != nil { + nestedRole.Device.Webui.Network.Zones = o.Role.Device.Webui.Network.Zones + } + if o.Role.Device.Webui.Network.Dhcp != nil { + nestedRole.Device.Webui.Network.Dhcp = o.Role.Device.Webui.Network.Dhcp + } + if o.Role.Device.Webui.Network.GreTunnels != nil { + nestedRole.Device.Webui.Network.GreTunnels = o.Role.Device.Webui.Network.GreTunnels + } + if o.Role.Device.Webui.Network.IpsecTunnels != nil { + nestedRole.Device.Webui.Network.IpsecTunnels = o.Role.Device.Webui.Network.IpsecTunnels + } + if o.Role.Device.Webui.Network.Lldp != nil { + nestedRole.Device.Webui.Network.Lldp = o.Role.Device.Webui.Network.Lldp + } + if o.Role.Device.Webui.Network.SdwanInterfaceProfile != nil { + nestedRole.Device.Webui.Network.SdwanInterfaceProfile = o.Role.Device.Webui.Network.SdwanInterfaceProfile + } + if o.Role.Device.Webui.Network.Qos != nil { + nestedRole.Device.Webui.Network.Qos = o.Role.Device.Webui.Network.Qos + } + if o.Role.Device.Webui.Network.Vlans != nil { + nestedRole.Device.Webui.Network.Vlans = o.Role.Device.Webui.Network.Vlans + } + } + if o.Role.Device.Webui.Validate != nil { + nestedRole.Device.Webui.Validate = o.Role.Device.Webui.Validate + } + if o.Role.Device.Webui.Dashboard != nil { + nestedRole.Device.Webui.Dashboard = o.Role.Device.Webui.Dashboard + } + if o.Role.Device.Webui.Privacy != nil { + nestedRole.Device.Webui.Privacy = &RoleDeviceWebuiPrivacyXml{} + if _, ok := o.Misc["RoleDeviceWebuiPrivacy"]; ok { + nestedRole.Device.Webui.Privacy.Misc = o.Misc["RoleDeviceWebuiPrivacy"] + } + if o.Role.Device.Webui.Privacy.ShowFullIpAddresses != nil { + nestedRole.Device.Webui.Privacy.ShowFullIpAddresses = o.Role.Device.Webui.Privacy.ShowFullIpAddresses + } + if o.Role.Device.Webui.Privacy.ShowUserNamesInLogsAndReports != nil { + nestedRole.Device.Webui.Privacy.ShowUserNamesInLogsAndReports = o.Role.Device.Webui.Privacy.ShowUserNamesInLogsAndReports + } + if o.Role.Device.Webui.Privacy.ViewPcapFiles != nil { + nestedRole.Device.Webui.Privacy.ViewPcapFiles = o.Role.Device.Webui.Privacy.ViewPcapFiles + } + } + if o.Role.Device.Webui.Policies != nil { + nestedRole.Device.Webui.Policies = &RoleDeviceWebuiPoliciesXml{} + if _, ok := o.Misc["RoleDeviceWebuiPolicies"]; ok { + nestedRole.Device.Webui.Policies.Misc = o.Misc["RoleDeviceWebuiPolicies"] + } + if o.Role.Device.Webui.Policies.DosRulebase != nil { + nestedRole.Device.Webui.Policies.DosRulebase = o.Role.Device.Webui.Policies.DosRulebase + } + if o.Role.Device.Webui.Policies.PbfRulebase != nil { + nestedRole.Device.Webui.Policies.PbfRulebase = o.Role.Device.Webui.Policies.PbfRulebase + } + if o.Role.Device.Webui.Policies.SdwanRulebase != nil { + nestedRole.Device.Webui.Policies.SdwanRulebase = o.Role.Device.Webui.Policies.SdwanRulebase + } + if o.Role.Device.Webui.Policies.SecurityRulebase != nil { + nestedRole.Device.Webui.Policies.SecurityRulebase = o.Role.Device.Webui.Policies.SecurityRulebase + } + if o.Role.Device.Webui.Policies.SslDecryptionRulebase != nil { + nestedRole.Device.Webui.Policies.SslDecryptionRulebase = o.Role.Device.Webui.Policies.SslDecryptionRulebase + } + if o.Role.Device.Webui.Policies.TunnelInspectRulebase != nil { + nestedRole.Device.Webui.Policies.TunnelInspectRulebase = o.Role.Device.Webui.Policies.TunnelInspectRulebase + } + if o.Role.Device.Webui.Policies.ApplicationOverrideRulebase != nil { + nestedRole.Device.Webui.Policies.ApplicationOverrideRulebase = o.Role.Device.Webui.Policies.ApplicationOverrideRulebase + } + if o.Role.Device.Webui.Policies.AuthenticationRulebase != nil { + nestedRole.Device.Webui.Policies.AuthenticationRulebase = o.Role.Device.Webui.Policies.AuthenticationRulebase + } + if o.Role.Device.Webui.Policies.QosRulebase != nil { + nestedRole.Device.Webui.Policies.QosRulebase = o.Role.Device.Webui.Policies.QosRulebase + } + if o.Role.Device.Webui.Policies.RuleHitCountReset != nil { + nestedRole.Device.Webui.Policies.RuleHitCountReset = o.Role.Device.Webui.Policies.RuleHitCountReset + } + if o.Role.Device.Webui.Policies.NatRulebase != nil { + nestedRole.Device.Webui.Policies.NatRulebase = o.Role.Device.Webui.Policies.NatRulebase + } + if o.Role.Device.Webui.Policies.NetworkPacketBrokerRulebase != nil { + nestedRole.Device.Webui.Policies.NetworkPacketBrokerRulebase = o.Role.Device.Webui.Policies.NetworkPacketBrokerRulebase + } + } + } + if o.Role.Device.Xmlapi != nil { + nestedRole.Device.Xmlapi = &RoleDeviceXmlapiXml{} + if _, ok := o.Misc["RoleDeviceXmlapi"]; ok { + nestedRole.Device.Xmlapi.Misc = o.Misc["RoleDeviceXmlapi"] + } + if o.Role.Device.Xmlapi.Report != nil { + nestedRole.Device.Xmlapi.Report = o.Role.Device.Xmlapi.Report + } + if o.Role.Device.Xmlapi.Commit != nil { + nestedRole.Device.Xmlapi.Commit = o.Role.Device.Xmlapi.Commit + } + if o.Role.Device.Xmlapi.Config != nil { + nestedRole.Device.Xmlapi.Config = o.Role.Device.Xmlapi.Config + } + if o.Role.Device.Xmlapi.Export != nil { + nestedRole.Device.Xmlapi.Export = o.Role.Device.Xmlapi.Export + } + if o.Role.Device.Xmlapi.Import != nil { + nestedRole.Device.Xmlapi.Import = o.Role.Device.Xmlapi.Import + } + if o.Role.Device.Xmlapi.Iot != nil { + nestedRole.Device.Xmlapi.Iot = o.Role.Device.Xmlapi.Iot + } + if o.Role.Device.Xmlapi.Op != nil { + nestedRole.Device.Xmlapi.Op = o.Role.Device.Xmlapi.Op + } + if o.Role.Device.Xmlapi.Log != nil { + nestedRole.Device.Xmlapi.Log = o.Role.Device.Xmlapi.Log + } + if o.Role.Device.Xmlapi.UserId != nil { + nestedRole.Device.Xmlapi.UserId = o.Role.Device.Xmlapi.UserId + } + } + } + if o.Role.Vsys != nil { + nestedRole.Vsys = &RoleVsysXml{} + if _, ok := o.Misc["RoleVsys"]; ok { + nestedRole.Vsys.Misc = o.Misc["RoleVsys"] + } + if o.Role.Vsys.Xmlapi != nil { + nestedRole.Vsys.Xmlapi = &RoleVsysXmlapiXml{} + if _, ok := o.Misc["RoleVsysXmlapi"]; ok { + nestedRole.Vsys.Xmlapi.Misc = o.Misc["RoleVsysXmlapi"] + } + if o.Role.Vsys.Xmlapi.Commit != nil { + nestedRole.Vsys.Xmlapi.Commit = o.Role.Vsys.Xmlapi.Commit + } + if o.Role.Vsys.Xmlapi.Export != nil { + nestedRole.Vsys.Xmlapi.Export = o.Role.Vsys.Xmlapi.Export + } + if o.Role.Vsys.Xmlapi.Iot != nil { + nestedRole.Vsys.Xmlapi.Iot = o.Role.Vsys.Xmlapi.Iot + } + if o.Role.Vsys.Xmlapi.Op != nil { + nestedRole.Vsys.Xmlapi.Op = o.Role.Vsys.Xmlapi.Op + } + if o.Role.Vsys.Xmlapi.Report != nil { + nestedRole.Vsys.Xmlapi.Report = o.Role.Vsys.Xmlapi.Report + } + if o.Role.Vsys.Xmlapi.Config != nil { + nestedRole.Vsys.Xmlapi.Config = o.Role.Vsys.Xmlapi.Config + } + if o.Role.Vsys.Xmlapi.Import != nil { + nestedRole.Vsys.Xmlapi.Import = o.Role.Vsys.Xmlapi.Import + } + if o.Role.Vsys.Xmlapi.Log != nil { + nestedRole.Vsys.Xmlapi.Log = o.Role.Vsys.Xmlapi.Log + } + if o.Role.Vsys.Xmlapi.UserId != nil { + nestedRole.Vsys.Xmlapi.UserId = o.Role.Vsys.Xmlapi.UserId + } + } + if o.Role.Vsys.Cli != nil { + nestedRole.Vsys.Cli = o.Role.Vsys.Cli + } + if o.Role.Vsys.Restapi != nil { + nestedRole.Vsys.Restapi = &RoleVsysRestapiXml{} + if _, ok := o.Misc["RoleVsysRestapi"]; ok { + nestedRole.Vsys.Restapi.Misc = o.Misc["RoleVsysRestapi"] + } + if o.Role.Vsys.Restapi.Objects != nil { + nestedRole.Vsys.Restapi.Objects = &RoleVsysRestapiObjectsXml{} + if _, ok := o.Misc["RoleVsysRestapiObjects"]; ok { + nestedRole.Vsys.Restapi.Objects.Misc = o.Misc["RoleVsysRestapiObjects"] + } + if o.Role.Vsys.Restapi.Objects.SdwanErrorCorrectionProfiles != nil { + nestedRole.Vsys.Restapi.Objects.SdwanErrorCorrectionProfiles = o.Role.Vsys.Restapi.Objects.SdwanErrorCorrectionProfiles + } + if o.Role.Vsys.Restapi.Objects.SdwanPathQualityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.SdwanPathQualityProfiles = o.Role.Vsys.Restapi.Objects.SdwanPathQualityProfiles + } + if o.Role.Vsys.Restapi.Objects.ExternalDynamicLists != nil { + nestedRole.Vsys.Restapi.Objects.ExternalDynamicLists = o.Role.Vsys.Restapi.Objects.ExternalDynamicLists + } + if o.Role.Vsys.Restapi.Objects.Schedules != nil { + nestedRole.Vsys.Restapi.Objects.Schedules = o.Role.Vsys.Restapi.Objects.Schedules + } + if o.Role.Vsys.Restapi.Objects.Applications != nil { + nestedRole.Vsys.Restapi.Objects.Applications = o.Role.Vsys.Restapi.Objects.Applications + } + if o.Role.Vsys.Restapi.Objects.CustomUrlCategories != nil { + nestedRole.Vsys.Restapi.Objects.CustomUrlCategories = o.Role.Vsys.Restapi.Objects.CustomUrlCategories + } + if o.Role.Vsys.Restapi.Objects.Devices != nil { + nestedRole.Vsys.Restapi.Objects.Devices = o.Role.Vsys.Restapi.Objects.Devices + } + if o.Role.Vsys.Restapi.Objects.DosProtectionSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.DosProtectionSecurityProfiles = o.Role.Vsys.Restapi.Objects.DosProtectionSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.Services != nil { + nestedRole.Vsys.Restapi.Objects.Services = o.Role.Vsys.Restapi.Objects.Services + } + if o.Role.Vsys.Restapi.Objects.Addresses != nil { + nestedRole.Vsys.Restapi.Objects.Addresses = o.Role.Vsys.Restapi.Objects.Addresses + } + if o.Role.Vsys.Restapi.Objects.ApplicationFilters != nil { + nestedRole.Vsys.Restapi.Objects.ApplicationFilters = o.Role.Vsys.Restapi.Objects.ApplicationFilters + } + if o.Role.Vsys.Restapi.Objects.SdwanTrafficDistributionProfiles != nil { + nestedRole.Vsys.Restapi.Objects.SdwanTrafficDistributionProfiles = o.Role.Vsys.Restapi.Objects.SdwanTrafficDistributionProfiles + } + if o.Role.Vsys.Restapi.Objects.DataFilteringSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.DataFilteringSecurityProfiles = o.Role.Vsys.Restapi.Objects.DataFilteringSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.GlobalprotectHipProfiles != nil { + nestedRole.Vsys.Restapi.Objects.GlobalprotectHipProfiles = o.Role.Vsys.Restapi.Objects.GlobalprotectHipProfiles + } + if o.Role.Vsys.Restapi.Objects.CustomSpywareSignatures != nil { + nestedRole.Vsys.Restapi.Objects.CustomSpywareSignatures = o.Role.Vsys.Restapi.Objects.CustomSpywareSignatures + } + if o.Role.Vsys.Restapi.Objects.CustomVulnerabilitySignatures != nil { + nestedRole.Vsys.Restapi.Objects.CustomVulnerabilitySignatures = o.Role.Vsys.Restapi.Objects.CustomVulnerabilitySignatures + } + if o.Role.Vsys.Restapi.Objects.FileBlockingSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.FileBlockingSecurityProfiles = o.Role.Vsys.Restapi.Objects.FileBlockingSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.SctpProtectionSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.SctpProtectionSecurityProfiles = o.Role.Vsys.Restapi.Objects.SctpProtectionSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.ServiceGroups != nil { + nestedRole.Vsys.Restapi.Objects.ServiceGroups = o.Role.Vsys.Restapi.Objects.ServiceGroups + } + if o.Role.Vsys.Restapi.Objects.VulnerabilityProtectionSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.VulnerabilityProtectionSecurityProfiles = o.Role.Vsys.Restapi.Objects.VulnerabilityProtectionSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.AddressGroups != nil { + nestedRole.Vsys.Restapi.Objects.AddressGroups = o.Role.Vsys.Restapi.Objects.AddressGroups + } + if o.Role.Vsys.Restapi.Objects.AntiSpywareSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.AntiSpywareSecurityProfiles = o.Role.Vsys.Restapi.Objects.AntiSpywareSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.Regions != nil { + nestedRole.Vsys.Restapi.Objects.Regions = o.Role.Vsys.Restapi.Objects.Regions + } + if o.Role.Vsys.Restapi.Objects.SdwanSaasQualityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.SdwanSaasQualityProfiles = o.Role.Vsys.Restapi.Objects.SdwanSaasQualityProfiles + } + if o.Role.Vsys.Restapi.Objects.ApplicationGroups != nil { + nestedRole.Vsys.Restapi.Objects.ApplicationGroups = o.Role.Vsys.Restapi.Objects.ApplicationGroups + } + if o.Role.Vsys.Restapi.Objects.CustomDataPatterns != nil { + nestedRole.Vsys.Restapi.Objects.CustomDataPatterns = o.Role.Vsys.Restapi.Objects.CustomDataPatterns + } + if o.Role.Vsys.Restapi.Objects.AntivirusSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.AntivirusSecurityProfiles = o.Role.Vsys.Restapi.Objects.AntivirusSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.GlobalprotectHipObjects != nil { + nestedRole.Vsys.Restapi.Objects.GlobalprotectHipObjects = o.Role.Vsys.Restapi.Objects.GlobalprotectHipObjects + } + if o.Role.Vsys.Restapi.Objects.GtpProtectionSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.GtpProtectionSecurityProfiles = o.Role.Vsys.Restapi.Objects.GtpProtectionSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.SecurityProfileGroups != nil { + nestedRole.Vsys.Restapi.Objects.SecurityProfileGroups = o.Role.Vsys.Restapi.Objects.SecurityProfileGroups + } + if o.Role.Vsys.Restapi.Objects.UrlFilteringSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.UrlFilteringSecurityProfiles = o.Role.Vsys.Restapi.Objects.UrlFilteringSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.WildfireAnalysisSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.WildfireAnalysisSecurityProfiles = o.Role.Vsys.Restapi.Objects.WildfireAnalysisSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.DecryptionProfiles != nil { + nestedRole.Vsys.Restapi.Objects.DecryptionProfiles = o.Role.Vsys.Restapi.Objects.DecryptionProfiles + } + if o.Role.Vsys.Restapi.Objects.DynamicUserGroups != nil { + nestedRole.Vsys.Restapi.Objects.DynamicUserGroups = o.Role.Vsys.Restapi.Objects.DynamicUserGroups + } + if o.Role.Vsys.Restapi.Objects.PacketBrokerProfiles != nil { + nestedRole.Vsys.Restapi.Objects.PacketBrokerProfiles = o.Role.Vsys.Restapi.Objects.PacketBrokerProfiles + } + if o.Role.Vsys.Restapi.Objects.Tags != nil { + nestedRole.Vsys.Restapi.Objects.Tags = o.Role.Vsys.Restapi.Objects.Tags + } + if o.Role.Vsys.Restapi.Objects.AuthenticationEnforcements != nil { + nestedRole.Vsys.Restapi.Objects.AuthenticationEnforcements = o.Role.Vsys.Restapi.Objects.AuthenticationEnforcements + } + if o.Role.Vsys.Restapi.Objects.LogForwardingProfiles != nil { + nestedRole.Vsys.Restapi.Objects.LogForwardingProfiles = o.Role.Vsys.Restapi.Objects.LogForwardingProfiles + } + } + if o.Role.Vsys.Restapi.Policies != nil { + nestedRole.Vsys.Restapi.Policies = &RoleVsysRestapiPoliciesXml{} + if _, ok := o.Misc["RoleVsysRestapiPolicies"]; ok { + nestedRole.Vsys.Restapi.Policies.Misc = o.Misc["RoleVsysRestapiPolicies"] + } + if o.Role.Vsys.Restapi.Policies.NetworkPacketBrokerRules != nil { + nestedRole.Vsys.Restapi.Policies.NetworkPacketBrokerRules = o.Role.Vsys.Restapi.Policies.NetworkPacketBrokerRules + } + if o.Role.Vsys.Restapi.Policies.SdwanRules != nil { + nestedRole.Vsys.Restapi.Policies.SdwanRules = o.Role.Vsys.Restapi.Policies.SdwanRules + } + if o.Role.Vsys.Restapi.Policies.SecurityRules != nil { + nestedRole.Vsys.Restapi.Policies.SecurityRules = o.Role.Vsys.Restapi.Policies.SecurityRules + } + if o.Role.Vsys.Restapi.Policies.ApplicationOverrideRules != nil { + nestedRole.Vsys.Restapi.Policies.ApplicationOverrideRules = o.Role.Vsys.Restapi.Policies.ApplicationOverrideRules + } + if o.Role.Vsys.Restapi.Policies.AuthenticationRules != nil { + nestedRole.Vsys.Restapi.Policies.AuthenticationRules = o.Role.Vsys.Restapi.Policies.AuthenticationRules + } + if o.Role.Vsys.Restapi.Policies.DosRules != nil { + nestedRole.Vsys.Restapi.Policies.DosRules = o.Role.Vsys.Restapi.Policies.DosRules + } + if o.Role.Vsys.Restapi.Policies.NatRules != nil { + nestedRole.Vsys.Restapi.Policies.NatRules = o.Role.Vsys.Restapi.Policies.NatRules + } + if o.Role.Vsys.Restapi.Policies.DecryptionRules != nil { + nestedRole.Vsys.Restapi.Policies.DecryptionRules = o.Role.Vsys.Restapi.Policies.DecryptionRules + } + if o.Role.Vsys.Restapi.Policies.PolicyBasedForwardingRules != nil { + nestedRole.Vsys.Restapi.Policies.PolicyBasedForwardingRules = o.Role.Vsys.Restapi.Policies.PolicyBasedForwardingRules + } + if o.Role.Vsys.Restapi.Policies.QosRules != nil { + nestedRole.Vsys.Restapi.Policies.QosRules = o.Role.Vsys.Restapi.Policies.QosRules + } + if o.Role.Vsys.Restapi.Policies.TunnelInspectionRules != nil { + nestedRole.Vsys.Restapi.Policies.TunnelInspectionRules = o.Role.Vsys.Restapi.Policies.TunnelInspectionRules + } + } + if o.Role.Vsys.Restapi.System != nil { + nestedRole.Vsys.Restapi.System = &RoleVsysRestapiSystemXml{} + if _, ok := o.Misc["RoleVsysRestapiSystem"]; ok { + nestedRole.Vsys.Restapi.System.Misc = o.Misc["RoleVsysRestapiSystem"] + } + if o.Role.Vsys.Restapi.System.Configuration != nil { + nestedRole.Vsys.Restapi.System.Configuration = o.Role.Vsys.Restapi.System.Configuration + } + } + if o.Role.Vsys.Restapi.Device != nil { + nestedRole.Vsys.Restapi.Device = &RoleVsysRestapiDeviceXml{} + if _, ok := o.Misc["RoleVsysRestapiDevice"]; ok { + nestedRole.Vsys.Restapi.Device.Misc = o.Misc["RoleVsysRestapiDevice"] + } + if o.Role.Vsys.Restapi.Device.VirtualSystems != nil { + nestedRole.Vsys.Restapi.Device.VirtualSystems = o.Role.Vsys.Restapi.Device.VirtualSystems + } + if o.Role.Vsys.Restapi.Device.EmailServerProfiles != nil { + nestedRole.Vsys.Restapi.Device.EmailServerProfiles = o.Role.Vsys.Restapi.Device.EmailServerProfiles + } + if o.Role.Vsys.Restapi.Device.HttpServerProfiles != nil { + nestedRole.Vsys.Restapi.Device.HttpServerProfiles = o.Role.Vsys.Restapi.Device.HttpServerProfiles + } + if o.Role.Vsys.Restapi.Device.LdapServerProfiles != nil { + nestedRole.Vsys.Restapi.Device.LdapServerProfiles = o.Role.Vsys.Restapi.Device.LdapServerProfiles + } + if o.Role.Vsys.Restapi.Device.LogInterfaceSetting != nil { + nestedRole.Vsys.Restapi.Device.LogInterfaceSetting = o.Role.Vsys.Restapi.Device.LogInterfaceSetting + } + if o.Role.Vsys.Restapi.Device.SnmpTrapServerProfiles != nil { + nestedRole.Vsys.Restapi.Device.SnmpTrapServerProfiles = o.Role.Vsys.Restapi.Device.SnmpTrapServerProfiles + } + if o.Role.Vsys.Restapi.Device.SyslogServerProfiles != nil { + nestedRole.Vsys.Restapi.Device.SyslogServerProfiles = o.Role.Vsys.Restapi.Device.SyslogServerProfiles + } + } + if o.Role.Vsys.Restapi.Network != nil { + nestedRole.Vsys.Restapi.Network = &RoleVsysRestapiNetworkXml{} + if _, ok := o.Misc["RoleVsysRestapiNetwork"]; ok { + nestedRole.Vsys.Restapi.Network.Misc = o.Misc["RoleVsysRestapiNetwork"] + } + if o.Role.Vsys.Restapi.Network.GlobalprotectGateways != nil { + nestedRole.Vsys.Restapi.Network.GlobalprotectGateways = o.Role.Vsys.Restapi.Network.GlobalprotectGateways + } + if o.Role.Vsys.Restapi.Network.GlobalprotectMdmServers != nil { + nestedRole.Vsys.Restapi.Network.GlobalprotectMdmServers = o.Role.Vsys.Restapi.Network.GlobalprotectMdmServers + } + if o.Role.Vsys.Restapi.Network.GlobalprotectPortals != nil { + nestedRole.Vsys.Restapi.Network.GlobalprotectPortals = o.Role.Vsys.Restapi.Network.GlobalprotectPortals + } + if o.Role.Vsys.Restapi.Network.Zones != nil { + nestedRole.Vsys.Restapi.Network.Zones = o.Role.Vsys.Restapi.Network.Zones + } + if o.Role.Vsys.Restapi.Network.SdwanInterfaceProfiles != nil { + nestedRole.Vsys.Restapi.Network.SdwanInterfaceProfiles = o.Role.Vsys.Restapi.Network.SdwanInterfaceProfiles + } + if o.Role.Vsys.Restapi.Network.GlobalprotectClientlessAppGroups != nil { + nestedRole.Vsys.Restapi.Network.GlobalprotectClientlessAppGroups = o.Role.Vsys.Restapi.Network.GlobalprotectClientlessAppGroups + } + if o.Role.Vsys.Restapi.Network.GlobalprotectClientlessApps != nil { + nestedRole.Vsys.Restapi.Network.GlobalprotectClientlessApps = o.Role.Vsys.Restapi.Network.GlobalprotectClientlessApps + } + } + } + if o.Role.Vsys.Webui != nil { + nestedRole.Vsys.Webui = &RoleVsysWebuiXml{} + if _, ok := o.Misc["RoleVsysWebui"]; ok { + nestedRole.Vsys.Webui.Misc = o.Misc["RoleVsysWebui"] + } + if o.Role.Vsys.Webui.Acc != nil { + nestedRole.Vsys.Webui.Acc = o.Role.Vsys.Webui.Acc + } + if o.Role.Vsys.Webui.Dashboard != nil { + nestedRole.Vsys.Webui.Dashboard = o.Role.Vsys.Webui.Dashboard + } + if o.Role.Vsys.Webui.Policies != nil { + nestedRole.Vsys.Webui.Policies = &RoleVsysWebuiPoliciesXml{} + if _, ok := o.Misc["RoleVsysWebuiPolicies"]; ok { + nestedRole.Vsys.Webui.Policies.Misc = o.Misc["RoleVsysWebuiPolicies"] + } + if o.Role.Vsys.Webui.Policies.AuthenticationRulebase != nil { + nestedRole.Vsys.Webui.Policies.AuthenticationRulebase = o.Role.Vsys.Webui.Policies.AuthenticationRulebase + } + if o.Role.Vsys.Webui.Policies.DosRulebase != nil { + nestedRole.Vsys.Webui.Policies.DosRulebase = o.Role.Vsys.Webui.Policies.DosRulebase + } + if o.Role.Vsys.Webui.Policies.NatRulebase != nil { + nestedRole.Vsys.Webui.Policies.NatRulebase = o.Role.Vsys.Webui.Policies.NatRulebase + } + if o.Role.Vsys.Webui.Policies.NetworkPacketBrokerRulebase != nil { + nestedRole.Vsys.Webui.Policies.NetworkPacketBrokerRulebase = o.Role.Vsys.Webui.Policies.NetworkPacketBrokerRulebase + } + if o.Role.Vsys.Webui.Policies.PbfRulebase != nil { + nestedRole.Vsys.Webui.Policies.PbfRulebase = o.Role.Vsys.Webui.Policies.PbfRulebase + } + if o.Role.Vsys.Webui.Policies.RuleHitCountReset != nil { + nestedRole.Vsys.Webui.Policies.RuleHitCountReset = o.Role.Vsys.Webui.Policies.RuleHitCountReset + } + if o.Role.Vsys.Webui.Policies.SdwanRulebase != nil { + nestedRole.Vsys.Webui.Policies.SdwanRulebase = o.Role.Vsys.Webui.Policies.SdwanRulebase + } + if o.Role.Vsys.Webui.Policies.SecurityRulebase != nil { + nestedRole.Vsys.Webui.Policies.SecurityRulebase = o.Role.Vsys.Webui.Policies.SecurityRulebase + } + if o.Role.Vsys.Webui.Policies.ApplicationOverrideRulebase != nil { + nestedRole.Vsys.Webui.Policies.ApplicationOverrideRulebase = o.Role.Vsys.Webui.Policies.ApplicationOverrideRulebase + } + if o.Role.Vsys.Webui.Policies.QosRulebase != nil { + nestedRole.Vsys.Webui.Policies.QosRulebase = o.Role.Vsys.Webui.Policies.QosRulebase + } + if o.Role.Vsys.Webui.Policies.SslDecryptionRulebase != nil { + nestedRole.Vsys.Webui.Policies.SslDecryptionRulebase = o.Role.Vsys.Webui.Policies.SslDecryptionRulebase + } + if o.Role.Vsys.Webui.Policies.TunnelInspectRulebase != nil { + nestedRole.Vsys.Webui.Policies.TunnelInspectRulebase = o.Role.Vsys.Webui.Policies.TunnelInspectRulebase + } + } + if o.Role.Vsys.Webui.Validate != nil { + nestedRole.Vsys.Webui.Validate = o.Role.Vsys.Webui.Validate + } + if o.Role.Vsys.Webui.Operations != nil { + nestedRole.Vsys.Webui.Operations = &RoleVsysWebuiOperationsXml{} + if _, ok := o.Misc["RoleVsysWebuiOperations"]; ok { + nestedRole.Vsys.Webui.Operations.Misc = o.Misc["RoleVsysWebuiOperations"] + } + if o.Role.Vsys.Webui.Operations.DownloadCoreFiles != nil { + nestedRole.Vsys.Webui.Operations.DownloadCoreFiles = o.Role.Vsys.Webui.Operations.DownloadCoreFiles + } + if o.Role.Vsys.Webui.Operations.DownloadPcapFiles != nil { + nestedRole.Vsys.Webui.Operations.DownloadPcapFiles = o.Role.Vsys.Webui.Operations.DownloadPcapFiles + } + if o.Role.Vsys.Webui.Operations.GenerateStatsDumpFile != nil { + nestedRole.Vsys.Webui.Operations.GenerateStatsDumpFile = o.Role.Vsys.Webui.Operations.GenerateStatsDumpFile + } + if o.Role.Vsys.Webui.Operations.GenerateTechSupportFile != nil { + nestedRole.Vsys.Webui.Operations.GenerateTechSupportFile = o.Role.Vsys.Webui.Operations.GenerateTechSupportFile + } + if o.Role.Vsys.Webui.Operations.Reboot != nil { + nestedRole.Vsys.Webui.Operations.Reboot = o.Role.Vsys.Webui.Operations.Reboot + } + } + if o.Role.Vsys.Webui.Privacy != nil { + nestedRole.Vsys.Webui.Privacy = &RoleVsysWebuiPrivacyXml{} + if _, ok := o.Misc["RoleVsysWebuiPrivacy"]; ok { + nestedRole.Vsys.Webui.Privacy.Misc = o.Misc["RoleVsysWebuiPrivacy"] + } + if o.Role.Vsys.Webui.Privacy.ShowFullIpAddresses != nil { + nestedRole.Vsys.Webui.Privacy.ShowFullIpAddresses = o.Role.Vsys.Webui.Privacy.ShowFullIpAddresses + } + if o.Role.Vsys.Webui.Privacy.ShowUserNamesInLogsAndReports != nil { + nestedRole.Vsys.Webui.Privacy.ShowUserNamesInLogsAndReports = o.Role.Vsys.Webui.Privacy.ShowUserNamesInLogsAndReports + } + if o.Role.Vsys.Webui.Privacy.ViewPcapFiles != nil { + nestedRole.Vsys.Webui.Privacy.ViewPcapFiles = o.Role.Vsys.Webui.Privacy.ViewPcapFiles + } + } + if o.Role.Vsys.Webui.Save != nil { + nestedRole.Vsys.Webui.Save = &RoleVsysWebuiSaveXml{} + if _, ok := o.Misc["RoleVsysWebuiSave"]; ok { + nestedRole.Vsys.Webui.Save.Misc = o.Misc["RoleVsysWebuiSave"] + } + if o.Role.Vsys.Webui.Save.PartialSave != nil { + nestedRole.Vsys.Webui.Save.PartialSave = o.Role.Vsys.Webui.Save.PartialSave + } + if o.Role.Vsys.Webui.Save.SaveForOtherAdmins != nil { + nestedRole.Vsys.Webui.Save.SaveForOtherAdmins = o.Role.Vsys.Webui.Save.SaveForOtherAdmins + } + if o.Role.Vsys.Webui.Save.ObjectLevelChanges != nil { + nestedRole.Vsys.Webui.Save.ObjectLevelChanges = o.Role.Vsys.Webui.Save.ObjectLevelChanges + } + } + if o.Role.Vsys.Webui.Commit != nil { + nestedRole.Vsys.Webui.Commit = &RoleVsysWebuiCommitXml{} + if _, ok := o.Misc["RoleVsysWebuiCommit"]; ok { + nestedRole.Vsys.Webui.Commit.Misc = o.Misc["RoleVsysWebuiCommit"] + } + if o.Role.Vsys.Webui.Commit.CommitForOtherAdmins != nil { + nestedRole.Vsys.Webui.Commit.CommitForOtherAdmins = o.Role.Vsys.Webui.Commit.CommitForOtherAdmins + } + if o.Role.Vsys.Webui.Commit.VirtualSystems != nil { + nestedRole.Vsys.Webui.Commit.VirtualSystems = o.Role.Vsys.Webui.Commit.VirtualSystems + } + } + if o.Role.Vsys.Webui.Device != nil { + nestedRole.Vsys.Webui.Device = &RoleVsysWebuiDeviceXml{} + if _, ok := o.Misc["RoleVsysWebuiDevice"]; ok { + nestedRole.Vsys.Webui.Device.Misc = o.Misc["RoleVsysWebuiDevice"] + } + if o.Role.Vsys.Webui.Device.CertificateManagement != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement = &RoleVsysWebuiDeviceCertificateManagementXml{} + if _, ok := o.Misc["RoleVsysWebuiDeviceCertificateManagement"]; ok { + nestedRole.Vsys.Webui.Device.CertificateManagement.Misc = o.Misc["RoleVsysWebuiDeviceCertificateManagement"] + } + if o.Role.Vsys.Webui.Device.CertificateManagement.SslTlsServiceProfile != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement.SslTlsServiceProfile = o.Role.Vsys.Webui.Device.CertificateManagement.SslTlsServiceProfile + } + if o.Role.Vsys.Webui.Device.CertificateManagement.CertificateProfile != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement.CertificateProfile = o.Role.Vsys.Webui.Device.CertificateManagement.CertificateProfile + } + if o.Role.Vsys.Webui.Device.CertificateManagement.Certificates != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement.Certificates = o.Role.Vsys.Webui.Device.CertificateManagement.Certificates + } + if o.Role.Vsys.Webui.Device.CertificateManagement.OcspResponder != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement.OcspResponder = o.Role.Vsys.Webui.Device.CertificateManagement.OcspResponder + } + if o.Role.Vsys.Webui.Device.CertificateManagement.Scep != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement.Scep = o.Role.Vsys.Webui.Device.CertificateManagement.Scep + } + if o.Role.Vsys.Webui.Device.CertificateManagement.SshServiceProfile != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement.SshServiceProfile = o.Role.Vsys.Webui.Device.CertificateManagement.SshServiceProfile + } + if o.Role.Vsys.Webui.Device.CertificateManagement.SslDecryptionExclusion != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement.SslDecryptionExclusion = o.Role.Vsys.Webui.Device.CertificateManagement.SslDecryptionExclusion + } + } + if o.Role.Vsys.Webui.Device.DataRedistribution != nil { + nestedRole.Vsys.Webui.Device.DataRedistribution = o.Role.Vsys.Webui.Device.DataRedistribution + } + if o.Role.Vsys.Webui.Device.LocalUserDatabase != nil { + nestedRole.Vsys.Webui.Device.LocalUserDatabase = &RoleVsysWebuiDeviceLocalUserDatabaseXml{} + if _, ok := o.Misc["RoleVsysWebuiDeviceLocalUserDatabase"]; ok { + nestedRole.Vsys.Webui.Device.LocalUserDatabase.Misc = o.Misc["RoleVsysWebuiDeviceLocalUserDatabase"] + } + if o.Role.Vsys.Webui.Device.LocalUserDatabase.Users != nil { + nestedRole.Vsys.Webui.Device.LocalUserDatabase.Users = o.Role.Vsys.Webui.Device.LocalUserDatabase.Users + } + if o.Role.Vsys.Webui.Device.LocalUserDatabase.UserGroups != nil { + nestedRole.Vsys.Webui.Device.LocalUserDatabase.UserGroups = o.Role.Vsys.Webui.Device.LocalUserDatabase.UserGroups + } + } + if o.Role.Vsys.Webui.Device.LogSettings != nil { + nestedRole.Vsys.Webui.Device.LogSettings = &RoleVsysWebuiDeviceLogSettingsXml{} + if _, ok := o.Misc["RoleVsysWebuiDeviceLogSettings"]; ok { + nestedRole.Vsys.Webui.Device.LogSettings.Misc = o.Misc["RoleVsysWebuiDeviceLogSettings"] + } + if o.Role.Vsys.Webui.Device.LogSettings.UserId != nil { + nestedRole.Vsys.Webui.Device.LogSettings.UserId = o.Role.Vsys.Webui.Device.LogSettings.UserId + } + if o.Role.Vsys.Webui.Device.LogSettings.Config != nil { + nestedRole.Vsys.Webui.Device.LogSettings.Config = o.Role.Vsys.Webui.Device.LogSettings.Config + } + if o.Role.Vsys.Webui.Device.LogSettings.Correlation != nil { + nestedRole.Vsys.Webui.Device.LogSettings.Correlation = o.Role.Vsys.Webui.Device.LogSettings.Correlation + } + if o.Role.Vsys.Webui.Device.LogSettings.Globalprotect != nil { + nestedRole.Vsys.Webui.Device.LogSettings.Globalprotect = o.Role.Vsys.Webui.Device.LogSettings.Globalprotect + } + if o.Role.Vsys.Webui.Device.LogSettings.Hipmatch != nil { + nestedRole.Vsys.Webui.Device.LogSettings.Hipmatch = o.Role.Vsys.Webui.Device.LogSettings.Hipmatch + } + if o.Role.Vsys.Webui.Device.LogSettings.Iptag != nil { + nestedRole.Vsys.Webui.Device.LogSettings.Iptag = o.Role.Vsys.Webui.Device.LogSettings.Iptag + } + if o.Role.Vsys.Webui.Device.LogSettings.System != nil { + nestedRole.Vsys.Webui.Device.LogSettings.System = o.Role.Vsys.Webui.Device.LogSettings.System + } + } + if o.Role.Vsys.Webui.Device.ServerProfile != nil { + nestedRole.Vsys.Webui.Device.ServerProfile = &RoleVsysWebuiDeviceServerProfileXml{} + if _, ok := o.Misc["RoleVsysWebuiDeviceServerProfile"]; ok { + nestedRole.Vsys.Webui.Device.ServerProfile.Misc = o.Misc["RoleVsysWebuiDeviceServerProfile"] + } + if o.Role.Vsys.Webui.Device.ServerProfile.Dns != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Dns = o.Role.Vsys.Webui.Device.ServerProfile.Dns + } + if o.Role.Vsys.Webui.Device.ServerProfile.Http != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Http = o.Role.Vsys.Webui.Device.ServerProfile.Http + } + if o.Role.Vsys.Webui.Device.ServerProfile.Netflow != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Netflow = o.Role.Vsys.Webui.Device.ServerProfile.Netflow + } + if o.Role.Vsys.Webui.Device.ServerProfile.SamlIdp != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.SamlIdp = o.Role.Vsys.Webui.Device.ServerProfile.SamlIdp + } + if o.Role.Vsys.Webui.Device.ServerProfile.SnmpTrap != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.SnmpTrap = o.Role.Vsys.Webui.Device.ServerProfile.SnmpTrap + } + if o.Role.Vsys.Webui.Device.ServerProfile.Tacplus != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Tacplus = o.Role.Vsys.Webui.Device.ServerProfile.Tacplus + } + if o.Role.Vsys.Webui.Device.ServerProfile.Syslog != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Syslog = o.Role.Vsys.Webui.Device.ServerProfile.Syslog + } + if o.Role.Vsys.Webui.Device.ServerProfile.Email != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Email = o.Role.Vsys.Webui.Device.ServerProfile.Email + } + if o.Role.Vsys.Webui.Device.ServerProfile.Kerberos != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Kerberos = o.Role.Vsys.Webui.Device.ServerProfile.Kerberos + } + if o.Role.Vsys.Webui.Device.ServerProfile.Ldap != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Ldap = o.Role.Vsys.Webui.Device.ServerProfile.Ldap + } + if o.Role.Vsys.Webui.Device.ServerProfile.Mfa != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Mfa = o.Role.Vsys.Webui.Device.ServerProfile.Mfa + } + if o.Role.Vsys.Webui.Device.ServerProfile.Radius != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Radius = o.Role.Vsys.Webui.Device.ServerProfile.Radius + } + if o.Role.Vsys.Webui.Device.ServerProfile.Scp != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Scp = o.Role.Vsys.Webui.Device.ServerProfile.Scp + } + } + if o.Role.Vsys.Webui.Device.Administrators != nil { + nestedRole.Vsys.Webui.Device.Administrators = o.Role.Vsys.Webui.Device.Administrators + } + if o.Role.Vsys.Webui.Device.AuthenticationSequence != nil { + nestedRole.Vsys.Webui.Device.AuthenticationSequence = o.Role.Vsys.Webui.Device.AuthenticationSequence + } + if o.Role.Vsys.Webui.Device.BlockPages != nil { + nestedRole.Vsys.Webui.Device.BlockPages = o.Role.Vsys.Webui.Device.BlockPages + } + if o.Role.Vsys.Webui.Device.UserIdentification != nil { + nestedRole.Vsys.Webui.Device.UserIdentification = o.Role.Vsys.Webui.Device.UserIdentification + } + if o.Role.Vsys.Webui.Device.DeviceQuarantine != nil { + nestedRole.Vsys.Webui.Device.DeviceQuarantine = o.Role.Vsys.Webui.Device.DeviceQuarantine + } + if o.Role.Vsys.Webui.Device.PolicyRecommendations != nil { + nestedRole.Vsys.Webui.Device.PolicyRecommendations = &RoleVsysWebuiDevicePolicyRecommendationsXml{} + if _, ok := o.Misc["RoleVsysWebuiDevicePolicyRecommendations"]; ok { + nestedRole.Vsys.Webui.Device.PolicyRecommendations.Misc = o.Misc["RoleVsysWebuiDevicePolicyRecommendations"] + } + if o.Role.Vsys.Webui.Device.PolicyRecommendations.Iot != nil { + nestedRole.Vsys.Webui.Device.PolicyRecommendations.Iot = o.Role.Vsys.Webui.Device.PolicyRecommendations.Iot + } + if o.Role.Vsys.Webui.Device.PolicyRecommendations.Saas != nil { + nestedRole.Vsys.Webui.Device.PolicyRecommendations.Saas = o.Role.Vsys.Webui.Device.PolicyRecommendations.Saas + } + } + if o.Role.Vsys.Webui.Device.DhcpSyslogServer != nil { + nestedRole.Vsys.Webui.Device.DhcpSyslogServer = o.Role.Vsys.Webui.Device.DhcpSyslogServer + } + if o.Role.Vsys.Webui.Device.VmInfoSource != nil { + nestedRole.Vsys.Webui.Device.VmInfoSource = o.Role.Vsys.Webui.Device.VmInfoSource + } + if o.Role.Vsys.Webui.Device.AuthenticationProfile != nil { + nestedRole.Vsys.Webui.Device.AuthenticationProfile = o.Role.Vsys.Webui.Device.AuthenticationProfile + } + if o.Role.Vsys.Webui.Device.Setup != nil { + nestedRole.Vsys.Webui.Device.Setup = &RoleVsysWebuiDeviceSetupXml{} + if _, ok := o.Misc["RoleVsysWebuiDeviceSetup"]; ok { + nestedRole.Vsys.Webui.Device.Setup.Misc = o.Misc["RoleVsysWebuiDeviceSetup"] + } + if o.Role.Vsys.Webui.Device.Setup.Session != nil { + nestedRole.Vsys.Webui.Device.Setup.Session = o.Role.Vsys.Webui.Device.Setup.Session + } + if o.Role.Vsys.Webui.Device.Setup.Telemetry != nil { + nestedRole.Vsys.Webui.Device.Setup.Telemetry = o.Role.Vsys.Webui.Device.Setup.Telemetry + } + if o.Role.Vsys.Webui.Device.Setup.Wildfire != nil { + nestedRole.Vsys.Webui.Device.Setup.Wildfire = o.Role.Vsys.Webui.Device.Setup.Wildfire + } + if o.Role.Vsys.Webui.Device.Setup.ContentId != nil { + nestedRole.Vsys.Webui.Device.Setup.ContentId = o.Role.Vsys.Webui.Device.Setup.ContentId + } + if o.Role.Vsys.Webui.Device.Setup.Services != nil { + nestedRole.Vsys.Webui.Device.Setup.Services = o.Role.Vsys.Webui.Device.Setup.Services + } + if o.Role.Vsys.Webui.Device.Setup.Management != nil { + nestedRole.Vsys.Webui.Device.Setup.Management = o.Role.Vsys.Webui.Device.Setup.Management + } + if o.Role.Vsys.Webui.Device.Setup.Operations != nil { + nestedRole.Vsys.Webui.Device.Setup.Operations = o.Role.Vsys.Webui.Device.Setup.Operations + } + if o.Role.Vsys.Webui.Device.Setup.Hsm != nil { + nestedRole.Vsys.Webui.Device.Setup.Hsm = o.Role.Vsys.Webui.Device.Setup.Hsm + } + if o.Role.Vsys.Webui.Device.Setup.Interfaces != nil { + nestedRole.Vsys.Webui.Device.Setup.Interfaces = o.Role.Vsys.Webui.Device.Setup.Interfaces + } + } + if o.Role.Vsys.Webui.Device.Troubleshooting != nil { + nestedRole.Vsys.Webui.Device.Troubleshooting = o.Role.Vsys.Webui.Device.Troubleshooting + } + } + if o.Role.Vsys.Webui.Monitor != nil { + nestedRole.Vsys.Webui.Monitor = &RoleVsysWebuiMonitorXml{} + if _, ok := o.Misc["RoleVsysWebuiMonitor"]; ok { + nestedRole.Vsys.Webui.Monitor.Misc = o.Misc["RoleVsysWebuiMonitor"] + } + if o.Role.Vsys.Webui.Monitor.SessionBrowser != nil { + nestedRole.Vsys.Webui.Monitor.SessionBrowser = o.Role.Vsys.Webui.Monitor.SessionBrowser + } + if o.Role.Vsys.Webui.Monitor.ViewCustomReports != nil { + nestedRole.Vsys.Webui.Monitor.ViewCustomReports = o.Role.Vsys.Webui.Monitor.ViewCustomReports + } + if o.Role.Vsys.Webui.Monitor.Logs != nil { + nestedRole.Vsys.Webui.Monitor.Logs = &RoleVsysWebuiMonitorLogsXml{} + if _, ok := o.Misc["RoleVsysWebuiMonitorLogs"]; ok { + nestedRole.Vsys.Webui.Monitor.Logs.Misc = o.Misc["RoleVsysWebuiMonitorLogs"] + } + if o.Role.Vsys.Webui.Monitor.Logs.Authentication != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Authentication = o.Role.Vsys.Webui.Monitor.Logs.Authentication + } + if o.Role.Vsys.Webui.Monitor.Logs.DataFiltering != nil { + nestedRole.Vsys.Webui.Monitor.Logs.DataFiltering = o.Role.Vsys.Webui.Monitor.Logs.DataFiltering + } + if o.Role.Vsys.Webui.Monitor.Logs.Sctp != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Sctp = o.Role.Vsys.Webui.Monitor.Logs.Sctp + } + if o.Role.Vsys.Webui.Monitor.Logs.Threat != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Threat = o.Role.Vsys.Webui.Monitor.Logs.Threat + } + if o.Role.Vsys.Webui.Monitor.Logs.Url != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Url = o.Role.Vsys.Webui.Monitor.Logs.Url + } + if o.Role.Vsys.Webui.Monitor.Logs.Userid != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Userid = o.Role.Vsys.Webui.Monitor.Logs.Userid + } + if o.Role.Vsys.Webui.Monitor.Logs.Traffic != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Traffic = o.Role.Vsys.Webui.Monitor.Logs.Traffic + } + if o.Role.Vsys.Webui.Monitor.Logs.Decryption != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Decryption = o.Role.Vsys.Webui.Monitor.Logs.Decryption + } + if o.Role.Vsys.Webui.Monitor.Logs.Globalprotect != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Globalprotect = o.Role.Vsys.Webui.Monitor.Logs.Globalprotect + } + if o.Role.Vsys.Webui.Monitor.Logs.Gtp != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Gtp = o.Role.Vsys.Webui.Monitor.Logs.Gtp + } + if o.Role.Vsys.Webui.Monitor.Logs.Hipmatch != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Hipmatch = o.Role.Vsys.Webui.Monitor.Logs.Hipmatch + } + if o.Role.Vsys.Webui.Monitor.Logs.Iptag != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Iptag = o.Role.Vsys.Webui.Monitor.Logs.Iptag + } + if o.Role.Vsys.Webui.Monitor.Logs.Tunnel != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Tunnel = o.Role.Vsys.Webui.Monitor.Logs.Tunnel + } + if o.Role.Vsys.Webui.Monitor.Logs.Wildfire != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Wildfire = o.Role.Vsys.Webui.Monitor.Logs.Wildfire + } + } + if o.Role.Vsys.Webui.Monitor.PdfReports != nil { + nestedRole.Vsys.Webui.Monitor.PdfReports = &RoleVsysWebuiMonitorPdfReportsXml{} + if _, ok := o.Misc["RoleVsysWebuiMonitorPdfReports"]; ok { + nestedRole.Vsys.Webui.Monitor.PdfReports.Misc = o.Misc["RoleVsysWebuiMonitorPdfReports"] + } + if o.Role.Vsys.Webui.Monitor.PdfReports.UserActivityReport != nil { + nestedRole.Vsys.Webui.Monitor.PdfReports.UserActivityReport = o.Role.Vsys.Webui.Monitor.PdfReports.UserActivityReport + } + if o.Role.Vsys.Webui.Monitor.PdfReports.EmailScheduler != nil { + nestedRole.Vsys.Webui.Monitor.PdfReports.EmailScheduler = o.Role.Vsys.Webui.Monitor.PdfReports.EmailScheduler + } + if o.Role.Vsys.Webui.Monitor.PdfReports.ManagePdfSummary != nil { + nestedRole.Vsys.Webui.Monitor.PdfReports.ManagePdfSummary = o.Role.Vsys.Webui.Monitor.PdfReports.ManagePdfSummary + } + if o.Role.Vsys.Webui.Monitor.PdfReports.PdfSummaryReports != nil { + nestedRole.Vsys.Webui.Monitor.PdfReports.PdfSummaryReports = o.Role.Vsys.Webui.Monitor.PdfReports.PdfSummaryReports + } + if o.Role.Vsys.Webui.Monitor.PdfReports.ReportGroups != nil { + nestedRole.Vsys.Webui.Monitor.PdfReports.ReportGroups = o.Role.Vsys.Webui.Monitor.PdfReports.ReportGroups + } + if o.Role.Vsys.Webui.Monitor.PdfReports.SaasApplicationUsageReport != nil { + nestedRole.Vsys.Webui.Monitor.PdfReports.SaasApplicationUsageReport = o.Role.Vsys.Webui.Monitor.PdfReports.SaasApplicationUsageReport + } + } + if o.Role.Vsys.Webui.Monitor.AppScope != nil { + nestedRole.Vsys.Webui.Monitor.AppScope = o.Role.Vsys.Webui.Monitor.AppScope + } + if o.Role.Vsys.Webui.Monitor.AutomatedCorrelationEngine != nil { + nestedRole.Vsys.Webui.Monitor.AutomatedCorrelationEngine = &RoleVsysWebuiMonitorAutomatedCorrelationEngineXml{} + if _, ok := o.Misc["RoleVsysWebuiMonitorAutomatedCorrelationEngine"]; ok { + nestedRole.Vsys.Webui.Monitor.AutomatedCorrelationEngine.Misc = o.Misc["RoleVsysWebuiMonitorAutomatedCorrelationEngine"] + } + if o.Role.Vsys.Webui.Monitor.AutomatedCorrelationEngine.CorrelatedEvents != nil { + nestedRole.Vsys.Webui.Monitor.AutomatedCorrelationEngine.CorrelatedEvents = o.Role.Vsys.Webui.Monitor.AutomatedCorrelationEngine.CorrelatedEvents + } + if o.Role.Vsys.Webui.Monitor.AutomatedCorrelationEngine.CorrelationObjects != nil { + nestedRole.Vsys.Webui.Monitor.AutomatedCorrelationEngine.CorrelationObjects = o.Role.Vsys.Webui.Monitor.AutomatedCorrelationEngine.CorrelationObjects + } + } + if o.Role.Vsys.Webui.Monitor.BlockIpList != nil { + nestedRole.Vsys.Webui.Monitor.BlockIpList = o.Role.Vsys.Webui.Monitor.BlockIpList + } + if o.Role.Vsys.Webui.Monitor.CustomReports != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports = &RoleVsysWebuiMonitorCustomReportsXml{} + if _, ok := o.Misc["RoleVsysWebuiMonitorCustomReports"]; ok { + nestedRole.Vsys.Webui.Monitor.CustomReports.Misc = o.Misc["RoleVsysWebuiMonitorCustomReports"] + } + if o.Role.Vsys.Webui.Monitor.CustomReports.Auth != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.Auth = o.Role.Vsys.Webui.Monitor.CustomReports.Auth + } + if o.Role.Vsys.Webui.Monitor.CustomReports.DecryptionSummary != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.DecryptionSummary = o.Role.Vsys.Webui.Monitor.CustomReports.DecryptionSummary + } + if o.Role.Vsys.Webui.Monitor.CustomReports.ThreatSummary != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.ThreatSummary = o.Role.Vsys.Webui.Monitor.CustomReports.ThreatSummary + } + if o.Role.Vsys.Webui.Monitor.CustomReports.WildfireLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.WildfireLog = o.Role.Vsys.Webui.Monitor.CustomReports.WildfireLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.DecryptionLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.DecryptionLog = o.Role.Vsys.Webui.Monitor.CustomReports.DecryptionLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.GtpLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.GtpLog = o.Role.Vsys.Webui.Monitor.CustomReports.GtpLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.TrafficLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.TrafficLog = o.Role.Vsys.Webui.Monitor.CustomReports.TrafficLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.TunnelSummary != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.TunnelSummary = o.Role.Vsys.Webui.Monitor.CustomReports.TunnelSummary + } + if o.Role.Vsys.Webui.Monitor.CustomReports.DataFilteringLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.DataFilteringLog = o.Role.Vsys.Webui.Monitor.CustomReports.DataFilteringLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.GtpSummary != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.GtpSummary = o.Role.Vsys.Webui.Monitor.CustomReports.GtpSummary + } + if o.Role.Vsys.Webui.Monitor.CustomReports.SctpLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.SctpLog = o.Role.Vsys.Webui.Monitor.CustomReports.SctpLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.SctpSummary != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.SctpSummary = o.Role.Vsys.Webui.Monitor.CustomReports.SctpSummary + } + if o.Role.Vsys.Webui.Monitor.CustomReports.TrafficSummary != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.TrafficSummary = o.Role.Vsys.Webui.Monitor.CustomReports.TrafficSummary + } + if o.Role.Vsys.Webui.Monitor.CustomReports.TunnelLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.TunnelLog = o.Role.Vsys.Webui.Monitor.CustomReports.TunnelLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.UrlLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.UrlLog = o.Role.Vsys.Webui.Monitor.CustomReports.UrlLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.ApplicationStatistics != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.ApplicationStatistics = o.Role.Vsys.Webui.Monitor.CustomReports.ApplicationStatistics + } + if o.Role.Vsys.Webui.Monitor.CustomReports.Globalprotect != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.Globalprotect = o.Role.Vsys.Webui.Monitor.CustomReports.Globalprotect + } + if o.Role.Vsys.Webui.Monitor.CustomReports.Hipmatch != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.Hipmatch = o.Role.Vsys.Webui.Monitor.CustomReports.Hipmatch + } + if o.Role.Vsys.Webui.Monitor.CustomReports.Iptag != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.Iptag = o.Role.Vsys.Webui.Monitor.CustomReports.Iptag + } + if o.Role.Vsys.Webui.Monitor.CustomReports.ThreatLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.ThreatLog = o.Role.Vsys.Webui.Monitor.CustomReports.ThreatLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.UrlSummary != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.UrlSummary = o.Role.Vsys.Webui.Monitor.CustomReports.UrlSummary + } + if o.Role.Vsys.Webui.Monitor.CustomReports.Userid != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.Userid = o.Role.Vsys.Webui.Monitor.CustomReports.Userid + } + } + if o.Role.Vsys.Webui.Monitor.ExternalLogs != nil { + nestedRole.Vsys.Webui.Monitor.ExternalLogs = o.Role.Vsys.Webui.Monitor.ExternalLogs + } + } + if o.Role.Vsys.Webui.Network != nil { + nestedRole.Vsys.Webui.Network = &RoleVsysWebuiNetworkXml{} + if _, ok := o.Misc["RoleVsysWebuiNetwork"]; ok { + nestedRole.Vsys.Webui.Network.Misc = o.Misc["RoleVsysWebuiNetwork"] + } + if o.Role.Vsys.Webui.Network.Zones != nil { + nestedRole.Vsys.Webui.Network.Zones = o.Role.Vsys.Webui.Network.Zones + } + if o.Role.Vsys.Webui.Network.GlobalProtect != nil { + nestedRole.Vsys.Webui.Network.GlobalProtect = &RoleVsysWebuiNetworkGlobalProtectXml{} + if _, ok := o.Misc["RoleVsysWebuiNetworkGlobalProtect"]; ok { + nestedRole.Vsys.Webui.Network.GlobalProtect.Misc = o.Misc["RoleVsysWebuiNetworkGlobalProtect"] + } + if o.Role.Vsys.Webui.Network.GlobalProtect.ClientlessAppGroups != nil { + nestedRole.Vsys.Webui.Network.GlobalProtect.ClientlessAppGroups = o.Role.Vsys.Webui.Network.GlobalProtect.ClientlessAppGroups + } + if o.Role.Vsys.Webui.Network.GlobalProtect.ClientlessApps != nil { + nestedRole.Vsys.Webui.Network.GlobalProtect.ClientlessApps = o.Role.Vsys.Webui.Network.GlobalProtect.ClientlessApps + } + if o.Role.Vsys.Webui.Network.GlobalProtect.Gateways != nil { + nestedRole.Vsys.Webui.Network.GlobalProtect.Gateways = o.Role.Vsys.Webui.Network.GlobalProtect.Gateways + } + if o.Role.Vsys.Webui.Network.GlobalProtect.Mdm != nil { + nestedRole.Vsys.Webui.Network.GlobalProtect.Mdm = o.Role.Vsys.Webui.Network.GlobalProtect.Mdm + } + if o.Role.Vsys.Webui.Network.GlobalProtect.Portals != nil { + nestedRole.Vsys.Webui.Network.GlobalProtect.Portals = o.Role.Vsys.Webui.Network.GlobalProtect.Portals + } + } + if o.Role.Vsys.Webui.Network.SdwanInterfaceProfile != nil { + nestedRole.Vsys.Webui.Network.SdwanInterfaceProfile = o.Role.Vsys.Webui.Network.SdwanInterfaceProfile + } + } + if o.Role.Vsys.Webui.Objects != nil { + nestedRole.Vsys.Webui.Objects = &RoleVsysWebuiObjectsXml{} + if _, ok := o.Misc["RoleVsysWebuiObjects"]; ok { + nestedRole.Vsys.Webui.Objects.Misc = o.Misc["RoleVsysWebuiObjects"] + } + if o.Role.Vsys.Webui.Objects.Sdwan != nil { + nestedRole.Vsys.Webui.Objects.Sdwan = &RoleVsysWebuiObjectsSdwanXml{} + if _, ok := o.Misc["RoleVsysWebuiObjectsSdwan"]; ok { + nestedRole.Vsys.Webui.Objects.Sdwan.Misc = o.Misc["RoleVsysWebuiObjectsSdwan"] + } + if o.Role.Vsys.Webui.Objects.Sdwan.SdwanDistProfile != nil { + nestedRole.Vsys.Webui.Objects.Sdwan.SdwanDistProfile = o.Role.Vsys.Webui.Objects.Sdwan.SdwanDistProfile + } + if o.Role.Vsys.Webui.Objects.Sdwan.SdwanErrorCorrectionProfile != nil { + nestedRole.Vsys.Webui.Objects.Sdwan.SdwanErrorCorrectionProfile = o.Role.Vsys.Webui.Objects.Sdwan.SdwanErrorCorrectionProfile + } + if o.Role.Vsys.Webui.Objects.Sdwan.SdwanProfile != nil { + nestedRole.Vsys.Webui.Objects.Sdwan.SdwanProfile = o.Role.Vsys.Webui.Objects.Sdwan.SdwanProfile + } + if o.Role.Vsys.Webui.Objects.Sdwan.SdwanSaasQualityProfile != nil { + nestedRole.Vsys.Webui.Objects.Sdwan.SdwanSaasQualityProfile = o.Role.Vsys.Webui.Objects.Sdwan.SdwanSaasQualityProfile + } + } + if o.Role.Vsys.Webui.Objects.DynamicBlockLists != nil { + nestedRole.Vsys.Webui.Objects.DynamicBlockLists = o.Role.Vsys.Webui.Objects.DynamicBlockLists + } + if o.Role.Vsys.Webui.Objects.DynamicUserGroups != nil { + nestedRole.Vsys.Webui.Objects.DynamicUserGroups = o.Role.Vsys.Webui.Objects.DynamicUserGroups + } + if o.Role.Vsys.Webui.Objects.PacketBrokerProfile != nil { + nestedRole.Vsys.Webui.Objects.PacketBrokerProfile = o.Role.Vsys.Webui.Objects.PacketBrokerProfile + } + if o.Role.Vsys.Webui.Objects.GlobalProtect != nil { + nestedRole.Vsys.Webui.Objects.GlobalProtect = &RoleVsysWebuiObjectsGlobalProtectXml{} + if _, ok := o.Misc["RoleVsysWebuiObjectsGlobalProtect"]; ok { + nestedRole.Vsys.Webui.Objects.GlobalProtect.Misc = o.Misc["RoleVsysWebuiObjectsGlobalProtect"] + } + if o.Role.Vsys.Webui.Objects.GlobalProtect.HipObjects != nil { + nestedRole.Vsys.Webui.Objects.GlobalProtect.HipObjects = o.Role.Vsys.Webui.Objects.GlobalProtect.HipObjects + } + if o.Role.Vsys.Webui.Objects.GlobalProtect.HipProfiles != nil { + nestedRole.Vsys.Webui.Objects.GlobalProtect.HipProfiles = o.Role.Vsys.Webui.Objects.GlobalProtect.HipProfiles + } + } + if o.Role.Vsys.Webui.Objects.Schedules != nil { + nestedRole.Vsys.Webui.Objects.Schedules = o.Role.Vsys.Webui.Objects.Schedules + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles = &RoleVsysWebuiObjectsSecurityProfilesXml{} + if _, ok := o.Misc["RoleVsysWebuiObjectsSecurityProfiles"]; ok { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.Misc = o.Misc["RoleVsysWebuiObjectsSecurityProfiles"] + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.AntiSpyware != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.AntiSpyware = o.Role.Vsys.Webui.Objects.SecurityProfiles.AntiSpyware + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.Antivirus != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.Antivirus = o.Role.Vsys.Webui.Objects.SecurityProfiles.Antivirus + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.DataFiltering != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.DataFiltering = o.Role.Vsys.Webui.Objects.SecurityProfiles.DataFiltering + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.SctpProtection != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.SctpProtection = o.Role.Vsys.Webui.Objects.SecurityProfiles.SctpProtection + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.WildfireAnalysis != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.WildfireAnalysis = o.Role.Vsys.Webui.Objects.SecurityProfiles.WildfireAnalysis + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.DosProtection != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.DosProtection = o.Role.Vsys.Webui.Objects.SecurityProfiles.DosProtection + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.FileBlocking != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.FileBlocking = o.Role.Vsys.Webui.Objects.SecurityProfiles.FileBlocking + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.GtpProtection != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.GtpProtection = o.Role.Vsys.Webui.Objects.SecurityProfiles.GtpProtection + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.UrlFiltering != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.UrlFiltering = o.Role.Vsys.Webui.Objects.SecurityProfiles.UrlFiltering + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.VulnerabilityProtection != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.VulnerabilityProtection = o.Role.Vsys.Webui.Objects.SecurityProfiles.VulnerabilityProtection + } + } + if o.Role.Vsys.Webui.Objects.ServiceGroups != nil { + nestedRole.Vsys.Webui.Objects.ServiceGroups = o.Role.Vsys.Webui.Objects.ServiceGroups + } + if o.Role.Vsys.Webui.Objects.Addresses != nil { + nestedRole.Vsys.Webui.Objects.Addresses = o.Role.Vsys.Webui.Objects.Addresses + } + if o.Role.Vsys.Webui.Objects.Decryption != nil { + nestedRole.Vsys.Webui.Objects.Decryption = &RoleVsysWebuiObjectsDecryptionXml{} + if _, ok := o.Misc["RoleVsysWebuiObjectsDecryption"]; ok { + nestedRole.Vsys.Webui.Objects.Decryption.Misc = o.Misc["RoleVsysWebuiObjectsDecryption"] + } + if o.Role.Vsys.Webui.Objects.Decryption.DecryptionProfile != nil { + nestedRole.Vsys.Webui.Objects.Decryption.DecryptionProfile = o.Role.Vsys.Webui.Objects.Decryption.DecryptionProfile + } + } + if o.Role.Vsys.Webui.Objects.Devices != nil { + nestedRole.Vsys.Webui.Objects.Devices = o.Role.Vsys.Webui.Objects.Devices + } + if o.Role.Vsys.Webui.Objects.Authentication != nil { + nestedRole.Vsys.Webui.Objects.Authentication = o.Role.Vsys.Webui.Objects.Authentication + } + if o.Role.Vsys.Webui.Objects.Regions != nil { + nestedRole.Vsys.Webui.Objects.Regions = o.Role.Vsys.Webui.Objects.Regions + } + if o.Role.Vsys.Webui.Objects.Tags != nil { + nestedRole.Vsys.Webui.Objects.Tags = o.Role.Vsys.Webui.Objects.Tags + } + if o.Role.Vsys.Webui.Objects.AddressGroups != nil { + nestedRole.Vsys.Webui.Objects.AddressGroups = o.Role.Vsys.Webui.Objects.AddressGroups + } + if o.Role.Vsys.Webui.Objects.ApplicationGroups != nil { + nestedRole.Vsys.Webui.Objects.ApplicationGroups = o.Role.Vsys.Webui.Objects.ApplicationGroups + } + if o.Role.Vsys.Webui.Objects.Applications != nil { + nestedRole.Vsys.Webui.Objects.Applications = o.Role.Vsys.Webui.Objects.Applications + } + if o.Role.Vsys.Webui.Objects.SecurityProfileGroups != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfileGroups = o.Role.Vsys.Webui.Objects.SecurityProfileGroups + } + if o.Role.Vsys.Webui.Objects.Services != nil { + nestedRole.Vsys.Webui.Objects.Services = o.Role.Vsys.Webui.Objects.Services + } + if o.Role.Vsys.Webui.Objects.ApplicationFilters != nil { + nestedRole.Vsys.Webui.Objects.ApplicationFilters = o.Role.Vsys.Webui.Objects.ApplicationFilters + } + if o.Role.Vsys.Webui.Objects.CustomObjects != nil { + nestedRole.Vsys.Webui.Objects.CustomObjects = &RoleVsysWebuiObjectsCustomObjectsXml{} + if _, ok := o.Misc["RoleVsysWebuiObjectsCustomObjects"]; ok { + nestedRole.Vsys.Webui.Objects.CustomObjects.Misc = o.Misc["RoleVsysWebuiObjectsCustomObjects"] + } + if o.Role.Vsys.Webui.Objects.CustomObjects.Vulnerability != nil { + nestedRole.Vsys.Webui.Objects.CustomObjects.Vulnerability = o.Role.Vsys.Webui.Objects.CustomObjects.Vulnerability + } + if o.Role.Vsys.Webui.Objects.CustomObjects.DataPatterns != nil { + nestedRole.Vsys.Webui.Objects.CustomObjects.DataPatterns = o.Role.Vsys.Webui.Objects.CustomObjects.DataPatterns + } + if o.Role.Vsys.Webui.Objects.CustomObjects.Spyware != nil { + nestedRole.Vsys.Webui.Objects.CustomObjects.Spyware = o.Role.Vsys.Webui.Objects.CustomObjects.Spyware + } + if o.Role.Vsys.Webui.Objects.CustomObjects.UrlCategory != nil { + nestedRole.Vsys.Webui.Objects.CustomObjects.UrlCategory = o.Role.Vsys.Webui.Objects.CustomObjects.UrlCategory + } + } + if o.Role.Vsys.Webui.Objects.LogForwarding != nil { + nestedRole.Vsys.Webui.Objects.LogForwarding = o.Role.Vsys.Webui.Objects.LogForwarding + } + } + if o.Role.Vsys.Webui.Tasks != nil { + nestedRole.Vsys.Webui.Tasks = o.Role.Vsys.Webui.Tasks + } + } + } + } + entry.Role = nestedRole + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.Description = o.Description + var nestedRole *Role + if o.Role != nil { + nestedRole = &Role{} + if o.Role.Misc != nil { + entry.Misc["Role"] = o.Role.Misc + } + if o.Role.Device != nil { + nestedRole.Device = &RoleDevice{} + if o.Role.Device.Misc != nil { + entry.Misc["RoleDevice"] = o.Role.Device.Misc + } + if o.Role.Device.Cli != nil { + nestedRole.Device.Cli = o.Role.Device.Cli + } + if o.Role.Device.Restapi != nil { + nestedRole.Device.Restapi = &RoleDeviceRestapi{} + if o.Role.Device.Restapi.Misc != nil { + entry.Misc["RoleDeviceRestapi"] = o.Role.Device.Restapi.Misc + } + if o.Role.Device.Restapi.System != nil { + nestedRole.Device.Restapi.System = &RoleDeviceRestapiSystem{} + if o.Role.Device.Restapi.System.Misc != nil { + entry.Misc["RoleDeviceRestapiSystem"] = o.Role.Device.Restapi.System.Misc + } + if o.Role.Device.Restapi.System.Configuration != nil { + nestedRole.Device.Restapi.System.Configuration = o.Role.Device.Restapi.System.Configuration + } + } + if o.Role.Device.Restapi.Device != nil { + nestedRole.Device.Restapi.Device = &RoleDeviceRestapiDevice{} + if o.Role.Device.Restapi.Device.Misc != nil { + entry.Misc["RoleDeviceRestapiDevice"] = o.Role.Device.Restapi.Device.Misc + } + if o.Role.Device.Restapi.Device.SyslogServerProfiles != nil { + nestedRole.Device.Restapi.Device.SyslogServerProfiles = o.Role.Device.Restapi.Device.SyslogServerProfiles + } + if o.Role.Device.Restapi.Device.VirtualSystems != nil { + nestedRole.Device.Restapi.Device.VirtualSystems = o.Role.Device.Restapi.Device.VirtualSystems + } + if o.Role.Device.Restapi.Device.EmailServerProfiles != nil { + nestedRole.Device.Restapi.Device.EmailServerProfiles = o.Role.Device.Restapi.Device.EmailServerProfiles + } + if o.Role.Device.Restapi.Device.HttpServerProfiles != nil { + nestedRole.Device.Restapi.Device.HttpServerProfiles = o.Role.Device.Restapi.Device.HttpServerProfiles + } + if o.Role.Device.Restapi.Device.LdapServerProfiles != nil { + nestedRole.Device.Restapi.Device.LdapServerProfiles = o.Role.Device.Restapi.Device.LdapServerProfiles + } + if o.Role.Device.Restapi.Device.LogInterfaceSetting != nil { + nestedRole.Device.Restapi.Device.LogInterfaceSetting = o.Role.Device.Restapi.Device.LogInterfaceSetting + } + if o.Role.Device.Restapi.Device.SnmpTrapServerProfiles != nil { + nestedRole.Device.Restapi.Device.SnmpTrapServerProfiles = o.Role.Device.Restapi.Device.SnmpTrapServerProfiles + } + } + if o.Role.Device.Restapi.Network != nil { + nestedRole.Device.Restapi.Network = &RoleDeviceRestapiNetwork{} + if o.Role.Device.Restapi.Network.Misc != nil { + entry.Misc["RoleDeviceRestapiNetwork"] = o.Role.Device.Restapi.Network.Misc + } + if o.Role.Device.Restapi.Network.BfdNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.BfdNetworkProfiles = o.Role.Device.Restapi.Network.BfdNetworkProfiles + } + if o.Role.Device.Restapi.Network.EthernetInterfaces != nil { + nestedRole.Device.Restapi.Network.EthernetInterfaces = o.Role.Device.Restapi.Network.EthernetInterfaces + } + if o.Role.Device.Restapi.Network.ZoneProtectionNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.ZoneProtectionNetworkProfiles = o.Role.Device.Restapi.Network.ZoneProtectionNetworkProfiles + } + if o.Role.Device.Restapi.Network.Zones != nil { + nestedRole.Device.Restapi.Network.Zones = o.Role.Device.Restapi.Network.Zones + } + if o.Role.Device.Restapi.Network.DhcpServers != nil { + nestedRole.Device.Restapi.Network.DhcpServers = o.Role.Device.Restapi.Network.DhcpServers + } + if o.Role.Device.Restapi.Network.LldpNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.LldpNetworkProfiles = o.Role.Device.Restapi.Network.LldpNetworkProfiles + } + if o.Role.Device.Restapi.Network.QosInterfaces != nil { + nestedRole.Device.Restapi.Network.QosInterfaces = o.Role.Device.Restapi.Network.QosInterfaces + } + if o.Role.Device.Restapi.Network.SdwanInterfaces != nil { + nestedRole.Device.Restapi.Network.SdwanInterfaces = o.Role.Device.Restapi.Network.SdwanInterfaces + } + if o.Role.Device.Restapi.Network.VirtualRouters != nil { + nestedRole.Device.Restapi.Network.VirtualRouters = o.Role.Device.Restapi.Network.VirtualRouters + } + if o.Role.Device.Restapi.Network.VlanInterfaces != nil { + nestedRole.Device.Restapi.Network.VlanInterfaces = o.Role.Device.Restapi.Network.VlanInterfaces + } + if o.Role.Device.Restapi.Network.Vlans != nil { + nestedRole.Device.Restapi.Network.Vlans = o.Role.Device.Restapi.Network.Vlans + } + if o.Role.Device.Restapi.Network.GlobalprotectIpsecCryptoNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.GlobalprotectIpsecCryptoNetworkProfiles = o.Role.Device.Restapi.Network.GlobalprotectIpsecCryptoNetworkProfiles + } + if o.Role.Device.Restapi.Network.IpsecTunnels != nil { + nestedRole.Device.Restapi.Network.IpsecTunnels = o.Role.Device.Restapi.Network.IpsecTunnels + } + if o.Role.Device.Restapi.Network.IkeGatewayNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.IkeGatewayNetworkProfiles = o.Role.Device.Restapi.Network.IkeGatewayNetworkProfiles + } + if o.Role.Device.Restapi.Network.IpsecCryptoNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.IpsecCryptoNetworkProfiles = o.Role.Device.Restapi.Network.IpsecCryptoNetworkProfiles + } + if o.Role.Device.Restapi.Network.Lldp != nil { + nestedRole.Device.Restapi.Network.Lldp = o.Role.Device.Restapi.Network.Lldp + } + if o.Role.Device.Restapi.Network.DnsProxies != nil { + nestedRole.Device.Restapi.Network.DnsProxies = o.Role.Device.Restapi.Network.DnsProxies + } + if o.Role.Device.Restapi.Network.GlobalprotectGateways != nil { + nestedRole.Device.Restapi.Network.GlobalprotectGateways = o.Role.Device.Restapi.Network.GlobalprotectGateways + } + if o.Role.Device.Restapi.Network.InterfaceManagementNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.InterfaceManagementNetworkProfiles = o.Role.Device.Restapi.Network.InterfaceManagementNetworkProfiles + } + if o.Role.Device.Restapi.Network.QosNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.QosNetworkProfiles = o.Role.Device.Restapi.Network.QosNetworkProfiles + } + if o.Role.Device.Restapi.Network.DhcpRelays != nil { + nestedRole.Device.Restapi.Network.DhcpRelays = o.Role.Device.Restapi.Network.DhcpRelays + } + if o.Role.Device.Restapi.Network.GlobalprotectMdmServers != nil { + nestedRole.Device.Restapi.Network.GlobalprotectMdmServers = o.Role.Device.Restapi.Network.GlobalprotectMdmServers + } + if o.Role.Device.Restapi.Network.VirtualWires != nil { + nestedRole.Device.Restapi.Network.VirtualWires = o.Role.Device.Restapi.Network.VirtualWires + } + if o.Role.Device.Restapi.Network.GlobalprotectClientlessAppGroups != nil { + nestedRole.Device.Restapi.Network.GlobalprotectClientlessAppGroups = o.Role.Device.Restapi.Network.GlobalprotectClientlessAppGroups + } + if o.Role.Device.Restapi.Network.TunnelInterfaces != nil { + nestedRole.Device.Restapi.Network.TunnelInterfaces = o.Role.Device.Restapi.Network.TunnelInterfaces + } + if o.Role.Device.Restapi.Network.GreTunnels != nil { + nestedRole.Device.Restapi.Network.GreTunnels = o.Role.Device.Restapi.Network.GreTunnels + } + if o.Role.Device.Restapi.Network.IkeCryptoNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.IkeCryptoNetworkProfiles = o.Role.Device.Restapi.Network.IkeCryptoNetworkProfiles + } + if o.Role.Device.Restapi.Network.LogicalRouters != nil { + nestedRole.Device.Restapi.Network.LogicalRouters = o.Role.Device.Restapi.Network.LogicalRouters + } + if o.Role.Device.Restapi.Network.LoopbackInterfaces != nil { + nestedRole.Device.Restapi.Network.LoopbackInterfaces = o.Role.Device.Restapi.Network.LoopbackInterfaces + } + if o.Role.Device.Restapi.Network.SdwanInterfaceProfiles != nil { + nestedRole.Device.Restapi.Network.SdwanInterfaceProfiles = o.Role.Device.Restapi.Network.SdwanInterfaceProfiles + } + if o.Role.Device.Restapi.Network.BgpRoutingProfiles != nil { + nestedRole.Device.Restapi.Network.BgpRoutingProfiles = o.Role.Device.Restapi.Network.BgpRoutingProfiles + } + if o.Role.Device.Restapi.Network.GlobalprotectClientlessApps != nil { + nestedRole.Device.Restapi.Network.GlobalprotectClientlessApps = o.Role.Device.Restapi.Network.GlobalprotectClientlessApps + } + if o.Role.Device.Restapi.Network.TunnelMonitorNetworkProfiles != nil { + nestedRole.Device.Restapi.Network.TunnelMonitorNetworkProfiles = o.Role.Device.Restapi.Network.TunnelMonitorNetworkProfiles + } + if o.Role.Device.Restapi.Network.AggregateEthernetInterfaces != nil { + nestedRole.Device.Restapi.Network.AggregateEthernetInterfaces = o.Role.Device.Restapi.Network.AggregateEthernetInterfaces + } + if o.Role.Device.Restapi.Network.GlobalprotectPortals != nil { + nestedRole.Device.Restapi.Network.GlobalprotectPortals = o.Role.Device.Restapi.Network.GlobalprotectPortals + } + } + if o.Role.Device.Restapi.Objects != nil { + nestedRole.Device.Restapi.Objects = &RoleDeviceRestapiObjects{} + if o.Role.Device.Restapi.Objects.Misc != nil { + entry.Misc["RoleDeviceRestapiObjects"] = o.Role.Device.Restapi.Objects.Misc + } + if o.Role.Device.Restapi.Objects.AddressGroups != nil { + nestedRole.Device.Restapi.Objects.AddressGroups = o.Role.Device.Restapi.Objects.AddressGroups + } + if o.Role.Device.Restapi.Objects.DataFilteringSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.DataFilteringSecurityProfiles = o.Role.Device.Restapi.Objects.DataFilteringSecurityProfiles + } + if o.Role.Device.Restapi.Objects.SdwanErrorCorrectionProfiles != nil { + nestedRole.Device.Restapi.Objects.SdwanErrorCorrectionProfiles = o.Role.Device.Restapi.Objects.SdwanErrorCorrectionProfiles + } + if o.Role.Device.Restapi.Objects.VulnerabilityProtectionSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.VulnerabilityProtectionSecurityProfiles = o.Role.Device.Restapi.Objects.VulnerabilityProtectionSecurityProfiles + } + if o.Role.Device.Restapi.Objects.ApplicationGroups != nil { + nestedRole.Device.Restapi.Objects.ApplicationGroups = o.Role.Device.Restapi.Objects.ApplicationGroups + } + if o.Role.Device.Restapi.Objects.FileBlockingSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.FileBlockingSecurityProfiles = o.Role.Device.Restapi.Objects.FileBlockingSecurityProfiles + } + if o.Role.Device.Restapi.Objects.GlobalprotectHipProfiles != nil { + nestedRole.Device.Restapi.Objects.GlobalprotectHipProfiles = o.Role.Device.Restapi.Objects.GlobalprotectHipProfiles + } + if o.Role.Device.Restapi.Objects.LogForwardingProfiles != nil { + nestedRole.Device.Restapi.Objects.LogForwardingProfiles = o.Role.Device.Restapi.Objects.LogForwardingProfiles + } + if o.Role.Device.Restapi.Objects.SctpProtectionSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.SctpProtectionSecurityProfiles = o.Role.Device.Restapi.Objects.SctpProtectionSecurityProfiles + } + if o.Role.Device.Restapi.Objects.WildfireAnalysisSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.WildfireAnalysisSecurityProfiles = o.Role.Device.Restapi.Objects.WildfireAnalysisSecurityProfiles + } + if o.Role.Device.Restapi.Objects.Applications != nil { + nestedRole.Device.Restapi.Objects.Applications = o.Role.Device.Restapi.Objects.Applications + } + if o.Role.Device.Restapi.Objects.CustomDataPatterns != nil { + nestedRole.Device.Restapi.Objects.CustomDataPatterns = o.Role.Device.Restapi.Objects.CustomDataPatterns + } + if o.Role.Device.Restapi.Objects.CustomVulnerabilitySignatures != nil { + nestedRole.Device.Restapi.Objects.CustomVulnerabilitySignatures = o.Role.Device.Restapi.Objects.CustomVulnerabilitySignatures + } + if o.Role.Device.Restapi.Objects.GtpProtectionSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.GtpProtectionSecurityProfiles = o.Role.Device.Restapi.Objects.GtpProtectionSecurityProfiles + } + if o.Role.Device.Restapi.Objects.SdwanSaasQualityProfiles != nil { + nestedRole.Device.Restapi.Objects.SdwanSaasQualityProfiles = o.Role.Device.Restapi.Objects.SdwanSaasQualityProfiles + } + if o.Role.Device.Restapi.Objects.SecurityProfileGroups != nil { + nestedRole.Device.Restapi.Objects.SecurityProfileGroups = o.Role.Device.Restapi.Objects.SecurityProfileGroups + } + if o.Role.Device.Restapi.Objects.AuthenticationEnforcements != nil { + nestedRole.Device.Restapi.Objects.AuthenticationEnforcements = o.Role.Device.Restapi.Objects.AuthenticationEnforcements + } + if o.Role.Device.Restapi.Objects.Schedules != nil { + nestedRole.Device.Restapi.Objects.Schedules = o.Role.Device.Restapi.Objects.Schedules + } + if o.Role.Device.Restapi.Objects.UrlFilteringSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.UrlFilteringSecurityProfiles = o.Role.Device.Restapi.Objects.UrlFilteringSecurityProfiles + } + if o.Role.Device.Restapi.Objects.GlobalprotectHipObjects != nil { + nestedRole.Device.Restapi.Objects.GlobalprotectHipObjects = o.Role.Device.Restapi.Objects.GlobalprotectHipObjects + } + if o.Role.Device.Restapi.Objects.PacketBrokerProfiles != nil { + nestedRole.Device.Restapi.Objects.PacketBrokerProfiles = o.Role.Device.Restapi.Objects.PacketBrokerProfiles + } + if o.Role.Device.Restapi.Objects.Regions != nil { + nestedRole.Device.Restapi.Objects.Regions = o.Role.Device.Restapi.Objects.Regions + } + if o.Role.Device.Restapi.Objects.Services != nil { + nestedRole.Device.Restapi.Objects.Services = o.Role.Device.Restapi.Objects.Services + } + if o.Role.Device.Restapi.Objects.ExternalDynamicLists != nil { + nestedRole.Device.Restapi.Objects.ExternalDynamicLists = o.Role.Device.Restapi.Objects.ExternalDynamicLists + } + if o.Role.Device.Restapi.Objects.ServiceGroups != nil { + nestedRole.Device.Restapi.Objects.ServiceGroups = o.Role.Device.Restapi.Objects.ServiceGroups + } + if o.Role.Device.Restapi.Objects.Addresses != nil { + nestedRole.Device.Restapi.Objects.Addresses = o.Role.Device.Restapi.Objects.Addresses + } + if o.Role.Device.Restapi.Objects.AntiSpywareSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.AntiSpywareSecurityProfiles = o.Role.Device.Restapi.Objects.AntiSpywareSecurityProfiles + } + if o.Role.Device.Restapi.Objects.AntivirusSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.AntivirusSecurityProfiles = o.Role.Device.Restapi.Objects.AntivirusSecurityProfiles + } + if o.Role.Device.Restapi.Objects.CustomSpywareSignatures != nil { + nestedRole.Device.Restapi.Objects.CustomSpywareSignatures = o.Role.Device.Restapi.Objects.CustomSpywareSignatures + } + if o.Role.Device.Restapi.Objects.DecryptionProfiles != nil { + nestedRole.Device.Restapi.Objects.DecryptionProfiles = o.Role.Device.Restapi.Objects.DecryptionProfiles + } + if o.Role.Device.Restapi.Objects.Devices != nil { + nestedRole.Device.Restapi.Objects.Devices = o.Role.Device.Restapi.Objects.Devices + } + if o.Role.Device.Restapi.Objects.Tags != nil { + nestedRole.Device.Restapi.Objects.Tags = o.Role.Device.Restapi.Objects.Tags + } + if o.Role.Device.Restapi.Objects.ApplicationFilters != nil { + nestedRole.Device.Restapi.Objects.ApplicationFilters = o.Role.Device.Restapi.Objects.ApplicationFilters + } + if o.Role.Device.Restapi.Objects.CustomUrlCategories != nil { + nestedRole.Device.Restapi.Objects.CustomUrlCategories = o.Role.Device.Restapi.Objects.CustomUrlCategories + } + if o.Role.Device.Restapi.Objects.DynamicUserGroups != nil { + nestedRole.Device.Restapi.Objects.DynamicUserGroups = o.Role.Device.Restapi.Objects.DynamicUserGroups + } + if o.Role.Device.Restapi.Objects.SdwanPathQualityProfiles != nil { + nestedRole.Device.Restapi.Objects.SdwanPathQualityProfiles = o.Role.Device.Restapi.Objects.SdwanPathQualityProfiles + } + if o.Role.Device.Restapi.Objects.SdwanTrafficDistributionProfiles != nil { + nestedRole.Device.Restapi.Objects.SdwanTrafficDistributionProfiles = o.Role.Device.Restapi.Objects.SdwanTrafficDistributionProfiles + } + if o.Role.Device.Restapi.Objects.DosProtectionSecurityProfiles != nil { + nestedRole.Device.Restapi.Objects.DosProtectionSecurityProfiles = o.Role.Device.Restapi.Objects.DosProtectionSecurityProfiles + } + } + if o.Role.Device.Restapi.Policies != nil { + nestedRole.Device.Restapi.Policies = &RoleDeviceRestapiPolicies{} + if o.Role.Device.Restapi.Policies.Misc != nil { + entry.Misc["RoleDeviceRestapiPolicies"] = o.Role.Device.Restapi.Policies.Misc + } + if o.Role.Device.Restapi.Policies.ApplicationOverrideRules != nil { + nestedRole.Device.Restapi.Policies.ApplicationOverrideRules = o.Role.Device.Restapi.Policies.ApplicationOverrideRules + } + if o.Role.Device.Restapi.Policies.AuthenticationRules != nil { + nestedRole.Device.Restapi.Policies.AuthenticationRules = o.Role.Device.Restapi.Policies.AuthenticationRules + } + if o.Role.Device.Restapi.Policies.NatRules != nil { + nestedRole.Device.Restapi.Policies.NatRules = o.Role.Device.Restapi.Policies.NatRules + } + if o.Role.Device.Restapi.Policies.PolicyBasedForwardingRules != nil { + nestedRole.Device.Restapi.Policies.PolicyBasedForwardingRules = o.Role.Device.Restapi.Policies.PolicyBasedForwardingRules + } + if o.Role.Device.Restapi.Policies.QosRules != nil { + nestedRole.Device.Restapi.Policies.QosRules = o.Role.Device.Restapi.Policies.QosRules + } + if o.Role.Device.Restapi.Policies.DecryptionRules != nil { + nestedRole.Device.Restapi.Policies.DecryptionRules = o.Role.Device.Restapi.Policies.DecryptionRules + } + if o.Role.Device.Restapi.Policies.DosRules != nil { + nestedRole.Device.Restapi.Policies.DosRules = o.Role.Device.Restapi.Policies.DosRules + } + if o.Role.Device.Restapi.Policies.NetworkPacketBrokerRules != nil { + nestedRole.Device.Restapi.Policies.NetworkPacketBrokerRules = o.Role.Device.Restapi.Policies.NetworkPacketBrokerRules + } + if o.Role.Device.Restapi.Policies.SdwanRules != nil { + nestedRole.Device.Restapi.Policies.SdwanRules = o.Role.Device.Restapi.Policies.SdwanRules + } + if o.Role.Device.Restapi.Policies.SecurityRules != nil { + nestedRole.Device.Restapi.Policies.SecurityRules = o.Role.Device.Restapi.Policies.SecurityRules + } + if o.Role.Device.Restapi.Policies.TunnelInspectionRules != nil { + nestedRole.Device.Restapi.Policies.TunnelInspectionRules = o.Role.Device.Restapi.Policies.TunnelInspectionRules + } + } + } + if o.Role.Device.Webui != nil { + nestedRole.Device.Webui = &RoleDeviceWebui{} + if o.Role.Device.Webui.Misc != nil { + entry.Misc["RoleDeviceWebui"] = o.Role.Device.Webui.Misc + } + if o.Role.Device.Webui.Dashboard != nil { + nestedRole.Device.Webui.Dashboard = o.Role.Device.Webui.Dashboard + } + if o.Role.Device.Webui.Network != nil { + nestedRole.Device.Webui.Network = &RoleDeviceWebuiNetwork{} + if o.Role.Device.Webui.Network.Misc != nil { + entry.Misc["RoleDeviceWebuiNetwork"] = o.Role.Device.Webui.Network.Misc + } + if o.Role.Device.Webui.Network.SecureWebGateway != nil { + nestedRole.Device.Webui.Network.SecureWebGateway = o.Role.Device.Webui.Network.SecureWebGateway + } + if o.Role.Device.Webui.Network.DnsProxy != nil { + nestedRole.Device.Webui.Network.DnsProxy = o.Role.Device.Webui.Network.DnsProxy + } + if o.Role.Device.Webui.Network.Interfaces != nil { + nestedRole.Device.Webui.Network.Interfaces = o.Role.Device.Webui.Network.Interfaces + } + if o.Role.Device.Webui.Network.Routing != nil { + nestedRole.Device.Webui.Network.Routing = &RoleDeviceWebuiNetworkRouting{} + if o.Role.Device.Webui.Network.Routing.Misc != nil { + entry.Misc["RoleDeviceWebuiNetworkRouting"] = o.Role.Device.Webui.Network.Routing.Misc + } + if o.Role.Device.Webui.Network.Routing.LogicalRouters != nil { + nestedRole.Device.Webui.Network.Routing.LogicalRouters = o.Role.Device.Webui.Network.Routing.LogicalRouters + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles = &RoleDeviceWebuiNetworkRoutingRoutingProfiles{} + if o.Role.Device.Webui.Network.Routing.RoutingProfiles.Misc != nil { + entry.Misc["RoleDeviceWebuiNetworkRoutingRoutingProfiles"] = o.Role.Device.Webui.Network.Routing.RoutingProfiles.Misc + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles.Ripv2 != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles.Ripv2 = o.Role.Device.Webui.Network.Routing.RoutingProfiles.Ripv2 + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles.Bfd != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles.Bfd = o.Role.Device.Webui.Network.Routing.RoutingProfiles.Bfd + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles.Bgp != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles.Bgp = o.Role.Device.Webui.Network.Routing.RoutingProfiles.Bgp + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles.Filters != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles.Filters = o.Role.Device.Webui.Network.Routing.RoutingProfiles.Filters + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles.Multicast != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles.Multicast = o.Role.Device.Webui.Network.Routing.RoutingProfiles.Multicast + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles.Ospf != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles.Ospf = o.Role.Device.Webui.Network.Routing.RoutingProfiles.Ospf + } + if o.Role.Device.Webui.Network.Routing.RoutingProfiles.Ospfv3 != nil { + nestedRole.Device.Webui.Network.Routing.RoutingProfiles.Ospfv3 = o.Role.Device.Webui.Network.Routing.RoutingProfiles.Ospfv3 + } + } + } + if o.Role.Device.Webui.Network.VirtualRouters != nil { + nestedRole.Device.Webui.Network.VirtualRouters = o.Role.Device.Webui.Network.VirtualRouters + } + if o.Role.Device.Webui.Network.VirtualWires != nil { + nestedRole.Device.Webui.Network.VirtualWires = o.Role.Device.Webui.Network.VirtualWires + } + if o.Role.Device.Webui.Network.GlobalProtect != nil { + nestedRole.Device.Webui.Network.GlobalProtect = &RoleDeviceWebuiNetworkGlobalProtect{} + if o.Role.Device.Webui.Network.GlobalProtect.Misc != nil { + entry.Misc["RoleDeviceWebuiNetworkGlobalProtect"] = o.Role.Device.Webui.Network.GlobalProtect.Misc + } + if o.Role.Device.Webui.Network.GlobalProtect.ClientlessAppGroups != nil { + nestedRole.Device.Webui.Network.GlobalProtect.ClientlessAppGroups = o.Role.Device.Webui.Network.GlobalProtect.ClientlessAppGroups + } + if o.Role.Device.Webui.Network.GlobalProtect.ClientlessApps != nil { + nestedRole.Device.Webui.Network.GlobalProtect.ClientlessApps = o.Role.Device.Webui.Network.GlobalProtect.ClientlessApps + } + if o.Role.Device.Webui.Network.GlobalProtect.Gateways != nil { + nestedRole.Device.Webui.Network.GlobalProtect.Gateways = o.Role.Device.Webui.Network.GlobalProtect.Gateways + } + if o.Role.Device.Webui.Network.GlobalProtect.Mdm != nil { + nestedRole.Device.Webui.Network.GlobalProtect.Mdm = o.Role.Device.Webui.Network.GlobalProtect.Mdm + } + if o.Role.Device.Webui.Network.GlobalProtect.Portals != nil { + nestedRole.Device.Webui.Network.GlobalProtect.Portals = o.Role.Device.Webui.Network.GlobalProtect.Portals + } + } + if o.Role.Device.Webui.Network.NetworkProfiles != nil { + nestedRole.Device.Webui.Network.NetworkProfiles = &RoleDeviceWebuiNetworkNetworkProfiles{} + if o.Role.Device.Webui.Network.NetworkProfiles.Misc != nil { + entry.Misc["RoleDeviceWebuiNetworkNetworkProfiles"] = o.Role.Device.Webui.Network.NetworkProfiles.Misc + } + if o.Role.Device.Webui.Network.NetworkProfiles.IpsecCrypto != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.IpsecCrypto = o.Role.Device.Webui.Network.NetworkProfiles.IpsecCrypto + } + if o.Role.Device.Webui.Network.NetworkProfiles.QosProfile != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.QosProfile = o.Role.Device.Webui.Network.NetworkProfiles.QosProfile + } + if o.Role.Device.Webui.Network.NetworkProfiles.TunnelMonitor != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.TunnelMonitor = o.Role.Device.Webui.Network.NetworkProfiles.TunnelMonitor + } + if o.Role.Device.Webui.Network.NetworkProfiles.ZoneProtection != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.ZoneProtection = o.Role.Device.Webui.Network.NetworkProfiles.ZoneProtection + } + if o.Role.Device.Webui.Network.NetworkProfiles.BfdProfile != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.BfdProfile = o.Role.Device.Webui.Network.NetworkProfiles.BfdProfile + } + if o.Role.Device.Webui.Network.NetworkProfiles.GpAppIpsecCrypto != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.GpAppIpsecCrypto = o.Role.Device.Webui.Network.NetworkProfiles.GpAppIpsecCrypto + } + if o.Role.Device.Webui.Network.NetworkProfiles.InterfaceMgmt != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.InterfaceMgmt = o.Role.Device.Webui.Network.NetworkProfiles.InterfaceMgmt + } + if o.Role.Device.Webui.Network.NetworkProfiles.LldpProfile != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.LldpProfile = o.Role.Device.Webui.Network.NetworkProfiles.LldpProfile + } + if o.Role.Device.Webui.Network.NetworkProfiles.IkeCrypto != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.IkeCrypto = o.Role.Device.Webui.Network.NetworkProfiles.IkeCrypto + } + if o.Role.Device.Webui.Network.NetworkProfiles.IkeGateways != nil { + nestedRole.Device.Webui.Network.NetworkProfiles.IkeGateways = o.Role.Device.Webui.Network.NetworkProfiles.IkeGateways + } + } + if o.Role.Device.Webui.Network.Zones != nil { + nestedRole.Device.Webui.Network.Zones = o.Role.Device.Webui.Network.Zones + } + if o.Role.Device.Webui.Network.Dhcp != nil { + nestedRole.Device.Webui.Network.Dhcp = o.Role.Device.Webui.Network.Dhcp + } + if o.Role.Device.Webui.Network.GreTunnels != nil { + nestedRole.Device.Webui.Network.GreTunnels = o.Role.Device.Webui.Network.GreTunnels + } + if o.Role.Device.Webui.Network.IpsecTunnels != nil { + nestedRole.Device.Webui.Network.IpsecTunnels = o.Role.Device.Webui.Network.IpsecTunnels + } + if o.Role.Device.Webui.Network.Lldp != nil { + nestedRole.Device.Webui.Network.Lldp = o.Role.Device.Webui.Network.Lldp + } + if o.Role.Device.Webui.Network.SdwanInterfaceProfile != nil { + nestedRole.Device.Webui.Network.SdwanInterfaceProfile = o.Role.Device.Webui.Network.SdwanInterfaceProfile + } + if o.Role.Device.Webui.Network.Qos != nil { + nestedRole.Device.Webui.Network.Qos = o.Role.Device.Webui.Network.Qos + } + if o.Role.Device.Webui.Network.Vlans != nil { + nestedRole.Device.Webui.Network.Vlans = o.Role.Device.Webui.Network.Vlans + } + } + if o.Role.Device.Webui.Validate != nil { + nestedRole.Device.Webui.Validate = o.Role.Device.Webui.Validate + } + if o.Role.Device.Webui.Policies != nil { + nestedRole.Device.Webui.Policies = &RoleDeviceWebuiPolicies{} + if o.Role.Device.Webui.Policies.Misc != nil { + entry.Misc["RoleDeviceWebuiPolicies"] = o.Role.Device.Webui.Policies.Misc + } + if o.Role.Device.Webui.Policies.NatRulebase != nil { + nestedRole.Device.Webui.Policies.NatRulebase = o.Role.Device.Webui.Policies.NatRulebase + } + if o.Role.Device.Webui.Policies.NetworkPacketBrokerRulebase != nil { + nestedRole.Device.Webui.Policies.NetworkPacketBrokerRulebase = o.Role.Device.Webui.Policies.NetworkPacketBrokerRulebase + } + if o.Role.Device.Webui.Policies.QosRulebase != nil { + nestedRole.Device.Webui.Policies.QosRulebase = o.Role.Device.Webui.Policies.QosRulebase + } + if o.Role.Device.Webui.Policies.RuleHitCountReset != nil { + nestedRole.Device.Webui.Policies.RuleHitCountReset = o.Role.Device.Webui.Policies.RuleHitCountReset + } + if o.Role.Device.Webui.Policies.ApplicationOverrideRulebase != nil { + nestedRole.Device.Webui.Policies.ApplicationOverrideRulebase = o.Role.Device.Webui.Policies.ApplicationOverrideRulebase + } + if o.Role.Device.Webui.Policies.AuthenticationRulebase != nil { + nestedRole.Device.Webui.Policies.AuthenticationRulebase = o.Role.Device.Webui.Policies.AuthenticationRulebase + } + if o.Role.Device.Webui.Policies.DosRulebase != nil { + nestedRole.Device.Webui.Policies.DosRulebase = o.Role.Device.Webui.Policies.DosRulebase + } + if o.Role.Device.Webui.Policies.PbfRulebase != nil { + nestedRole.Device.Webui.Policies.PbfRulebase = o.Role.Device.Webui.Policies.PbfRulebase + } + if o.Role.Device.Webui.Policies.SdwanRulebase != nil { + nestedRole.Device.Webui.Policies.SdwanRulebase = o.Role.Device.Webui.Policies.SdwanRulebase + } + if o.Role.Device.Webui.Policies.SecurityRulebase != nil { + nestedRole.Device.Webui.Policies.SecurityRulebase = o.Role.Device.Webui.Policies.SecurityRulebase + } + if o.Role.Device.Webui.Policies.SslDecryptionRulebase != nil { + nestedRole.Device.Webui.Policies.SslDecryptionRulebase = o.Role.Device.Webui.Policies.SslDecryptionRulebase + } + if o.Role.Device.Webui.Policies.TunnelInspectRulebase != nil { + nestedRole.Device.Webui.Policies.TunnelInspectRulebase = o.Role.Device.Webui.Policies.TunnelInspectRulebase + } + } + if o.Role.Device.Webui.Privacy != nil { + nestedRole.Device.Webui.Privacy = &RoleDeviceWebuiPrivacy{} + if o.Role.Device.Webui.Privacy.Misc != nil { + entry.Misc["RoleDeviceWebuiPrivacy"] = o.Role.Device.Webui.Privacy.Misc + } + if o.Role.Device.Webui.Privacy.ShowFullIpAddresses != nil { + nestedRole.Device.Webui.Privacy.ShowFullIpAddresses = o.Role.Device.Webui.Privacy.ShowFullIpAddresses + } + if o.Role.Device.Webui.Privacy.ShowUserNamesInLogsAndReports != nil { + nestedRole.Device.Webui.Privacy.ShowUserNamesInLogsAndReports = o.Role.Device.Webui.Privacy.ShowUserNamesInLogsAndReports + } + if o.Role.Device.Webui.Privacy.ViewPcapFiles != nil { + nestedRole.Device.Webui.Privacy.ViewPcapFiles = o.Role.Device.Webui.Privacy.ViewPcapFiles + } + } + if o.Role.Device.Webui.Operations != nil { + nestedRole.Device.Webui.Operations = &RoleDeviceWebuiOperations{} + if o.Role.Device.Webui.Operations.Misc != nil { + entry.Misc["RoleDeviceWebuiOperations"] = o.Role.Device.Webui.Operations.Misc + } + if o.Role.Device.Webui.Operations.DownloadCoreFiles != nil { + nestedRole.Device.Webui.Operations.DownloadCoreFiles = o.Role.Device.Webui.Operations.DownloadCoreFiles + } + if o.Role.Device.Webui.Operations.DownloadPcapFiles != nil { + nestedRole.Device.Webui.Operations.DownloadPcapFiles = o.Role.Device.Webui.Operations.DownloadPcapFiles + } + if o.Role.Device.Webui.Operations.GenerateStatsDumpFile != nil { + nestedRole.Device.Webui.Operations.GenerateStatsDumpFile = o.Role.Device.Webui.Operations.GenerateStatsDumpFile + } + if o.Role.Device.Webui.Operations.GenerateTechSupportFile != nil { + nestedRole.Device.Webui.Operations.GenerateTechSupportFile = o.Role.Device.Webui.Operations.GenerateTechSupportFile + } + if o.Role.Device.Webui.Operations.Reboot != nil { + nestedRole.Device.Webui.Operations.Reboot = o.Role.Device.Webui.Operations.Reboot + } + } + if o.Role.Device.Webui.Commit != nil { + nestedRole.Device.Webui.Commit = &RoleDeviceWebuiCommit{} + if o.Role.Device.Webui.Commit.Misc != nil { + entry.Misc["RoleDeviceWebuiCommit"] = o.Role.Device.Webui.Commit.Misc + } + if o.Role.Device.Webui.Commit.CommitForOtherAdmins != nil { + nestedRole.Device.Webui.Commit.CommitForOtherAdmins = o.Role.Device.Webui.Commit.CommitForOtherAdmins + } + if o.Role.Device.Webui.Commit.Device != nil { + nestedRole.Device.Webui.Commit.Device = o.Role.Device.Webui.Commit.Device + } + if o.Role.Device.Webui.Commit.ObjectLevelChanges != nil { + nestedRole.Device.Webui.Commit.ObjectLevelChanges = o.Role.Device.Webui.Commit.ObjectLevelChanges + } + } + if o.Role.Device.Webui.Monitor != nil { + nestedRole.Device.Webui.Monitor = &RoleDeviceWebuiMonitor{} + if o.Role.Device.Webui.Monitor.Misc != nil { + entry.Misc["RoleDeviceWebuiMonitor"] = o.Role.Device.Webui.Monitor.Misc + } + if o.Role.Device.Webui.Monitor.ApplicationReports != nil { + nestedRole.Device.Webui.Monitor.ApplicationReports = o.Role.Device.Webui.Monitor.ApplicationReports + } + if o.Role.Device.Webui.Monitor.PdfReports != nil { + nestedRole.Device.Webui.Monitor.PdfReports = &RoleDeviceWebuiMonitorPdfReports{} + if o.Role.Device.Webui.Monitor.PdfReports.Misc != nil { + entry.Misc["RoleDeviceWebuiMonitorPdfReports"] = o.Role.Device.Webui.Monitor.PdfReports.Misc + } + if o.Role.Device.Webui.Monitor.PdfReports.ReportGroups != nil { + nestedRole.Device.Webui.Monitor.PdfReports.ReportGroups = o.Role.Device.Webui.Monitor.PdfReports.ReportGroups + } + if o.Role.Device.Webui.Monitor.PdfReports.SaasApplicationUsageReport != nil { + nestedRole.Device.Webui.Monitor.PdfReports.SaasApplicationUsageReport = o.Role.Device.Webui.Monitor.PdfReports.SaasApplicationUsageReport + } + if o.Role.Device.Webui.Monitor.PdfReports.UserActivityReport != nil { + nestedRole.Device.Webui.Monitor.PdfReports.UserActivityReport = o.Role.Device.Webui.Monitor.PdfReports.UserActivityReport + } + if o.Role.Device.Webui.Monitor.PdfReports.EmailScheduler != nil { + nestedRole.Device.Webui.Monitor.PdfReports.EmailScheduler = o.Role.Device.Webui.Monitor.PdfReports.EmailScheduler + } + if o.Role.Device.Webui.Monitor.PdfReports.ManagePdfSummary != nil { + nestedRole.Device.Webui.Monitor.PdfReports.ManagePdfSummary = o.Role.Device.Webui.Monitor.PdfReports.ManagePdfSummary + } + if o.Role.Device.Webui.Monitor.PdfReports.PdfSummaryReports != nil { + nestedRole.Device.Webui.Monitor.PdfReports.PdfSummaryReports = o.Role.Device.Webui.Monitor.PdfReports.PdfSummaryReports + } + } + if o.Role.Device.Webui.Monitor.SessionBrowser != nil { + nestedRole.Device.Webui.Monitor.SessionBrowser = o.Role.Device.Webui.Monitor.SessionBrowser + } + if o.Role.Device.Webui.Monitor.ViewCustomReports != nil { + nestedRole.Device.Webui.Monitor.ViewCustomReports = o.Role.Device.Webui.Monitor.ViewCustomReports + } + if o.Role.Device.Webui.Monitor.AppScope != nil { + nestedRole.Device.Webui.Monitor.AppScope = o.Role.Device.Webui.Monitor.AppScope + } + if o.Role.Device.Webui.Monitor.AutomatedCorrelationEngine != nil { + nestedRole.Device.Webui.Monitor.AutomatedCorrelationEngine = &RoleDeviceWebuiMonitorAutomatedCorrelationEngine{} + if o.Role.Device.Webui.Monitor.AutomatedCorrelationEngine.Misc != nil { + entry.Misc["RoleDeviceWebuiMonitorAutomatedCorrelationEngine"] = o.Role.Device.Webui.Monitor.AutomatedCorrelationEngine.Misc + } + if o.Role.Device.Webui.Monitor.AutomatedCorrelationEngine.CorrelatedEvents != nil { + nestedRole.Device.Webui.Monitor.AutomatedCorrelationEngine.CorrelatedEvents = o.Role.Device.Webui.Monitor.AutomatedCorrelationEngine.CorrelatedEvents + } + if o.Role.Device.Webui.Monitor.AutomatedCorrelationEngine.CorrelationObjects != nil { + nestedRole.Device.Webui.Monitor.AutomatedCorrelationEngine.CorrelationObjects = o.Role.Device.Webui.Monitor.AutomatedCorrelationEngine.CorrelationObjects + } + } + if o.Role.Device.Webui.Monitor.BlockIpList != nil { + nestedRole.Device.Webui.Monitor.BlockIpList = o.Role.Device.Webui.Monitor.BlockIpList + } + if o.Role.Device.Webui.Monitor.ExternalLogs != nil { + nestedRole.Device.Webui.Monitor.ExternalLogs = o.Role.Device.Webui.Monitor.ExternalLogs + } + if o.Role.Device.Webui.Monitor.Logs != nil { + nestedRole.Device.Webui.Monitor.Logs = &RoleDeviceWebuiMonitorLogs{} + if o.Role.Device.Webui.Monitor.Logs.Misc != nil { + entry.Misc["RoleDeviceWebuiMonitorLogs"] = o.Role.Device.Webui.Monitor.Logs.Misc + } + if o.Role.Device.Webui.Monitor.Logs.Configuration != nil { + nestedRole.Device.Webui.Monitor.Logs.Configuration = o.Role.Device.Webui.Monitor.Logs.Configuration + } + if o.Role.Device.Webui.Monitor.Logs.DataFiltering != nil { + nestedRole.Device.Webui.Monitor.Logs.DataFiltering = o.Role.Device.Webui.Monitor.Logs.DataFiltering + } + if o.Role.Device.Webui.Monitor.Logs.Gtp != nil { + nestedRole.Device.Webui.Monitor.Logs.Gtp = o.Role.Device.Webui.Monitor.Logs.Gtp + } + if o.Role.Device.Webui.Monitor.Logs.Sctp != nil { + nestedRole.Device.Webui.Monitor.Logs.Sctp = o.Role.Device.Webui.Monitor.Logs.Sctp + } + if o.Role.Device.Webui.Monitor.Logs.Alarm != nil { + nestedRole.Device.Webui.Monitor.Logs.Alarm = o.Role.Device.Webui.Monitor.Logs.Alarm + } + if o.Role.Device.Webui.Monitor.Logs.System != nil { + nestedRole.Device.Webui.Monitor.Logs.System = o.Role.Device.Webui.Monitor.Logs.System + } + if o.Role.Device.Webui.Monitor.Logs.Threat != nil { + nestedRole.Device.Webui.Monitor.Logs.Threat = o.Role.Device.Webui.Monitor.Logs.Threat + } + if o.Role.Device.Webui.Monitor.Logs.Tunnel != nil { + nestedRole.Device.Webui.Monitor.Logs.Tunnel = o.Role.Device.Webui.Monitor.Logs.Tunnel + } + if o.Role.Device.Webui.Monitor.Logs.Url != nil { + nestedRole.Device.Webui.Monitor.Logs.Url = o.Role.Device.Webui.Monitor.Logs.Url + } + if o.Role.Device.Webui.Monitor.Logs.Wildfire != nil { + nestedRole.Device.Webui.Monitor.Logs.Wildfire = o.Role.Device.Webui.Monitor.Logs.Wildfire + } + if o.Role.Device.Webui.Monitor.Logs.Decryption != nil { + nestedRole.Device.Webui.Monitor.Logs.Decryption = o.Role.Device.Webui.Monitor.Logs.Decryption + } + if o.Role.Device.Webui.Monitor.Logs.Globalprotect != nil { + nestedRole.Device.Webui.Monitor.Logs.Globalprotect = o.Role.Device.Webui.Monitor.Logs.Globalprotect + } + if o.Role.Device.Webui.Monitor.Logs.Hipmatch != nil { + nestedRole.Device.Webui.Monitor.Logs.Hipmatch = o.Role.Device.Webui.Monitor.Logs.Hipmatch + } + if o.Role.Device.Webui.Monitor.Logs.Iptag != nil { + nestedRole.Device.Webui.Monitor.Logs.Iptag = o.Role.Device.Webui.Monitor.Logs.Iptag + } + if o.Role.Device.Webui.Monitor.Logs.Authentication != nil { + nestedRole.Device.Webui.Monitor.Logs.Authentication = o.Role.Device.Webui.Monitor.Logs.Authentication + } + if o.Role.Device.Webui.Monitor.Logs.Traffic != nil { + nestedRole.Device.Webui.Monitor.Logs.Traffic = o.Role.Device.Webui.Monitor.Logs.Traffic + } + if o.Role.Device.Webui.Monitor.Logs.Userid != nil { + nestedRole.Device.Webui.Monitor.Logs.Userid = o.Role.Device.Webui.Monitor.Logs.Userid + } + } + if o.Role.Device.Webui.Monitor.UrlFilteringReports != nil { + nestedRole.Device.Webui.Monitor.UrlFilteringReports = o.Role.Device.Webui.Monitor.UrlFilteringReports + } + if o.Role.Device.Webui.Monitor.Botnet != nil { + nestedRole.Device.Webui.Monitor.Botnet = o.Role.Device.Webui.Monitor.Botnet + } + if o.Role.Device.Webui.Monitor.CustomReports != nil { + nestedRole.Device.Webui.Monitor.CustomReports = &RoleDeviceWebuiMonitorCustomReports{} + if o.Role.Device.Webui.Monitor.CustomReports.Misc != nil { + entry.Misc["RoleDeviceWebuiMonitorCustomReports"] = o.Role.Device.Webui.Monitor.CustomReports.Misc + } + if o.Role.Device.Webui.Monitor.CustomReports.ApplicationStatistics != nil { + nestedRole.Device.Webui.Monitor.CustomReports.ApplicationStatistics = o.Role.Device.Webui.Monitor.CustomReports.ApplicationStatistics + } + if o.Role.Device.Webui.Monitor.CustomReports.SctpSummary != nil { + nestedRole.Device.Webui.Monitor.CustomReports.SctpSummary = o.Role.Device.Webui.Monitor.CustomReports.SctpSummary + } + if o.Role.Device.Webui.Monitor.CustomReports.ThreatSummary != nil { + nestedRole.Device.Webui.Monitor.CustomReports.ThreatSummary = o.Role.Device.Webui.Monitor.CustomReports.ThreatSummary + } + if o.Role.Device.Webui.Monitor.CustomReports.TunnelLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.TunnelLog = o.Role.Device.Webui.Monitor.CustomReports.TunnelLog + } + if o.Role.Device.Webui.Monitor.CustomReports.UrlLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.UrlLog = o.Role.Device.Webui.Monitor.CustomReports.UrlLog + } + if o.Role.Device.Webui.Monitor.CustomReports.GtpSummary != nil { + nestedRole.Device.Webui.Monitor.CustomReports.GtpSummary = o.Role.Device.Webui.Monitor.CustomReports.GtpSummary + } + if o.Role.Device.Webui.Monitor.CustomReports.Iptag != nil { + nestedRole.Device.Webui.Monitor.CustomReports.Iptag = o.Role.Device.Webui.Monitor.CustomReports.Iptag + } + if o.Role.Device.Webui.Monitor.CustomReports.TrafficSummary != nil { + nestedRole.Device.Webui.Monitor.CustomReports.TrafficSummary = o.Role.Device.Webui.Monitor.CustomReports.TrafficSummary + } + if o.Role.Device.Webui.Monitor.CustomReports.TrafficLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.TrafficLog = o.Role.Device.Webui.Monitor.CustomReports.TrafficLog + } + if o.Role.Device.Webui.Monitor.CustomReports.TunnelSummary != nil { + nestedRole.Device.Webui.Monitor.CustomReports.TunnelSummary = o.Role.Device.Webui.Monitor.CustomReports.TunnelSummary + } + if o.Role.Device.Webui.Monitor.CustomReports.DecryptionLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.DecryptionLog = o.Role.Device.Webui.Monitor.CustomReports.DecryptionLog + } + if o.Role.Device.Webui.Monitor.CustomReports.DecryptionSummary != nil { + nestedRole.Device.Webui.Monitor.CustomReports.DecryptionSummary = o.Role.Device.Webui.Monitor.CustomReports.DecryptionSummary + } + if o.Role.Device.Webui.Monitor.CustomReports.GtpLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.GtpLog = o.Role.Device.Webui.Monitor.CustomReports.GtpLog + } + if o.Role.Device.Webui.Monitor.CustomReports.Hipmatch != nil { + nestedRole.Device.Webui.Monitor.CustomReports.Hipmatch = o.Role.Device.Webui.Monitor.CustomReports.Hipmatch + } + if o.Role.Device.Webui.Monitor.CustomReports.SctpLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.SctpLog = o.Role.Device.Webui.Monitor.CustomReports.SctpLog + } + if o.Role.Device.Webui.Monitor.CustomReports.ThreatLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.ThreatLog = o.Role.Device.Webui.Monitor.CustomReports.ThreatLog + } + if o.Role.Device.Webui.Monitor.CustomReports.Userid != nil { + nestedRole.Device.Webui.Monitor.CustomReports.Userid = o.Role.Device.Webui.Monitor.CustomReports.Userid + } + if o.Role.Device.Webui.Monitor.CustomReports.Auth != nil { + nestedRole.Device.Webui.Monitor.CustomReports.Auth = o.Role.Device.Webui.Monitor.CustomReports.Auth + } + if o.Role.Device.Webui.Monitor.CustomReports.DataFilteringLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.DataFilteringLog = o.Role.Device.Webui.Monitor.CustomReports.DataFilteringLog + } + if o.Role.Device.Webui.Monitor.CustomReports.Globalprotect != nil { + nestedRole.Device.Webui.Monitor.CustomReports.Globalprotect = o.Role.Device.Webui.Monitor.CustomReports.Globalprotect + } + if o.Role.Device.Webui.Monitor.CustomReports.UrlSummary != nil { + nestedRole.Device.Webui.Monitor.CustomReports.UrlSummary = o.Role.Device.Webui.Monitor.CustomReports.UrlSummary + } + if o.Role.Device.Webui.Monitor.CustomReports.WildfireLog != nil { + nestedRole.Device.Webui.Monitor.CustomReports.WildfireLog = o.Role.Device.Webui.Monitor.CustomReports.WildfireLog + } + } + if o.Role.Device.Webui.Monitor.GtpReports != nil { + nestedRole.Device.Webui.Monitor.GtpReports = o.Role.Device.Webui.Monitor.GtpReports + } + if o.Role.Device.Webui.Monitor.PacketCapture != nil { + nestedRole.Device.Webui.Monitor.PacketCapture = o.Role.Device.Webui.Monitor.PacketCapture + } + if o.Role.Device.Webui.Monitor.SctpReports != nil { + nestedRole.Device.Webui.Monitor.SctpReports = o.Role.Device.Webui.Monitor.SctpReports + } + if o.Role.Device.Webui.Monitor.ThreatReports != nil { + nestedRole.Device.Webui.Monitor.ThreatReports = o.Role.Device.Webui.Monitor.ThreatReports + } + if o.Role.Device.Webui.Monitor.TrafficReports != nil { + nestedRole.Device.Webui.Monitor.TrafficReports = o.Role.Device.Webui.Monitor.TrafficReports + } + } + if o.Role.Device.Webui.Objects != nil { + nestedRole.Device.Webui.Objects = &RoleDeviceWebuiObjects{} + if o.Role.Device.Webui.Objects.Misc != nil { + entry.Misc["RoleDeviceWebuiObjects"] = o.Role.Device.Webui.Objects.Misc + } + if o.Role.Device.Webui.Objects.Decryption != nil { + nestedRole.Device.Webui.Objects.Decryption = &RoleDeviceWebuiObjectsDecryption{} + if o.Role.Device.Webui.Objects.Decryption.Misc != nil { + entry.Misc["RoleDeviceWebuiObjectsDecryption"] = o.Role.Device.Webui.Objects.Decryption.Misc + } + if o.Role.Device.Webui.Objects.Decryption.DecryptionProfile != nil { + nestedRole.Device.Webui.Objects.Decryption.DecryptionProfile = o.Role.Device.Webui.Objects.Decryption.DecryptionProfile + } + } + if o.Role.Device.Webui.Objects.AddressGroups != nil { + nestedRole.Device.Webui.Objects.AddressGroups = o.Role.Device.Webui.Objects.AddressGroups + } + if o.Role.Device.Webui.Objects.ApplicationFilters != nil { + nestedRole.Device.Webui.Objects.ApplicationFilters = o.Role.Device.Webui.Objects.ApplicationFilters + } + if o.Role.Device.Webui.Objects.Devices != nil { + nestedRole.Device.Webui.Objects.Devices = o.Role.Device.Webui.Objects.Devices + } + if o.Role.Device.Webui.Objects.DynamicUserGroups != nil { + nestedRole.Device.Webui.Objects.DynamicUserGroups = o.Role.Device.Webui.Objects.DynamicUserGroups + } + if o.Role.Device.Webui.Objects.Regions != nil { + nestedRole.Device.Webui.Objects.Regions = o.Role.Device.Webui.Objects.Regions + } + if o.Role.Device.Webui.Objects.Schedules != nil { + nestedRole.Device.Webui.Objects.Schedules = o.Role.Device.Webui.Objects.Schedules + } + if o.Role.Device.Webui.Objects.ServiceGroups != nil { + nestedRole.Device.Webui.Objects.ServiceGroups = o.Role.Device.Webui.Objects.ServiceGroups + } + if o.Role.Device.Webui.Objects.Tags != nil { + nestedRole.Device.Webui.Objects.Tags = o.Role.Device.Webui.Objects.Tags + } + if o.Role.Device.Webui.Objects.ApplicationGroups != nil { + nestedRole.Device.Webui.Objects.ApplicationGroups = o.Role.Device.Webui.Objects.ApplicationGroups + } + if o.Role.Device.Webui.Objects.Applications != nil { + nestedRole.Device.Webui.Objects.Applications = o.Role.Device.Webui.Objects.Applications + } + if o.Role.Device.Webui.Objects.Authentication != nil { + nestedRole.Device.Webui.Objects.Authentication = o.Role.Device.Webui.Objects.Authentication + } + if o.Role.Device.Webui.Objects.CustomObjects != nil { + nestedRole.Device.Webui.Objects.CustomObjects = &RoleDeviceWebuiObjectsCustomObjects{} + if o.Role.Device.Webui.Objects.CustomObjects.Misc != nil { + entry.Misc["RoleDeviceWebuiObjectsCustomObjects"] = o.Role.Device.Webui.Objects.CustomObjects.Misc + } + if o.Role.Device.Webui.Objects.CustomObjects.DataPatterns != nil { + nestedRole.Device.Webui.Objects.CustomObjects.DataPatterns = o.Role.Device.Webui.Objects.CustomObjects.DataPatterns + } + if o.Role.Device.Webui.Objects.CustomObjects.Spyware != nil { + nestedRole.Device.Webui.Objects.CustomObjects.Spyware = o.Role.Device.Webui.Objects.CustomObjects.Spyware + } + if o.Role.Device.Webui.Objects.CustomObjects.UrlCategory != nil { + nestedRole.Device.Webui.Objects.CustomObjects.UrlCategory = o.Role.Device.Webui.Objects.CustomObjects.UrlCategory + } + if o.Role.Device.Webui.Objects.CustomObjects.Vulnerability != nil { + nestedRole.Device.Webui.Objects.CustomObjects.Vulnerability = o.Role.Device.Webui.Objects.CustomObjects.Vulnerability + } + } + if o.Role.Device.Webui.Objects.SecurityProfiles != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles = &RoleDeviceWebuiObjectsSecurityProfiles{} + if o.Role.Device.Webui.Objects.SecurityProfiles.Misc != nil { + entry.Misc["RoleDeviceWebuiObjectsSecurityProfiles"] = o.Role.Device.Webui.Objects.SecurityProfiles.Misc + } + if o.Role.Device.Webui.Objects.SecurityProfiles.SctpProtection != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.SctpProtection = o.Role.Device.Webui.Objects.SecurityProfiles.SctpProtection + } + if o.Role.Device.Webui.Objects.SecurityProfiles.WildfireAnalysis != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.WildfireAnalysis = o.Role.Device.Webui.Objects.SecurityProfiles.WildfireAnalysis + } + if o.Role.Device.Webui.Objects.SecurityProfiles.DataFiltering != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.DataFiltering = o.Role.Device.Webui.Objects.SecurityProfiles.DataFiltering + } + if o.Role.Device.Webui.Objects.SecurityProfiles.DosProtection != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.DosProtection = o.Role.Device.Webui.Objects.SecurityProfiles.DosProtection + } + if o.Role.Device.Webui.Objects.SecurityProfiles.FileBlocking != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.FileBlocking = o.Role.Device.Webui.Objects.SecurityProfiles.FileBlocking + } + if o.Role.Device.Webui.Objects.SecurityProfiles.GtpProtection != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.GtpProtection = o.Role.Device.Webui.Objects.SecurityProfiles.GtpProtection + } + if o.Role.Device.Webui.Objects.SecurityProfiles.AntiSpyware != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.AntiSpyware = o.Role.Device.Webui.Objects.SecurityProfiles.AntiSpyware + } + if o.Role.Device.Webui.Objects.SecurityProfiles.Antivirus != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.Antivirus = o.Role.Device.Webui.Objects.SecurityProfiles.Antivirus + } + if o.Role.Device.Webui.Objects.SecurityProfiles.UrlFiltering != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.UrlFiltering = o.Role.Device.Webui.Objects.SecurityProfiles.UrlFiltering + } + if o.Role.Device.Webui.Objects.SecurityProfiles.VulnerabilityProtection != nil { + nestedRole.Device.Webui.Objects.SecurityProfiles.VulnerabilityProtection = o.Role.Device.Webui.Objects.SecurityProfiles.VulnerabilityProtection + } + } + if o.Role.Device.Webui.Objects.Addresses != nil { + nestedRole.Device.Webui.Objects.Addresses = o.Role.Device.Webui.Objects.Addresses + } + if o.Role.Device.Webui.Objects.DynamicBlockLists != nil { + nestedRole.Device.Webui.Objects.DynamicBlockLists = o.Role.Device.Webui.Objects.DynamicBlockLists + } + if o.Role.Device.Webui.Objects.GlobalProtect != nil { + nestedRole.Device.Webui.Objects.GlobalProtect = &RoleDeviceWebuiObjectsGlobalProtect{} + if o.Role.Device.Webui.Objects.GlobalProtect.Misc != nil { + entry.Misc["RoleDeviceWebuiObjectsGlobalProtect"] = o.Role.Device.Webui.Objects.GlobalProtect.Misc + } + if o.Role.Device.Webui.Objects.GlobalProtect.HipProfiles != nil { + nestedRole.Device.Webui.Objects.GlobalProtect.HipProfiles = o.Role.Device.Webui.Objects.GlobalProtect.HipProfiles + } + if o.Role.Device.Webui.Objects.GlobalProtect.HipObjects != nil { + nestedRole.Device.Webui.Objects.GlobalProtect.HipObjects = o.Role.Device.Webui.Objects.GlobalProtect.HipObjects + } + } + if o.Role.Device.Webui.Objects.LogForwarding != nil { + nestedRole.Device.Webui.Objects.LogForwarding = o.Role.Device.Webui.Objects.LogForwarding + } + if o.Role.Device.Webui.Objects.PacketBrokerProfile != nil { + nestedRole.Device.Webui.Objects.PacketBrokerProfile = o.Role.Device.Webui.Objects.PacketBrokerProfile + } + if o.Role.Device.Webui.Objects.Sdwan != nil { + nestedRole.Device.Webui.Objects.Sdwan = &RoleDeviceWebuiObjectsSdwan{} + if o.Role.Device.Webui.Objects.Sdwan.Misc != nil { + entry.Misc["RoleDeviceWebuiObjectsSdwan"] = o.Role.Device.Webui.Objects.Sdwan.Misc + } + if o.Role.Device.Webui.Objects.Sdwan.SdwanSaasQualityProfile != nil { + nestedRole.Device.Webui.Objects.Sdwan.SdwanSaasQualityProfile = o.Role.Device.Webui.Objects.Sdwan.SdwanSaasQualityProfile + } + if o.Role.Device.Webui.Objects.Sdwan.SdwanDistProfile != nil { + nestedRole.Device.Webui.Objects.Sdwan.SdwanDistProfile = o.Role.Device.Webui.Objects.Sdwan.SdwanDistProfile + } + if o.Role.Device.Webui.Objects.Sdwan.SdwanErrorCorrectionProfile != nil { + nestedRole.Device.Webui.Objects.Sdwan.SdwanErrorCorrectionProfile = o.Role.Device.Webui.Objects.Sdwan.SdwanErrorCorrectionProfile + } + if o.Role.Device.Webui.Objects.Sdwan.SdwanProfile != nil { + nestedRole.Device.Webui.Objects.Sdwan.SdwanProfile = o.Role.Device.Webui.Objects.Sdwan.SdwanProfile + } + } + if o.Role.Device.Webui.Objects.SecurityProfileGroups != nil { + nestedRole.Device.Webui.Objects.SecurityProfileGroups = o.Role.Device.Webui.Objects.SecurityProfileGroups + } + if o.Role.Device.Webui.Objects.Services != nil { + nestedRole.Device.Webui.Objects.Services = o.Role.Device.Webui.Objects.Services + } + } + if o.Role.Device.Webui.Save != nil { + nestedRole.Device.Webui.Save = &RoleDeviceWebuiSave{} + if o.Role.Device.Webui.Save.Misc != nil { + entry.Misc["RoleDeviceWebuiSave"] = o.Role.Device.Webui.Save.Misc + } + if o.Role.Device.Webui.Save.PartialSave != nil { + nestedRole.Device.Webui.Save.PartialSave = o.Role.Device.Webui.Save.PartialSave + } + if o.Role.Device.Webui.Save.SaveForOtherAdmins != nil { + nestedRole.Device.Webui.Save.SaveForOtherAdmins = o.Role.Device.Webui.Save.SaveForOtherAdmins + } + if o.Role.Device.Webui.Save.ObjectLevelChanges != nil { + nestedRole.Device.Webui.Save.ObjectLevelChanges = o.Role.Device.Webui.Save.ObjectLevelChanges + } + } + if o.Role.Device.Webui.Tasks != nil { + nestedRole.Device.Webui.Tasks = o.Role.Device.Webui.Tasks + } + if o.Role.Device.Webui.Acc != nil { + nestedRole.Device.Webui.Acc = o.Role.Device.Webui.Acc + } + if o.Role.Device.Webui.Device != nil { + nestedRole.Device.Webui.Device = &RoleDeviceWebuiDevice{} + if o.Role.Device.Webui.Device.Misc != nil { + entry.Misc["RoleDeviceWebuiDevice"] = o.Role.Device.Webui.Device.Misc + } + if o.Role.Device.Webui.Device.Software != nil { + nestedRole.Device.Webui.Device.Software = o.Role.Device.Webui.Device.Software + } + if o.Role.Device.Webui.Device.PolicyRecommendations != nil { + nestedRole.Device.Webui.Device.PolicyRecommendations = &RoleDeviceWebuiDevicePolicyRecommendations{} + if o.Role.Device.Webui.Device.PolicyRecommendations.Misc != nil { + entry.Misc["RoleDeviceWebuiDevicePolicyRecommendations"] = o.Role.Device.Webui.Device.PolicyRecommendations.Misc + } + if o.Role.Device.Webui.Device.PolicyRecommendations.Iot != nil { + nestedRole.Device.Webui.Device.PolicyRecommendations.Iot = o.Role.Device.Webui.Device.PolicyRecommendations.Iot + } + if o.Role.Device.Webui.Device.PolicyRecommendations.Saas != nil { + nestedRole.Device.Webui.Device.PolicyRecommendations.Saas = o.Role.Device.Webui.Device.PolicyRecommendations.Saas + } + } + if o.Role.Device.Webui.Device.Administrators != nil { + nestedRole.Device.Webui.Device.Administrators = o.Role.Device.Webui.Device.Administrators + } + if o.Role.Device.Webui.Device.CertificateManagement != nil { + nestedRole.Device.Webui.Device.CertificateManagement = &RoleDeviceWebuiDeviceCertificateManagement{} + if o.Role.Device.Webui.Device.CertificateManagement.Misc != nil { + entry.Misc["RoleDeviceWebuiDeviceCertificateManagement"] = o.Role.Device.Webui.Device.CertificateManagement.Misc + } + if o.Role.Device.Webui.Device.CertificateManagement.SslDecryptionExclusion != nil { + nestedRole.Device.Webui.Device.CertificateManagement.SslDecryptionExclusion = o.Role.Device.Webui.Device.CertificateManagement.SslDecryptionExclusion + } + if o.Role.Device.Webui.Device.CertificateManagement.SslTlsServiceProfile != nil { + nestedRole.Device.Webui.Device.CertificateManagement.SslTlsServiceProfile = o.Role.Device.Webui.Device.CertificateManagement.SslTlsServiceProfile + } + if o.Role.Device.Webui.Device.CertificateManagement.CertificateProfile != nil { + nestedRole.Device.Webui.Device.CertificateManagement.CertificateProfile = o.Role.Device.Webui.Device.CertificateManagement.CertificateProfile + } + if o.Role.Device.Webui.Device.CertificateManagement.Certificates != nil { + nestedRole.Device.Webui.Device.CertificateManagement.Certificates = o.Role.Device.Webui.Device.CertificateManagement.Certificates + } + if o.Role.Device.Webui.Device.CertificateManagement.OcspResponder != nil { + nestedRole.Device.Webui.Device.CertificateManagement.OcspResponder = o.Role.Device.Webui.Device.CertificateManagement.OcspResponder + } + if o.Role.Device.Webui.Device.CertificateManagement.Scep != nil { + nestedRole.Device.Webui.Device.CertificateManagement.Scep = o.Role.Device.Webui.Device.CertificateManagement.Scep + } + if o.Role.Device.Webui.Device.CertificateManagement.SshServiceProfile != nil { + nestedRole.Device.Webui.Device.CertificateManagement.SshServiceProfile = o.Role.Device.Webui.Device.CertificateManagement.SshServiceProfile + } + } + if o.Role.Device.Webui.Device.LogFwdCard != nil { + nestedRole.Device.Webui.Device.LogFwdCard = o.Role.Device.Webui.Device.LogFwdCard + } + if o.Role.Device.Webui.Device.LogSettings != nil { + nestedRole.Device.Webui.Device.LogSettings = &RoleDeviceWebuiDeviceLogSettings{} + if o.Role.Device.Webui.Device.LogSettings.Misc != nil { + entry.Misc["RoleDeviceWebuiDeviceLogSettings"] = o.Role.Device.Webui.Device.LogSettings.Misc + } + if o.Role.Device.Webui.Device.LogSettings.Globalprotect != nil { + nestedRole.Device.Webui.Device.LogSettings.Globalprotect = o.Role.Device.Webui.Device.LogSettings.Globalprotect + } + if o.Role.Device.Webui.Device.LogSettings.Hipmatch != nil { + nestedRole.Device.Webui.Device.LogSettings.Hipmatch = o.Role.Device.Webui.Device.LogSettings.Hipmatch + } + if o.Role.Device.Webui.Device.LogSettings.Iptag != nil { + nestedRole.Device.Webui.Device.LogSettings.Iptag = o.Role.Device.Webui.Device.LogSettings.Iptag + } + if o.Role.Device.Webui.Device.LogSettings.ManageLog != nil { + nestedRole.Device.Webui.Device.LogSettings.ManageLog = o.Role.Device.Webui.Device.LogSettings.ManageLog + } + if o.Role.Device.Webui.Device.LogSettings.System != nil { + nestedRole.Device.Webui.Device.LogSettings.System = o.Role.Device.Webui.Device.LogSettings.System + } + if o.Role.Device.Webui.Device.LogSettings.UserId != nil { + nestedRole.Device.Webui.Device.LogSettings.UserId = o.Role.Device.Webui.Device.LogSettings.UserId + } + if o.Role.Device.Webui.Device.LogSettings.Correlation != nil { + nestedRole.Device.Webui.Device.LogSettings.Correlation = o.Role.Device.Webui.Device.LogSettings.Correlation + } + if o.Role.Device.Webui.Device.LogSettings.Config != nil { + nestedRole.Device.Webui.Device.LogSettings.Config = o.Role.Device.Webui.Device.LogSettings.Config + } + if o.Role.Device.Webui.Device.LogSettings.CcAlarm != nil { + nestedRole.Device.Webui.Device.LogSettings.CcAlarm = o.Role.Device.Webui.Device.LogSettings.CcAlarm + } + } + if o.Role.Device.Webui.Device.ScheduledLogExport != nil { + nestedRole.Device.Webui.Device.ScheduledLogExport = o.Role.Device.Webui.Device.ScheduledLogExport + } + if o.Role.Device.Webui.Device.VirtualSystems != nil { + nestedRole.Device.Webui.Device.VirtualSystems = o.Role.Device.Webui.Device.VirtualSystems + } + if o.Role.Device.Webui.Device.AdminRoles != nil { + nestedRole.Device.Webui.Device.AdminRoles = o.Role.Device.Webui.Device.AdminRoles + } + if o.Role.Device.Webui.Device.Licenses != nil { + nestedRole.Device.Webui.Device.Licenses = o.Role.Device.Webui.Device.Licenses + } + if o.Role.Device.Webui.Device.SharedGateways != nil { + nestedRole.Device.Webui.Device.SharedGateways = o.Role.Device.Webui.Device.SharedGateways + } + if o.Role.Device.Webui.Device.BlockPages != nil { + nestedRole.Device.Webui.Device.BlockPages = o.Role.Device.Webui.Device.BlockPages + } + if o.Role.Device.Webui.Device.DataRedistribution != nil { + nestedRole.Device.Webui.Device.DataRedistribution = o.Role.Device.Webui.Device.DataRedistribution + } + if o.Role.Device.Webui.Device.DynamicUpdates != nil { + nestedRole.Device.Webui.Device.DynamicUpdates = o.Role.Device.Webui.Device.DynamicUpdates + } + if o.Role.Device.Webui.Device.MasterKey != nil { + nestedRole.Device.Webui.Device.MasterKey = o.Role.Device.Webui.Device.MasterKey + } + if o.Role.Device.Webui.Device.Setup != nil { + nestedRole.Device.Webui.Device.Setup = &RoleDeviceWebuiDeviceSetup{} + if o.Role.Device.Webui.Device.Setup.Misc != nil { + entry.Misc["RoleDeviceWebuiDeviceSetup"] = o.Role.Device.Webui.Device.Setup.Misc + } + if o.Role.Device.Webui.Device.Setup.Management != nil { + nestedRole.Device.Webui.Device.Setup.Management = o.Role.Device.Webui.Device.Setup.Management + } + if o.Role.Device.Webui.Device.Setup.Operations != nil { + nestedRole.Device.Webui.Device.Setup.Operations = o.Role.Device.Webui.Device.Setup.Operations + } + if o.Role.Device.Webui.Device.Setup.Services != nil { + nestedRole.Device.Webui.Device.Setup.Services = o.Role.Device.Webui.Device.Setup.Services + } + if o.Role.Device.Webui.Device.Setup.Wildfire != nil { + nestedRole.Device.Webui.Device.Setup.Wildfire = o.Role.Device.Webui.Device.Setup.Wildfire + } + if o.Role.Device.Webui.Device.Setup.Telemetry != nil { + nestedRole.Device.Webui.Device.Setup.Telemetry = o.Role.Device.Webui.Device.Setup.Telemetry + } + if o.Role.Device.Webui.Device.Setup.ContentId != nil { + nestedRole.Device.Webui.Device.Setup.ContentId = o.Role.Device.Webui.Device.Setup.ContentId + } + if o.Role.Device.Webui.Device.Setup.Hsm != nil { + nestedRole.Device.Webui.Device.Setup.Hsm = o.Role.Device.Webui.Device.Setup.Hsm + } + if o.Role.Device.Webui.Device.Setup.Interfaces != nil { + nestedRole.Device.Webui.Device.Setup.Interfaces = o.Role.Device.Webui.Device.Setup.Interfaces + } + if o.Role.Device.Webui.Device.Setup.Session != nil { + nestedRole.Device.Webui.Device.Setup.Session = o.Role.Device.Webui.Device.Setup.Session + } + } + if o.Role.Device.Webui.Device.Support != nil { + nestedRole.Device.Webui.Device.Support = o.Role.Device.Webui.Device.Support + } + if o.Role.Device.Webui.Device.Troubleshooting != nil { + nestedRole.Device.Webui.Device.Troubleshooting = o.Role.Device.Webui.Device.Troubleshooting + } + if o.Role.Device.Webui.Device.AccessDomain != nil { + nestedRole.Device.Webui.Device.AccessDomain = o.Role.Device.Webui.Device.AccessDomain + } + if o.Role.Device.Webui.Device.ConfigAudit != nil { + nestedRole.Device.Webui.Device.ConfigAudit = o.Role.Device.Webui.Device.ConfigAudit + } + if o.Role.Device.Webui.Device.HighAvailability != nil { + nestedRole.Device.Webui.Device.HighAvailability = o.Role.Device.Webui.Device.HighAvailability + } + if o.Role.Device.Webui.Device.AuthenticationProfile != nil { + nestedRole.Device.Webui.Device.AuthenticationProfile = o.Role.Device.Webui.Device.AuthenticationProfile + } + if o.Role.Device.Webui.Device.DeviceQuarantine != nil { + nestedRole.Device.Webui.Device.DeviceQuarantine = o.Role.Device.Webui.Device.DeviceQuarantine + } + if o.Role.Device.Webui.Device.ServerProfile != nil { + nestedRole.Device.Webui.Device.ServerProfile = &RoleDeviceWebuiDeviceServerProfile{} + if o.Role.Device.Webui.Device.ServerProfile.Misc != nil { + entry.Misc["RoleDeviceWebuiDeviceServerProfile"] = o.Role.Device.Webui.Device.ServerProfile.Misc + } + if o.Role.Device.Webui.Device.ServerProfile.SnmpTrap != nil { + nestedRole.Device.Webui.Device.ServerProfile.SnmpTrap = o.Role.Device.Webui.Device.ServerProfile.SnmpTrap + } + if o.Role.Device.Webui.Device.ServerProfile.Tacplus != nil { + nestedRole.Device.Webui.Device.ServerProfile.Tacplus = o.Role.Device.Webui.Device.ServerProfile.Tacplus + } + if o.Role.Device.Webui.Device.ServerProfile.Dns != nil { + nestedRole.Device.Webui.Device.ServerProfile.Dns = o.Role.Device.Webui.Device.ServerProfile.Dns + } + if o.Role.Device.Webui.Device.ServerProfile.Kerberos != nil { + nestedRole.Device.Webui.Device.ServerProfile.Kerberos = o.Role.Device.Webui.Device.ServerProfile.Kerberos + } + if o.Role.Device.Webui.Device.ServerProfile.SamlIdp != nil { + nestedRole.Device.Webui.Device.ServerProfile.SamlIdp = o.Role.Device.Webui.Device.ServerProfile.SamlIdp + } + if o.Role.Device.Webui.Device.ServerProfile.Mfa != nil { + nestedRole.Device.Webui.Device.ServerProfile.Mfa = o.Role.Device.Webui.Device.ServerProfile.Mfa + } + if o.Role.Device.Webui.Device.ServerProfile.Netflow != nil { + nestedRole.Device.Webui.Device.ServerProfile.Netflow = o.Role.Device.Webui.Device.ServerProfile.Netflow + } + if o.Role.Device.Webui.Device.ServerProfile.Radius != nil { + nestedRole.Device.Webui.Device.ServerProfile.Radius = o.Role.Device.Webui.Device.ServerProfile.Radius + } + if o.Role.Device.Webui.Device.ServerProfile.Scp != nil { + nestedRole.Device.Webui.Device.ServerProfile.Scp = o.Role.Device.Webui.Device.ServerProfile.Scp + } + if o.Role.Device.Webui.Device.ServerProfile.Syslog != nil { + nestedRole.Device.Webui.Device.ServerProfile.Syslog = o.Role.Device.Webui.Device.ServerProfile.Syslog + } + if o.Role.Device.Webui.Device.ServerProfile.Email != nil { + nestedRole.Device.Webui.Device.ServerProfile.Email = o.Role.Device.Webui.Device.ServerProfile.Email + } + if o.Role.Device.Webui.Device.ServerProfile.Http != nil { + nestedRole.Device.Webui.Device.ServerProfile.Http = o.Role.Device.Webui.Device.ServerProfile.Http + } + if o.Role.Device.Webui.Device.ServerProfile.Ldap != nil { + nestedRole.Device.Webui.Device.ServerProfile.Ldap = o.Role.Device.Webui.Device.ServerProfile.Ldap + } + } + if o.Role.Device.Webui.Device.UserIdentification != nil { + nestedRole.Device.Webui.Device.UserIdentification = o.Role.Device.Webui.Device.UserIdentification + } + if o.Role.Device.Webui.Device.VmInfoSource != nil { + nestedRole.Device.Webui.Device.VmInfoSource = o.Role.Device.Webui.Device.VmInfoSource + } + if o.Role.Device.Webui.Device.AuthenticationSequence != nil { + nestedRole.Device.Webui.Device.AuthenticationSequence = o.Role.Device.Webui.Device.AuthenticationSequence + } + if o.Role.Device.Webui.Device.LocalUserDatabase != nil { + nestedRole.Device.Webui.Device.LocalUserDatabase = &RoleDeviceWebuiDeviceLocalUserDatabase{} + if o.Role.Device.Webui.Device.LocalUserDatabase.Misc != nil { + entry.Misc["RoleDeviceWebuiDeviceLocalUserDatabase"] = o.Role.Device.Webui.Device.LocalUserDatabase.Misc + } + if o.Role.Device.Webui.Device.LocalUserDatabase.UserGroups != nil { + nestedRole.Device.Webui.Device.LocalUserDatabase.UserGroups = o.Role.Device.Webui.Device.LocalUserDatabase.UserGroups + } + if o.Role.Device.Webui.Device.LocalUserDatabase.Users != nil { + nestedRole.Device.Webui.Device.LocalUserDatabase.Users = o.Role.Device.Webui.Device.LocalUserDatabase.Users + } + } + if o.Role.Device.Webui.Device.Plugins != nil { + nestedRole.Device.Webui.Device.Plugins = o.Role.Device.Webui.Device.Plugins + } + if o.Role.Device.Webui.Device.DhcpSyslogServer != nil { + nestedRole.Device.Webui.Device.DhcpSyslogServer = o.Role.Device.Webui.Device.DhcpSyslogServer + } + if o.Role.Device.Webui.Device.GlobalProtectClient != nil { + nestedRole.Device.Webui.Device.GlobalProtectClient = o.Role.Device.Webui.Device.GlobalProtectClient + } + } + if o.Role.Device.Webui.Global != nil { + nestedRole.Device.Webui.Global = &RoleDeviceWebuiGlobal{} + if o.Role.Device.Webui.Global.Misc != nil { + entry.Misc["RoleDeviceWebuiGlobal"] = o.Role.Device.Webui.Global.Misc + } + if o.Role.Device.Webui.Global.SystemAlarms != nil { + nestedRole.Device.Webui.Global.SystemAlarms = o.Role.Device.Webui.Global.SystemAlarms + } + } + } + if o.Role.Device.Xmlapi != nil { + nestedRole.Device.Xmlapi = &RoleDeviceXmlapi{} + if o.Role.Device.Xmlapi.Misc != nil { + entry.Misc["RoleDeviceXmlapi"] = o.Role.Device.Xmlapi.Misc + } + if o.Role.Device.Xmlapi.Op != nil { + nestedRole.Device.Xmlapi.Op = o.Role.Device.Xmlapi.Op + } + if o.Role.Device.Xmlapi.Report != nil { + nestedRole.Device.Xmlapi.Report = o.Role.Device.Xmlapi.Report + } + if o.Role.Device.Xmlapi.Commit != nil { + nestedRole.Device.Xmlapi.Commit = o.Role.Device.Xmlapi.Commit + } + if o.Role.Device.Xmlapi.Config != nil { + nestedRole.Device.Xmlapi.Config = o.Role.Device.Xmlapi.Config + } + if o.Role.Device.Xmlapi.Export != nil { + nestedRole.Device.Xmlapi.Export = o.Role.Device.Xmlapi.Export + } + if o.Role.Device.Xmlapi.Import != nil { + nestedRole.Device.Xmlapi.Import = o.Role.Device.Xmlapi.Import + } + if o.Role.Device.Xmlapi.Iot != nil { + nestedRole.Device.Xmlapi.Iot = o.Role.Device.Xmlapi.Iot + } + if o.Role.Device.Xmlapi.Log != nil { + nestedRole.Device.Xmlapi.Log = o.Role.Device.Xmlapi.Log + } + if o.Role.Device.Xmlapi.UserId != nil { + nestedRole.Device.Xmlapi.UserId = o.Role.Device.Xmlapi.UserId + } + } + } + if o.Role.Vsys != nil { + nestedRole.Vsys = &RoleVsys{} + if o.Role.Vsys.Misc != nil { + entry.Misc["RoleVsys"] = o.Role.Vsys.Misc + } + if o.Role.Vsys.Cli != nil { + nestedRole.Vsys.Cli = o.Role.Vsys.Cli + } + if o.Role.Vsys.Restapi != nil { + nestedRole.Vsys.Restapi = &RoleVsysRestapi{} + if o.Role.Vsys.Restapi.Misc != nil { + entry.Misc["RoleVsysRestapi"] = o.Role.Vsys.Restapi.Misc + } + if o.Role.Vsys.Restapi.Network != nil { + nestedRole.Vsys.Restapi.Network = &RoleVsysRestapiNetwork{} + if o.Role.Vsys.Restapi.Network.Misc != nil { + entry.Misc["RoleVsysRestapiNetwork"] = o.Role.Vsys.Restapi.Network.Misc + } + if o.Role.Vsys.Restapi.Network.GlobalprotectClientlessAppGroups != nil { + nestedRole.Vsys.Restapi.Network.GlobalprotectClientlessAppGroups = o.Role.Vsys.Restapi.Network.GlobalprotectClientlessAppGroups + } + if o.Role.Vsys.Restapi.Network.GlobalprotectClientlessApps != nil { + nestedRole.Vsys.Restapi.Network.GlobalprotectClientlessApps = o.Role.Vsys.Restapi.Network.GlobalprotectClientlessApps + } + if o.Role.Vsys.Restapi.Network.GlobalprotectGateways != nil { + nestedRole.Vsys.Restapi.Network.GlobalprotectGateways = o.Role.Vsys.Restapi.Network.GlobalprotectGateways + } + if o.Role.Vsys.Restapi.Network.GlobalprotectMdmServers != nil { + nestedRole.Vsys.Restapi.Network.GlobalprotectMdmServers = o.Role.Vsys.Restapi.Network.GlobalprotectMdmServers + } + if o.Role.Vsys.Restapi.Network.GlobalprotectPortals != nil { + nestedRole.Vsys.Restapi.Network.GlobalprotectPortals = o.Role.Vsys.Restapi.Network.GlobalprotectPortals + } + if o.Role.Vsys.Restapi.Network.Zones != nil { + nestedRole.Vsys.Restapi.Network.Zones = o.Role.Vsys.Restapi.Network.Zones + } + if o.Role.Vsys.Restapi.Network.SdwanInterfaceProfiles != nil { + nestedRole.Vsys.Restapi.Network.SdwanInterfaceProfiles = o.Role.Vsys.Restapi.Network.SdwanInterfaceProfiles + } + } + if o.Role.Vsys.Restapi.Objects != nil { + nestedRole.Vsys.Restapi.Objects = &RoleVsysRestapiObjects{} + if o.Role.Vsys.Restapi.Objects.Misc != nil { + entry.Misc["RoleVsysRestapiObjects"] = o.Role.Vsys.Restapi.Objects.Misc + } + if o.Role.Vsys.Restapi.Objects.Addresses != nil { + nestedRole.Vsys.Restapi.Objects.Addresses = o.Role.Vsys.Restapi.Objects.Addresses + } + if o.Role.Vsys.Restapi.Objects.ApplicationFilters != nil { + nestedRole.Vsys.Restapi.Objects.ApplicationFilters = o.Role.Vsys.Restapi.Objects.ApplicationFilters + } + if o.Role.Vsys.Restapi.Objects.Applications != nil { + nestedRole.Vsys.Restapi.Objects.Applications = o.Role.Vsys.Restapi.Objects.Applications + } + if o.Role.Vsys.Restapi.Objects.CustomUrlCategories != nil { + nestedRole.Vsys.Restapi.Objects.CustomUrlCategories = o.Role.Vsys.Restapi.Objects.CustomUrlCategories + } + if o.Role.Vsys.Restapi.Objects.Devices != nil { + nestedRole.Vsys.Restapi.Objects.Devices = o.Role.Vsys.Restapi.Objects.Devices + } + if o.Role.Vsys.Restapi.Objects.DosProtectionSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.DosProtectionSecurityProfiles = o.Role.Vsys.Restapi.Objects.DosProtectionSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.Services != nil { + nestedRole.Vsys.Restapi.Objects.Services = o.Role.Vsys.Restapi.Objects.Services + } + if o.Role.Vsys.Restapi.Objects.DataFilteringSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.DataFilteringSecurityProfiles = o.Role.Vsys.Restapi.Objects.DataFilteringSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.GlobalprotectHipProfiles != nil { + nestedRole.Vsys.Restapi.Objects.GlobalprotectHipProfiles = o.Role.Vsys.Restapi.Objects.GlobalprotectHipProfiles + } + if o.Role.Vsys.Restapi.Objects.SdwanTrafficDistributionProfiles != nil { + nestedRole.Vsys.Restapi.Objects.SdwanTrafficDistributionProfiles = o.Role.Vsys.Restapi.Objects.SdwanTrafficDistributionProfiles + } + if o.Role.Vsys.Restapi.Objects.AddressGroups != nil { + nestedRole.Vsys.Restapi.Objects.AddressGroups = o.Role.Vsys.Restapi.Objects.AddressGroups + } + if o.Role.Vsys.Restapi.Objects.AntiSpywareSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.AntiSpywareSecurityProfiles = o.Role.Vsys.Restapi.Objects.AntiSpywareSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.CustomSpywareSignatures != nil { + nestedRole.Vsys.Restapi.Objects.CustomSpywareSignatures = o.Role.Vsys.Restapi.Objects.CustomSpywareSignatures + } + if o.Role.Vsys.Restapi.Objects.CustomVulnerabilitySignatures != nil { + nestedRole.Vsys.Restapi.Objects.CustomVulnerabilitySignatures = o.Role.Vsys.Restapi.Objects.CustomVulnerabilitySignatures + } + if o.Role.Vsys.Restapi.Objects.FileBlockingSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.FileBlockingSecurityProfiles = o.Role.Vsys.Restapi.Objects.FileBlockingSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.SctpProtectionSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.SctpProtectionSecurityProfiles = o.Role.Vsys.Restapi.Objects.SctpProtectionSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.ServiceGroups != nil { + nestedRole.Vsys.Restapi.Objects.ServiceGroups = o.Role.Vsys.Restapi.Objects.ServiceGroups + } + if o.Role.Vsys.Restapi.Objects.VulnerabilityProtectionSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.VulnerabilityProtectionSecurityProfiles = o.Role.Vsys.Restapi.Objects.VulnerabilityProtectionSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.ApplicationGroups != nil { + nestedRole.Vsys.Restapi.Objects.ApplicationGroups = o.Role.Vsys.Restapi.Objects.ApplicationGroups + } + if o.Role.Vsys.Restapi.Objects.CustomDataPatterns != nil { + nestedRole.Vsys.Restapi.Objects.CustomDataPatterns = o.Role.Vsys.Restapi.Objects.CustomDataPatterns + } + if o.Role.Vsys.Restapi.Objects.Regions != nil { + nestedRole.Vsys.Restapi.Objects.Regions = o.Role.Vsys.Restapi.Objects.Regions + } + if o.Role.Vsys.Restapi.Objects.SdwanSaasQualityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.SdwanSaasQualityProfiles = o.Role.Vsys.Restapi.Objects.SdwanSaasQualityProfiles + } + if o.Role.Vsys.Restapi.Objects.AntivirusSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.AntivirusSecurityProfiles = o.Role.Vsys.Restapi.Objects.AntivirusSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.DecryptionProfiles != nil { + nestedRole.Vsys.Restapi.Objects.DecryptionProfiles = o.Role.Vsys.Restapi.Objects.DecryptionProfiles + } + if o.Role.Vsys.Restapi.Objects.DynamicUserGroups != nil { + nestedRole.Vsys.Restapi.Objects.DynamicUserGroups = o.Role.Vsys.Restapi.Objects.DynamicUserGroups + } + if o.Role.Vsys.Restapi.Objects.GlobalprotectHipObjects != nil { + nestedRole.Vsys.Restapi.Objects.GlobalprotectHipObjects = o.Role.Vsys.Restapi.Objects.GlobalprotectHipObjects + } + if o.Role.Vsys.Restapi.Objects.GtpProtectionSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.GtpProtectionSecurityProfiles = o.Role.Vsys.Restapi.Objects.GtpProtectionSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.SecurityProfileGroups != nil { + nestedRole.Vsys.Restapi.Objects.SecurityProfileGroups = o.Role.Vsys.Restapi.Objects.SecurityProfileGroups + } + if o.Role.Vsys.Restapi.Objects.UrlFilteringSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.UrlFilteringSecurityProfiles = o.Role.Vsys.Restapi.Objects.UrlFilteringSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.WildfireAnalysisSecurityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.WildfireAnalysisSecurityProfiles = o.Role.Vsys.Restapi.Objects.WildfireAnalysisSecurityProfiles + } + if o.Role.Vsys.Restapi.Objects.AuthenticationEnforcements != nil { + nestedRole.Vsys.Restapi.Objects.AuthenticationEnforcements = o.Role.Vsys.Restapi.Objects.AuthenticationEnforcements + } + if o.Role.Vsys.Restapi.Objects.LogForwardingProfiles != nil { + nestedRole.Vsys.Restapi.Objects.LogForwardingProfiles = o.Role.Vsys.Restapi.Objects.LogForwardingProfiles + } + if o.Role.Vsys.Restapi.Objects.PacketBrokerProfiles != nil { + nestedRole.Vsys.Restapi.Objects.PacketBrokerProfiles = o.Role.Vsys.Restapi.Objects.PacketBrokerProfiles + } + if o.Role.Vsys.Restapi.Objects.Tags != nil { + nestedRole.Vsys.Restapi.Objects.Tags = o.Role.Vsys.Restapi.Objects.Tags + } + if o.Role.Vsys.Restapi.Objects.ExternalDynamicLists != nil { + nestedRole.Vsys.Restapi.Objects.ExternalDynamicLists = o.Role.Vsys.Restapi.Objects.ExternalDynamicLists + } + if o.Role.Vsys.Restapi.Objects.Schedules != nil { + nestedRole.Vsys.Restapi.Objects.Schedules = o.Role.Vsys.Restapi.Objects.Schedules + } + if o.Role.Vsys.Restapi.Objects.SdwanErrorCorrectionProfiles != nil { + nestedRole.Vsys.Restapi.Objects.SdwanErrorCorrectionProfiles = o.Role.Vsys.Restapi.Objects.SdwanErrorCorrectionProfiles + } + if o.Role.Vsys.Restapi.Objects.SdwanPathQualityProfiles != nil { + nestedRole.Vsys.Restapi.Objects.SdwanPathQualityProfiles = o.Role.Vsys.Restapi.Objects.SdwanPathQualityProfiles + } + } + if o.Role.Vsys.Restapi.Policies != nil { + nestedRole.Vsys.Restapi.Policies = &RoleVsysRestapiPolicies{} + if o.Role.Vsys.Restapi.Policies.Misc != nil { + entry.Misc["RoleVsysRestapiPolicies"] = o.Role.Vsys.Restapi.Policies.Misc + } + if o.Role.Vsys.Restapi.Policies.DecryptionRules != nil { + nestedRole.Vsys.Restapi.Policies.DecryptionRules = o.Role.Vsys.Restapi.Policies.DecryptionRules + } + if o.Role.Vsys.Restapi.Policies.PolicyBasedForwardingRules != nil { + nestedRole.Vsys.Restapi.Policies.PolicyBasedForwardingRules = o.Role.Vsys.Restapi.Policies.PolicyBasedForwardingRules + } + if o.Role.Vsys.Restapi.Policies.QosRules != nil { + nestedRole.Vsys.Restapi.Policies.QosRules = o.Role.Vsys.Restapi.Policies.QosRules + } + if o.Role.Vsys.Restapi.Policies.TunnelInspectionRules != nil { + nestedRole.Vsys.Restapi.Policies.TunnelInspectionRules = o.Role.Vsys.Restapi.Policies.TunnelInspectionRules + } + if o.Role.Vsys.Restapi.Policies.SecurityRules != nil { + nestedRole.Vsys.Restapi.Policies.SecurityRules = o.Role.Vsys.Restapi.Policies.SecurityRules + } + if o.Role.Vsys.Restapi.Policies.ApplicationOverrideRules != nil { + nestedRole.Vsys.Restapi.Policies.ApplicationOverrideRules = o.Role.Vsys.Restapi.Policies.ApplicationOverrideRules + } + if o.Role.Vsys.Restapi.Policies.AuthenticationRules != nil { + nestedRole.Vsys.Restapi.Policies.AuthenticationRules = o.Role.Vsys.Restapi.Policies.AuthenticationRules + } + if o.Role.Vsys.Restapi.Policies.DosRules != nil { + nestedRole.Vsys.Restapi.Policies.DosRules = o.Role.Vsys.Restapi.Policies.DosRules + } + if o.Role.Vsys.Restapi.Policies.NatRules != nil { + nestedRole.Vsys.Restapi.Policies.NatRules = o.Role.Vsys.Restapi.Policies.NatRules + } + if o.Role.Vsys.Restapi.Policies.NetworkPacketBrokerRules != nil { + nestedRole.Vsys.Restapi.Policies.NetworkPacketBrokerRules = o.Role.Vsys.Restapi.Policies.NetworkPacketBrokerRules + } + if o.Role.Vsys.Restapi.Policies.SdwanRules != nil { + nestedRole.Vsys.Restapi.Policies.SdwanRules = o.Role.Vsys.Restapi.Policies.SdwanRules + } + } + if o.Role.Vsys.Restapi.System != nil { + nestedRole.Vsys.Restapi.System = &RoleVsysRestapiSystem{} + if o.Role.Vsys.Restapi.System.Misc != nil { + entry.Misc["RoleVsysRestapiSystem"] = o.Role.Vsys.Restapi.System.Misc + } + if o.Role.Vsys.Restapi.System.Configuration != nil { + nestedRole.Vsys.Restapi.System.Configuration = o.Role.Vsys.Restapi.System.Configuration + } + } + if o.Role.Vsys.Restapi.Device != nil { + nestedRole.Vsys.Restapi.Device = &RoleVsysRestapiDevice{} + if o.Role.Vsys.Restapi.Device.Misc != nil { + entry.Misc["RoleVsysRestapiDevice"] = o.Role.Vsys.Restapi.Device.Misc + } + if o.Role.Vsys.Restapi.Device.LogInterfaceSetting != nil { + nestedRole.Vsys.Restapi.Device.LogInterfaceSetting = o.Role.Vsys.Restapi.Device.LogInterfaceSetting + } + if o.Role.Vsys.Restapi.Device.SnmpTrapServerProfiles != nil { + nestedRole.Vsys.Restapi.Device.SnmpTrapServerProfiles = o.Role.Vsys.Restapi.Device.SnmpTrapServerProfiles + } + if o.Role.Vsys.Restapi.Device.SyslogServerProfiles != nil { + nestedRole.Vsys.Restapi.Device.SyslogServerProfiles = o.Role.Vsys.Restapi.Device.SyslogServerProfiles + } + if o.Role.Vsys.Restapi.Device.VirtualSystems != nil { + nestedRole.Vsys.Restapi.Device.VirtualSystems = o.Role.Vsys.Restapi.Device.VirtualSystems + } + if o.Role.Vsys.Restapi.Device.EmailServerProfiles != nil { + nestedRole.Vsys.Restapi.Device.EmailServerProfiles = o.Role.Vsys.Restapi.Device.EmailServerProfiles + } + if o.Role.Vsys.Restapi.Device.HttpServerProfiles != nil { + nestedRole.Vsys.Restapi.Device.HttpServerProfiles = o.Role.Vsys.Restapi.Device.HttpServerProfiles + } + if o.Role.Vsys.Restapi.Device.LdapServerProfiles != nil { + nestedRole.Vsys.Restapi.Device.LdapServerProfiles = o.Role.Vsys.Restapi.Device.LdapServerProfiles + } + } + } + if o.Role.Vsys.Webui != nil { + nestedRole.Vsys.Webui = &RoleVsysWebui{} + if o.Role.Vsys.Webui.Misc != nil { + entry.Misc["RoleVsysWebui"] = o.Role.Vsys.Webui.Misc + } + if o.Role.Vsys.Webui.Validate != nil { + nestedRole.Vsys.Webui.Validate = o.Role.Vsys.Webui.Validate + } + if o.Role.Vsys.Webui.Acc != nil { + nestedRole.Vsys.Webui.Acc = o.Role.Vsys.Webui.Acc + } + if o.Role.Vsys.Webui.Dashboard != nil { + nestedRole.Vsys.Webui.Dashboard = o.Role.Vsys.Webui.Dashboard + } + if o.Role.Vsys.Webui.Policies != nil { + nestedRole.Vsys.Webui.Policies = &RoleVsysWebuiPolicies{} + if o.Role.Vsys.Webui.Policies.Misc != nil { + entry.Misc["RoleVsysWebuiPolicies"] = o.Role.Vsys.Webui.Policies.Misc + } + if o.Role.Vsys.Webui.Policies.SslDecryptionRulebase != nil { + nestedRole.Vsys.Webui.Policies.SslDecryptionRulebase = o.Role.Vsys.Webui.Policies.SslDecryptionRulebase + } + if o.Role.Vsys.Webui.Policies.TunnelInspectRulebase != nil { + nestedRole.Vsys.Webui.Policies.TunnelInspectRulebase = o.Role.Vsys.Webui.Policies.TunnelInspectRulebase + } + if o.Role.Vsys.Webui.Policies.ApplicationOverrideRulebase != nil { + nestedRole.Vsys.Webui.Policies.ApplicationOverrideRulebase = o.Role.Vsys.Webui.Policies.ApplicationOverrideRulebase + } + if o.Role.Vsys.Webui.Policies.QosRulebase != nil { + nestedRole.Vsys.Webui.Policies.QosRulebase = o.Role.Vsys.Webui.Policies.QosRulebase + } + if o.Role.Vsys.Webui.Policies.NatRulebase != nil { + nestedRole.Vsys.Webui.Policies.NatRulebase = o.Role.Vsys.Webui.Policies.NatRulebase + } + if o.Role.Vsys.Webui.Policies.NetworkPacketBrokerRulebase != nil { + nestedRole.Vsys.Webui.Policies.NetworkPacketBrokerRulebase = o.Role.Vsys.Webui.Policies.NetworkPacketBrokerRulebase + } + if o.Role.Vsys.Webui.Policies.PbfRulebase != nil { + nestedRole.Vsys.Webui.Policies.PbfRulebase = o.Role.Vsys.Webui.Policies.PbfRulebase + } + if o.Role.Vsys.Webui.Policies.RuleHitCountReset != nil { + nestedRole.Vsys.Webui.Policies.RuleHitCountReset = o.Role.Vsys.Webui.Policies.RuleHitCountReset + } + if o.Role.Vsys.Webui.Policies.SdwanRulebase != nil { + nestedRole.Vsys.Webui.Policies.SdwanRulebase = o.Role.Vsys.Webui.Policies.SdwanRulebase + } + if o.Role.Vsys.Webui.Policies.SecurityRulebase != nil { + nestedRole.Vsys.Webui.Policies.SecurityRulebase = o.Role.Vsys.Webui.Policies.SecurityRulebase + } + if o.Role.Vsys.Webui.Policies.AuthenticationRulebase != nil { + nestedRole.Vsys.Webui.Policies.AuthenticationRulebase = o.Role.Vsys.Webui.Policies.AuthenticationRulebase + } + if o.Role.Vsys.Webui.Policies.DosRulebase != nil { + nestedRole.Vsys.Webui.Policies.DosRulebase = o.Role.Vsys.Webui.Policies.DosRulebase + } + } + if o.Role.Vsys.Webui.Network != nil { + nestedRole.Vsys.Webui.Network = &RoleVsysWebuiNetwork{} + if o.Role.Vsys.Webui.Network.Misc != nil { + entry.Misc["RoleVsysWebuiNetwork"] = o.Role.Vsys.Webui.Network.Misc + } + if o.Role.Vsys.Webui.Network.GlobalProtect != nil { + nestedRole.Vsys.Webui.Network.GlobalProtect = &RoleVsysWebuiNetworkGlobalProtect{} + if o.Role.Vsys.Webui.Network.GlobalProtect.Misc != nil { + entry.Misc["RoleVsysWebuiNetworkGlobalProtect"] = o.Role.Vsys.Webui.Network.GlobalProtect.Misc + } + if o.Role.Vsys.Webui.Network.GlobalProtect.Mdm != nil { + nestedRole.Vsys.Webui.Network.GlobalProtect.Mdm = o.Role.Vsys.Webui.Network.GlobalProtect.Mdm + } + if o.Role.Vsys.Webui.Network.GlobalProtect.Portals != nil { + nestedRole.Vsys.Webui.Network.GlobalProtect.Portals = o.Role.Vsys.Webui.Network.GlobalProtect.Portals + } + if o.Role.Vsys.Webui.Network.GlobalProtect.ClientlessAppGroups != nil { + nestedRole.Vsys.Webui.Network.GlobalProtect.ClientlessAppGroups = o.Role.Vsys.Webui.Network.GlobalProtect.ClientlessAppGroups + } + if o.Role.Vsys.Webui.Network.GlobalProtect.ClientlessApps != nil { + nestedRole.Vsys.Webui.Network.GlobalProtect.ClientlessApps = o.Role.Vsys.Webui.Network.GlobalProtect.ClientlessApps + } + if o.Role.Vsys.Webui.Network.GlobalProtect.Gateways != nil { + nestedRole.Vsys.Webui.Network.GlobalProtect.Gateways = o.Role.Vsys.Webui.Network.GlobalProtect.Gateways + } + } + if o.Role.Vsys.Webui.Network.SdwanInterfaceProfile != nil { + nestedRole.Vsys.Webui.Network.SdwanInterfaceProfile = o.Role.Vsys.Webui.Network.SdwanInterfaceProfile + } + if o.Role.Vsys.Webui.Network.Zones != nil { + nestedRole.Vsys.Webui.Network.Zones = o.Role.Vsys.Webui.Network.Zones + } + } + if o.Role.Vsys.Webui.Objects != nil { + nestedRole.Vsys.Webui.Objects = &RoleVsysWebuiObjects{} + if o.Role.Vsys.Webui.Objects.Misc != nil { + entry.Misc["RoleVsysWebuiObjects"] = o.Role.Vsys.Webui.Objects.Misc + } + if o.Role.Vsys.Webui.Objects.PacketBrokerProfile != nil { + nestedRole.Vsys.Webui.Objects.PacketBrokerProfile = o.Role.Vsys.Webui.Objects.PacketBrokerProfile + } + if o.Role.Vsys.Webui.Objects.Sdwan != nil { + nestedRole.Vsys.Webui.Objects.Sdwan = &RoleVsysWebuiObjectsSdwan{} + if o.Role.Vsys.Webui.Objects.Sdwan.Misc != nil { + entry.Misc["RoleVsysWebuiObjectsSdwan"] = o.Role.Vsys.Webui.Objects.Sdwan.Misc + } + if o.Role.Vsys.Webui.Objects.Sdwan.SdwanDistProfile != nil { + nestedRole.Vsys.Webui.Objects.Sdwan.SdwanDistProfile = o.Role.Vsys.Webui.Objects.Sdwan.SdwanDistProfile + } + if o.Role.Vsys.Webui.Objects.Sdwan.SdwanErrorCorrectionProfile != nil { + nestedRole.Vsys.Webui.Objects.Sdwan.SdwanErrorCorrectionProfile = o.Role.Vsys.Webui.Objects.Sdwan.SdwanErrorCorrectionProfile + } + if o.Role.Vsys.Webui.Objects.Sdwan.SdwanProfile != nil { + nestedRole.Vsys.Webui.Objects.Sdwan.SdwanProfile = o.Role.Vsys.Webui.Objects.Sdwan.SdwanProfile + } + if o.Role.Vsys.Webui.Objects.Sdwan.SdwanSaasQualityProfile != nil { + nestedRole.Vsys.Webui.Objects.Sdwan.SdwanSaasQualityProfile = o.Role.Vsys.Webui.Objects.Sdwan.SdwanSaasQualityProfile + } + } + if o.Role.Vsys.Webui.Objects.DynamicBlockLists != nil { + nestedRole.Vsys.Webui.Objects.DynamicBlockLists = o.Role.Vsys.Webui.Objects.DynamicBlockLists + } + if o.Role.Vsys.Webui.Objects.DynamicUserGroups != nil { + nestedRole.Vsys.Webui.Objects.DynamicUserGroups = o.Role.Vsys.Webui.Objects.DynamicUserGroups + } + if o.Role.Vsys.Webui.Objects.Devices != nil { + nestedRole.Vsys.Webui.Objects.Devices = o.Role.Vsys.Webui.Objects.Devices + } + if o.Role.Vsys.Webui.Objects.GlobalProtect != nil { + nestedRole.Vsys.Webui.Objects.GlobalProtect = &RoleVsysWebuiObjectsGlobalProtect{} + if o.Role.Vsys.Webui.Objects.GlobalProtect.Misc != nil { + entry.Misc["RoleVsysWebuiObjectsGlobalProtect"] = o.Role.Vsys.Webui.Objects.GlobalProtect.Misc + } + if o.Role.Vsys.Webui.Objects.GlobalProtect.HipObjects != nil { + nestedRole.Vsys.Webui.Objects.GlobalProtect.HipObjects = o.Role.Vsys.Webui.Objects.GlobalProtect.HipObjects + } + if o.Role.Vsys.Webui.Objects.GlobalProtect.HipProfiles != nil { + nestedRole.Vsys.Webui.Objects.GlobalProtect.HipProfiles = o.Role.Vsys.Webui.Objects.GlobalProtect.HipProfiles + } + } + if o.Role.Vsys.Webui.Objects.Schedules != nil { + nestedRole.Vsys.Webui.Objects.Schedules = o.Role.Vsys.Webui.Objects.Schedules + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles = &RoleVsysWebuiObjectsSecurityProfiles{} + if o.Role.Vsys.Webui.Objects.SecurityProfiles.Misc != nil { + entry.Misc["RoleVsysWebuiObjectsSecurityProfiles"] = o.Role.Vsys.Webui.Objects.SecurityProfiles.Misc + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.VulnerabilityProtection != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.VulnerabilityProtection = o.Role.Vsys.Webui.Objects.SecurityProfiles.VulnerabilityProtection + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.DosProtection != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.DosProtection = o.Role.Vsys.Webui.Objects.SecurityProfiles.DosProtection + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.FileBlocking != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.FileBlocking = o.Role.Vsys.Webui.Objects.SecurityProfiles.FileBlocking + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.GtpProtection != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.GtpProtection = o.Role.Vsys.Webui.Objects.SecurityProfiles.GtpProtection + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.UrlFiltering != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.UrlFiltering = o.Role.Vsys.Webui.Objects.SecurityProfiles.UrlFiltering + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.WildfireAnalysis != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.WildfireAnalysis = o.Role.Vsys.Webui.Objects.SecurityProfiles.WildfireAnalysis + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.AntiSpyware != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.AntiSpyware = o.Role.Vsys.Webui.Objects.SecurityProfiles.AntiSpyware + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.Antivirus != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.Antivirus = o.Role.Vsys.Webui.Objects.SecurityProfiles.Antivirus + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.DataFiltering != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.DataFiltering = o.Role.Vsys.Webui.Objects.SecurityProfiles.DataFiltering + } + if o.Role.Vsys.Webui.Objects.SecurityProfiles.SctpProtection != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfiles.SctpProtection = o.Role.Vsys.Webui.Objects.SecurityProfiles.SctpProtection + } + } + if o.Role.Vsys.Webui.Objects.ServiceGroups != nil { + nestedRole.Vsys.Webui.Objects.ServiceGroups = o.Role.Vsys.Webui.Objects.ServiceGroups + } + if o.Role.Vsys.Webui.Objects.Addresses != nil { + nestedRole.Vsys.Webui.Objects.Addresses = o.Role.Vsys.Webui.Objects.Addresses + } + if o.Role.Vsys.Webui.Objects.Decryption != nil { + nestedRole.Vsys.Webui.Objects.Decryption = &RoleVsysWebuiObjectsDecryption{} + if o.Role.Vsys.Webui.Objects.Decryption.Misc != nil { + entry.Misc["RoleVsysWebuiObjectsDecryption"] = o.Role.Vsys.Webui.Objects.Decryption.Misc + } + if o.Role.Vsys.Webui.Objects.Decryption.DecryptionProfile != nil { + nestedRole.Vsys.Webui.Objects.Decryption.DecryptionProfile = o.Role.Vsys.Webui.Objects.Decryption.DecryptionProfile + } + } + if o.Role.Vsys.Webui.Objects.Applications != nil { + nestedRole.Vsys.Webui.Objects.Applications = o.Role.Vsys.Webui.Objects.Applications + } + if o.Role.Vsys.Webui.Objects.Authentication != nil { + nestedRole.Vsys.Webui.Objects.Authentication = o.Role.Vsys.Webui.Objects.Authentication + } + if o.Role.Vsys.Webui.Objects.Regions != nil { + nestedRole.Vsys.Webui.Objects.Regions = o.Role.Vsys.Webui.Objects.Regions + } + if o.Role.Vsys.Webui.Objects.Tags != nil { + nestedRole.Vsys.Webui.Objects.Tags = o.Role.Vsys.Webui.Objects.Tags + } + if o.Role.Vsys.Webui.Objects.AddressGroups != nil { + nestedRole.Vsys.Webui.Objects.AddressGroups = o.Role.Vsys.Webui.Objects.AddressGroups + } + if o.Role.Vsys.Webui.Objects.ApplicationGroups != nil { + nestedRole.Vsys.Webui.Objects.ApplicationGroups = o.Role.Vsys.Webui.Objects.ApplicationGroups + } + if o.Role.Vsys.Webui.Objects.LogForwarding != nil { + nestedRole.Vsys.Webui.Objects.LogForwarding = o.Role.Vsys.Webui.Objects.LogForwarding + } + if o.Role.Vsys.Webui.Objects.SecurityProfileGroups != nil { + nestedRole.Vsys.Webui.Objects.SecurityProfileGroups = o.Role.Vsys.Webui.Objects.SecurityProfileGroups + } + if o.Role.Vsys.Webui.Objects.Services != nil { + nestedRole.Vsys.Webui.Objects.Services = o.Role.Vsys.Webui.Objects.Services + } + if o.Role.Vsys.Webui.Objects.ApplicationFilters != nil { + nestedRole.Vsys.Webui.Objects.ApplicationFilters = o.Role.Vsys.Webui.Objects.ApplicationFilters + } + if o.Role.Vsys.Webui.Objects.CustomObjects != nil { + nestedRole.Vsys.Webui.Objects.CustomObjects = &RoleVsysWebuiObjectsCustomObjects{} + if o.Role.Vsys.Webui.Objects.CustomObjects.Misc != nil { + entry.Misc["RoleVsysWebuiObjectsCustomObjects"] = o.Role.Vsys.Webui.Objects.CustomObjects.Misc + } + if o.Role.Vsys.Webui.Objects.CustomObjects.DataPatterns != nil { + nestedRole.Vsys.Webui.Objects.CustomObjects.DataPatterns = o.Role.Vsys.Webui.Objects.CustomObjects.DataPatterns + } + if o.Role.Vsys.Webui.Objects.CustomObjects.Spyware != nil { + nestedRole.Vsys.Webui.Objects.CustomObjects.Spyware = o.Role.Vsys.Webui.Objects.CustomObjects.Spyware + } + if o.Role.Vsys.Webui.Objects.CustomObjects.UrlCategory != nil { + nestedRole.Vsys.Webui.Objects.CustomObjects.UrlCategory = o.Role.Vsys.Webui.Objects.CustomObjects.UrlCategory + } + if o.Role.Vsys.Webui.Objects.CustomObjects.Vulnerability != nil { + nestedRole.Vsys.Webui.Objects.CustomObjects.Vulnerability = o.Role.Vsys.Webui.Objects.CustomObjects.Vulnerability + } + } + } + if o.Role.Vsys.Webui.Operations != nil { + nestedRole.Vsys.Webui.Operations = &RoleVsysWebuiOperations{} + if o.Role.Vsys.Webui.Operations.Misc != nil { + entry.Misc["RoleVsysWebuiOperations"] = o.Role.Vsys.Webui.Operations.Misc + } + if o.Role.Vsys.Webui.Operations.DownloadCoreFiles != nil { + nestedRole.Vsys.Webui.Operations.DownloadCoreFiles = o.Role.Vsys.Webui.Operations.DownloadCoreFiles + } + if o.Role.Vsys.Webui.Operations.DownloadPcapFiles != nil { + nestedRole.Vsys.Webui.Operations.DownloadPcapFiles = o.Role.Vsys.Webui.Operations.DownloadPcapFiles + } + if o.Role.Vsys.Webui.Operations.GenerateStatsDumpFile != nil { + nestedRole.Vsys.Webui.Operations.GenerateStatsDumpFile = o.Role.Vsys.Webui.Operations.GenerateStatsDumpFile + } + if o.Role.Vsys.Webui.Operations.GenerateTechSupportFile != nil { + nestedRole.Vsys.Webui.Operations.GenerateTechSupportFile = o.Role.Vsys.Webui.Operations.GenerateTechSupportFile + } + if o.Role.Vsys.Webui.Operations.Reboot != nil { + nestedRole.Vsys.Webui.Operations.Reboot = o.Role.Vsys.Webui.Operations.Reboot + } + } + if o.Role.Vsys.Webui.Privacy != nil { + nestedRole.Vsys.Webui.Privacy = &RoleVsysWebuiPrivacy{} + if o.Role.Vsys.Webui.Privacy.Misc != nil { + entry.Misc["RoleVsysWebuiPrivacy"] = o.Role.Vsys.Webui.Privacy.Misc + } + if o.Role.Vsys.Webui.Privacy.ViewPcapFiles != nil { + nestedRole.Vsys.Webui.Privacy.ViewPcapFiles = o.Role.Vsys.Webui.Privacy.ViewPcapFiles + } + if o.Role.Vsys.Webui.Privacy.ShowFullIpAddresses != nil { + nestedRole.Vsys.Webui.Privacy.ShowFullIpAddresses = o.Role.Vsys.Webui.Privacy.ShowFullIpAddresses + } + if o.Role.Vsys.Webui.Privacy.ShowUserNamesInLogsAndReports != nil { + nestedRole.Vsys.Webui.Privacy.ShowUserNamesInLogsAndReports = o.Role.Vsys.Webui.Privacy.ShowUserNamesInLogsAndReports + } + } + if o.Role.Vsys.Webui.Save != nil { + nestedRole.Vsys.Webui.Save = &RoleVsysWebuiSave{} + if o.Role.Vsys.Webui.Save.Misc != nil { + entry.Misc["RoleVsysWebuiSave"] = o.Role.Vsys.Webui.Save.Misc + } + if o.Role.Vsys.Webui.Save.PartialSave != nil { + nestedRole.Vsys.Webui.Save.PartialSave = o.Role.Vsys.Webui.Save.PartialSave + } + if o.Role.Vsys.Webui.Save.SaveForOtherAdmins != nil { + nestedRole.Vsys.Webui.Save.SaveForOtherAdmins = o.Role.Vsys.Webui.Save.SaveForOtherAdmins + } + if o.Role.Vsys.Webui.Save.ObjectLevelChanges != nil { + nestedRole.Vsys.Webui.Save.ObjectLevelChanges = o.Role.Vsys.Webui.Save.ObjectLevelChanges + } + } + if o.Role.Vsys.Webui.Commit != nil { + nestedRole.Vsys.Webui.Commit = &RoleVsysWebuiCommit{} + if o.Role.Vsys.Webui.Commit.Misc != nil { + entry.Misc["RoleVsysWebuiCommit"] = o.Role.Vsys.Webui.Commit.Misc + } + if o.Role.Vsys.Webui.Commit.CommitForOtherAdmins != nil { + nestedRole.Vsys.Webui.Commit.CommitForOtherAdmins = o.Role.Vsys.Webui.Commit.CommitForOtherAdmins + } + if o.Role.Vsys.Webui.Commit.VirtualSystems != nil { + nestedRole.Vsys.Webui.Commit.VirtualSystems = o.Role.Vsys.Webui.Commit.VirtualSystems + } + } + if o.Role.Vsys.Webui.Device != nil { + nestedRole.Vsys.Webui.Device = &RoleVsysWebuiDevice{} + if o.Role.Vsys.Webui.Device.Misc != nil { + entry.Misc["RoleVsysWebuiDevice"] = o.Role.Vsys.Webui.Device.Misc + } + if o.Role.Vsys.Webui.Device.CertificateManagement != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement = &RoleVsysWebuiDeviceCertificateManagement{} + if o.Role.Vsys.Webui.Device.CertificateManagement.Misc != nil { + entry.Misc["RoleVsysWebuiDeviceCertificateManagement"] = o.Role.Vsys.Webui.Device.CertificateManagement.Misc + } + if o.Role.Vsys.Webui.Device.CertificateManagement.CertificateProfile != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement.CertificateProfile = o.Role.Vsys.Webui.Device.CertificateManagement.CertificateProfile + } + if o.Role.Vsys.Webui.Device.CertificateManagement.Certificates != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement.Certificates = o.Role.Vsys.Webui.Device.CertificateManagement.Certificates + } + if o.Role.Vsys.Webui.Device.CertificateManagement.OcspResponder != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement.OcspResponder = o.Role.Vsys.Webui.Device.CertificateManagement.OcspResponder + } + if o.Role.Vsys.Webui.Device.CertificateManagement.Scep != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement.Scep = o.Role.Vsys.Webui.Device.CertificateManagement.Scep + } + if o.Role.Vsys.Webui.Device.CertificateManagement.SshServiceProfile != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement.SshServiceProfile = o.Role.Vsys.Webui.Device.CertificateManagement.SshServiceProfile + } + if o.Role.Vsys.Webui.Device.CertificateManagement.SslDecryptionExclusion != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement.SslDecryptionExclusion = o.Role.Vsys.Webui.Device.CertificateManagement.SslDecryptionExclusion + } + if o.Role.Vsys.Webui.Device.CertificateManagement.SslTlsServiceProfile != nil { + nestedRole.Vsys.Webui.Device.CertificateManagement.SslTlsServiceProfile = o.Role.Vsys.Webui.Device.CertificateManagement.SslTlsServiceProfile + } + } + if o.Role.Vsys.Webui.Device.DataRedistribution != nil { + nestedRole.Vsys.Webui.Device.DataRedistribution = o.Role.Vsys.Webui.Device.DataRedistribution + } + if o.Role.Vsys.Webui.Device.LocalUserDatabase != nil { + nestedRole.Vsys.Webui.Device.LocalUserDatabase = &RoleVsysWebuiDeviceLocalUserDatabase{} + if o.Role.Vsys.Webui.Device.LocalUserDatabase.Misc != nil { + entry.Misc["RoleVsysWebuiDeviceLocalUserDatabase"] = o.Role.Vsys.Webui.Device.LocalUserDatabase.Misc + } + if o.Role.Vsys.Webui.Device.LocalUserDatabase.UserGroups != nil { + nestedRole.Vsys.Webui.Device.LocalUserDatabase.UserGroups = o.Role.Vsys.Webui.Device.LocalUserDatabase.UserGroups + } + if o.Role.Vsys.Webui.Device.LocalUserDatabase.Users != nil { + nestedRole.Vsys.Webui.Device.LocalUserDatabase.Users = o.Role.Vsys.Webui.Device.LocalUserDatabase.Users + } + } + if o.Role.Vsys.Webui.Device.LogSettings != nil { + nestedRole.Vsys.Webui.Device.LogSettings = &RoleVsysWebuiDeviceLogSettings{} + if o.Role.Vsys.Webui.Device.LogSettings.Misc != nil { + entry.Misc["RoleVsysWebuiDeviceLogSettings"] = o.Role.Vsys.Webui.Device.LogSettings.Misc + } + if o.Role.Vsys.Webui.Device.LogSettings.Config != nil { + nestedRole.Vsys.Webui.Device.LogSettings.Config = o.Role.Vsys.Webui.Device.LogSettings.Config + } + if o.Role.Vsys.Webui.Device.LogSettings.Correlation != nil { + nestedRole.Vsys.Webui.Device.LogSettings.Correlation = o.Role.Vsys.Webui.Device.LogSettings.Correlation + } + if o.Role.Vsys.Webui.Device.LogSettings.Globalprotect != nil { + nestedRole.Vsys.Webui.Device.LogSettings.Globalprotect = o.Role.Vsys.Webui.Device.LogSettings.Globalprotect + } + if o.Role.Vsys.Webui.Device.LogSettings.Hipmatch != nil { + nestedRole.Vsys.Webui.Device.LogSettings.Hipmatch = o.Role.Vsys.Webui.Device.LogSettings.Hipmatch + } + if o.Role.Vsys.Webui.Device.LogSettings.Iptag != nil { + nestedRole.Vsys.Webui.Device.LogSettings.Iptag = o.Role.Vsys.Webui.Device.LogSettings.Iptag + } + if o.Role.Vsys.Webui.Device.LogSettings.System != nil { + nestedRole.Vsys.Webui.Device.LogSettings.System = o.Role.Vsys.Webui.Device.LogSettings.System + } + if o.Role.Vsys.Webui.Device.LogSettings.UserId != nil { + nestedRole.Vsys.Webui.Device.LogSettings.UserId = o.Role.Vsys.Webui.Device.LogSettings.UserId + } + } + if o.Role.Vsys.Webui.Device.ServerProfile != nil { + nestedRole.Vsys.Webui.Device.ServerProfile = &RoleVsysWebuiDeviceServerProfile{} + if o.Role.Vsys.Webui.Device.ServerProfile.Misc != nil { + entry.Misc["RoleVsysWebuiDeviceServerProfile"] = o.Role.Vsys.Webui.Device.ServerProfile.Misc + } + if o.Role.Vsys.Webui.Device.ServerProfile.Radius != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Radius = o.Role.Vsys.Webui.Device.ServerProfile.Radius + } + if o.Role.Vsys.Webui.Device.ServerProfile.Scp != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Scp = o.Role.Vsys.Webui.Device.ServerProfile.Scp + } + if o.Role.Vsys.Webui.Device.ServerProfile.Syslog != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Syslog = o.Role.Vsys.Webui.Device.ServerProfile.Syslog + } + if o.Role.Vsys.Webui.Device.ServerProfile.Email != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Email = o.Role.Vsys.Webui.Device.ServerProfile.Email + } + if o.Role.Vsys.Webui.Device.ServerProfile.Kerberos != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Kerberos = o.Role.Vsys.Webui.Device.ServerProfile.Kerberos + } + if o.Role.Vsys.Webui.Device.ServerProfile.Ldap != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Ldap = o.Role.Vsys.Webui.Device.ServerProfile.Ldap + } + if o.Role.Vsys.Webui.Device.ServerProfile.Mfa != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Mfa = o.Role.Vsys.Webui.Device.ServerProfile.Mfa + } + if o.Role.Vsys.Webui.Device.ServerProfile.SnmpTrap != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.SnmpTrap = o.Role.Vsys.Webui.Device.ServerProfile.SnmpTrap + } + if o.Role.Vsys.Webui.Device.ServerProfile.Tacplus != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Tacplus = o.Role.Vsys.Webui.Device.ServerProfile.Tacplus + } + if o.Role.Vsys.Webui.Device.ServerProfile.Dns != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Dns = o.Role.Vsys.Webui.Device.ServerProfile.Dns + } + if o.Role.Vsys.Webui.Device.ServerProfile.Http != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Http = o.Role.Vsys.Webui.Device.ServerProfile.Http + } + if o.Role.Vsys.Webui.Device.ServerProfile.Netflow != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.Netflow = o.Role.Vsys.Webui.Device.ServerProfile.Netflow + } + if o.Role.Vsys.Webui.Device.ServerProfile.SamlIdp != nil { + nestedRole.Vsys.Webui.Device.ServerProfile.SamlIdp = o.Role.Vsys.Webui.Device.ServerProfile.SamlIdp + } + } + if o.Role.Vsys.Webui.Device.Administrators != nil { + nestedRole.Vsys.Webui.Device.Administrators = o.Role.Vsys.Webui.Device.Administrators + } + if o.Role.Vsys.Webui.Device.AuthenticationSequence != nil { + nestedRole.Vsys.Webui.Device.AuthenticationSequence = o.Role.Vsys.Webui.Device.AuthenticationSequence + } + if o.Role.Vsys.Webui.Device.BlockPages != nil { + nestedRole.Vsys.Webui.Device.BlockPages = o.Role.Vsys.Webui.Device.BlockPages + } + if o.Role.Vsys.Webui.Device.UserIdentification != nil { + nestedRole.Vsys.Webui.Device.UserIdentification = o.Role.Vsys.Webui.Device.UserIdentification + } + if o.Role.Vsys.Webui.Device.DeviceQuarantine != nil { + nestedRole.Vsys.Webui.Device.DeviceQuarantine = o.Role.Vsys.Webui.Device.DeviceQuarantine + } + if o.Role.Vsys.Webui.Device.PolicyRecommendations != nil { + nestedRole.Vsys.Webui.Device.PolicyRecommendations = &RoleVsysWebuiDevicePolicyRecommendations{} + if o.Role.Vsys.Webui.Device.PolicyRecommendations.Misc != nil { + entry.Misc["RoleVsysWebuiDevicePolicyRecommendations"] = o.Role.Vsys.Webui.Device.PolicyRecommendations.Misc + } + if o.Role.Vsys.Webui.Device.PolicyRecommendations.Iot != nil { + nestedRole.Vsys.Webui.Device.PolicyRecommendations.Iot = o.Role.Vsys.Webui.Device.PolicyRecommendations.Iot + } + if o.Role.Vsys.Webui.Device.PolicyRecommendations.Saas != nil { + nestedRole.Vsys.Webui.Device.PolicyRecommendations.Saas = o.Role.Vsys.Webui.Device.PolicyRecommendations.Saas + } + } + if o.Role.Vsys.Webui.Device.DhcpSyslogServer != nil { + nestedRole.Vsys.Webui.Device.DhcpSyslogServer = o.Role.Vsys.Webui.Device.DhcpSyslogServer + } + if o.Role.Vsys.Webui.Device.VmInfoSource != nil { + nestedRole.Vsys.Webui.Device.VmInfoSource = o.Role.Vsys.Webui.Device.VmInfoSource + } + if o.Role.Vsys.Webui.Device.AuthenticationProfile != nil { + nestedRole.Vsys.Webui.Device.AuthenticationProfile = o.Role.Vsys.Webui.Device.AuthenticationProfile + } + if o.Role.Vsys.Webui.Device.Setup != nil { + nestedRole.Vsys.Webui.Device.Setup = &RoleVsysWebuiDeviceSetup{} + if o.Role.Vsys.Webui.Device.Setup.Misc != nil { + entry.Misc["RoleVsysWebuiDeviceSetup"] = o.Role.Vsys.Webui.Device.Setup.Misc + } + if o.Role.Vsys.Webui.Device.Setup.ContentId != nil { + nestedRole.Vsys.Webui.Device.Setup.ContentId = o.Role.Vsys.Webui.Device.Setup.ContentId + } + if o.Role.Vsys.Webui.Device.Setup.Services != nil { + nestedRole.Vsys.Webui.Device.Setup.Services = o.Role.Vsys.Webui.Device.Setup.Services + } + if o.Role.Vsys.Webui.Device.Setup.Session != nil { + nestedRole.Vsys.Webui.Device.Setup.Session = o.Role.Vsys.Webui.Device.Setup.Session + } + if o.Role.Vsys.Webui.Device.Setup.Telemetry != nil { + nestedRole.Vsys.Webui.Device.Setup.Telemetry = o.Role.Vsys.Webui.Device.Setup.Telemetry + } + if o.Role.Vsys.Webui.Device.Setup.Wildfire != nil { + nestedRole.Vsys.Webui.Device.Setup.Wildfire = o.Role.Vsys.Webui.Device.Setup.Wildfire + } + if o.Role.Vsys.Webui.Device.Setup.Hsm != nil { + nestedRole.Vsys.Webui.Device.Setup.Hsm = o.Role.Vsys.Webui.Device.Setup.Hsm + } + if o.Role.Vsys.Webui.Device.Setup.Interfaces != nil { + nestedRole.Vsys.Webui.Device.Setup.Interfaces = o.Role.Vsys.Webui.Device.Setup.Interfaces + } + if o.Role.Vsys.Webui.Device.Setup.Management != nil { + nestedRole.Vsys.Webui.Device.Setup.Management = o.Role.Vsys.Webui.Device.Setup.Management + } + if o.Role.Vsys.Webui.Device.Setup.Operations != nil { + nestedRole.Vsys.Webui.Device.Setup.Operations = o.Role.Vsys.Webui.Device.Setup.Operations + } + } + if o.Role.Vsys.Webui.Device.Troubleshooting != nil { + nestedRole.Vsys.Webui.Device.Troubleshooting = o.Role.Vsys.Webui.Device.Troubleshooting + } + } + if o.Role.Vsys.Webui.Monitor != nil { + nestedRole.Vsys.Webui.Monitor = &RoleVsysWebuiMonitor{} + if o.Role.Vsys.Webui.Monitor.Misc != nil { + entry.Misc["RoleVsysWebuiMonitor"] = o.Role.Vsys.Webui.Monitor.Misc + } + if o.Role.Vsys.Webui.Monitor.ExternalLogs != nil { + nestedRole.Vsys.Webui.Monitor.ExternalLogs = o.Role.Vsys.Webui.Monitor.ExternalLogs + } + if o.Role.Vsys.Webui.Monitor.Logs != nil { + nestedRole.Vsys.Webui.Monitor.Logs = &RoleVsysWebuiMonitorLogs{} + if o.Role.Vsys.Webui.Monitor.Logs.Misc != nil { + entry.Misc["RoleVsysWebuiMonitorLogs"] = o.Role.Vsys.Webui.Monitor.Logs.Misc + } + if o.Role.Vsys.Webui.Monitor.Logs.Traffic != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Traffic = o.Role.Vsys.Webui.Monitor.Logs.Traffic + } + if o.Role.Vsys.Webui.Monitor.Logs.Decryption != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Decryption = o.Role.Vsys.Webui.Monitor.Logs.Decryption + } + if o.Role.Vsys.Webui.Monitor.Logs.Globalprotect != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Globalprotect = o.Role.Vsys.Webui.Monitor.Logs.Globalprotect + } + if o.Role.Vsys.Webui.Monitor.Logs.Gtp != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Gtp = o.Role.Vsys.Webui.Monitor.Logs.Gtp + } + if o.Role.Vsys.Webui.Monitor.Logs.Hipmatch != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Hipmatch = o.Role.Vsys.Webui.Monitor.Logs.Hipmatch + } + if o.Role.Vsys.Webui.Monitor.Logs.Iptag != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Iptag = o.Role.Vsys.Webui.Monitor.Logs.Iptag + } + if o.Role.Vsys.Webui.Monitor.Logs.Tunnel != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Tunnel = o.Role.Vsys.Webui.Monitor.Logs.Tunnel + } + if o.Role.Vsys.Webui.Monitor.Logs.Wildfire != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Wildfire = o.Role.Vsys.Webui.Monitor.Logs.Wildfire + } + if o.Role.Vsys.Webui.Monitor.Logs.Authentication != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Authentication = o.Role.Vsys.Webui.Monitor.Logs.Authentication + } + if o.Role.Vsys.Webui.Monitor.Logs.DataFiltering != nil { + nestedRole.Vsys.Webui.Monitor.Logs.DataFiltering = o.Role.Vsys.Webui.Monitor.Logs.DataFiltering + } + if o.Role.Vsys.Webui.Monitor.Logs.Sctp != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Sctp = o.Role.Vsys.Webui.Monitor.Logs.Sctp + } + if o.Role.Vsys.Webui.Monitor.Logs.Threat != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Threat = o.Role.Vsys.Webui.Monitor.Logs.Threat + } + if o.Role.Vsys.Webui.Monitor.Logs.Url != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Url = o.Role.Vsys.Webui.Monitor.Logs.Url + } + if o.Role.Vsys.Webui.Monitor.Logs.Userid != nil { + nestedRole.Vsys.Webui.Monitor.Logs.Userid = o.Role.Vsys.Webui.Monitor.Logs.Userid + } + } + if o.Role.Vsys.Webui.Monitor.PdfReports != nil { + nestedRole.Vsys.Webui.Monitor.PdfReports = &RoleVsysWebuiMonitorPdfReports{} + if o.Role.Vsys.Webui.Monitor.PdfReports.Misc != nil { + entry.Misc["RoleVsysWebuiMonitorPdfReports"] = o.Role.Vsys.Webui.Monitor.PdfReports.Misc + } + if o.Role.Vsys.Webui.Monitor.PdfReports.EmailScheduler != nil { + nestedRole.Vsys.Webui.Monitor.PdfReports.EmailScheduler = o.Role.Vsys.Webui.Monitor.PdfReports.EmailScheduler + } + if o.Role.Vsys.Webui.Monitor.PdfReports.ManagePdfSummary != nil { + nestedRole.Vsys.Webui.Monitor.PdfReports.ManagePdfSummary = o.Role.Vsys.Webui.Monitor.PdfReports.ManagePdfSummary + } + if o.Role.Vsys.Webui.Monitor.PdfReports.PdfSummaryReports != nil { + nestedRole.Vsys.Webui.Monitor.PdfReports.PdfSummaryReports = o.Role.Vsys.Webui.Monitor.PdfReports.PdfSummaryReports + } + if o.Role.Vsys.Webui.Monitor.PdfReports.ReportGroups != nil { + nestedRole.Vsys.Webui.Monitor.PdfReports.ReportGroups = o.Role.Vsys.Webui.Monitor.PdfReports.ReportGroups + } + if o.Role.Vsys.Webui.Monitor.PdfReports.SaasApplicationUsageReport != nil { + nestedRole.Vsys.Webui.Monitor.PdfReports.SaasApplicationUsageReport = o.Role.Vsys.Webui.Monitor.PdfReports.SaasApplicationUsageReport + } + if o.Role.Vsys.Webui.Monitor.PdfReports.UserActivityReport != nil { + nestedRole.Vsys.Webui.Monitor.PdfReports.UserActivityReport = o.Role.Vsys.Webui.Monitor.PdfReports.UserActivityReport + } + } + if o.Role.Vsys.Webui.Monitor.AppScope != nil { + nestedRole.Vsys.Webui.Monitor.AppScope = o.Role.Vsys.Webui.Monitor.AppScope + } + if o.Role.Vsys.Webui.Monitor.AutomatedCorrelationEngine != nil { + nestedRole.Vsys.Webui.Monitor.AutomatedCorrelationEngine = &RoleVsysWebuiMonitorAutomatedCorrelationEngine{} + if o.Role.Vsys.Webui.Monitor.AutomatedCorrelationEngine.Misc != nil { + entry.Misc["RoleVsysWebuiMonitorAutomatedCorrelationEngine"] = o.Role.Vsys.Webui.Monitor.AutomatedCorrelationEngine.Misc + } + if o.Role.Vsys.Webui.Monitor.AutomatedCorrelationEngine.CorrelatedEvents != nil { + nestedRole.Vsys.Webui.Monitor.AutomatedCorrelationEngine.CorrelatedEvents = o.Role.Vsys.Webui.Monitor.AutomatedCorrelationEngine.CorrelatedEvents + } + if o.Role.Vsys.Webui.Monitor.AutomatedCorrelationEngine.CorrelationObjects != nil { + nestedRole.Vsys.Webui.Monitor.AutomatedCorrelationEngine.CorrelationObjects = o.Role.Vsys.Webui.Monitor.AutomatedCorrelationEngine.CorrelationObjects + } + } + if o.Role.Vsys.Webui.Monitor.BlockIpList != nil { + nestedRole.Vsys.Webui.Monitor.BlockIpList = o.Role.Vsys.Webui.Monitor.BlockIpList + } + if o.Role.Vsys.Webui.Monitor.CustomReports != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports = &RoleVsysWebuiMonitorCustomReports{} + if o.Role.Vsys.Webui.Monitor.CustomReports.Misc != nil { + entry.Misc["RoleVsysWebuiMonitorCustomReports"] = o.Role.Vsys.Webui.Monitor.CustomReports.Misc + } + if o.Role.Vsys.Webui.Monitor.CustomReports.Hipmatch != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.Hipmatch = o.Role.Vsys.Webui.Monitor.CustomReports.Hipmatch + } + if o.Role.Vsys.Webui.Monitor.CustomReports.Iptag != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.Iptag = o.Role.Vsys.Webui.Monitor.CustomReports.Iptag + } + if o.Role.Vsys.Webui.Monitor.CustomReports.ThreatLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.ThreatLog = o.Role.Vsys.Webui.Monitor.CustomReports.ThreatLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.TrafficSummary != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.TrafficSummary = o.Role.Vsys.Webui.Monitor.CustomReports.TrafficSummary + } + if o.Role.Vsys.Webui.Monitor.CustomReports.TunnelLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.TunnelLog = o.Role.Vsys.Webui.Monitor.CustomReports.TunnelLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.UrlLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.UrlLog = o.Role.Vsys.Webui.Monitor.CustomReports.UrlLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.ApplicationStatistics != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.ApplicationStatistics = o.Role.Vsys.Webui.Monitor.CustomReports.ApplicationStatistics + } + if o.Role.Vsys.Webui.Monitor.CustomReports.Globalprotect != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.Globalprotect = o.Role.Vsys.Webui.Monitor.CustomReports.Globalprotect + } + if o.Role.Vsys.Webui.Monitor.CustomReports.UrlSummary != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.UrlSummary = o.Role.Vsys.Webui.Monitor.CustomReports.UrlSummary + } + if o.Role.Vsys.Webui.Monitor.CustomReports.Userid != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.Userid = o.Role.Vsys.Webui.Monitor.CustomReports.Userid + } + if o.Role.Vsys.Webui.Monitor.CustomReports.ThreatSummary != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.ThreatSummary = o.Role.Vsys.Webui.Monitor.CustomReports.ThreatSummary + } + if o.Role.Vsys.Webui.Monitor.CustomReports.WildfireLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.WildfireLog = o.Role.Vsys.Webui.Monitor.CustomReports.WildfireLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.Auth != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.Auth = o.Role.Vsys.Webui.Monitor.CustomReports.Auth + } + if o.Role.Vsys.Webui.Monitor.CustomReports.DecryptionSummary != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.DecryptionSummary = o.Role.Vsys.Webui.Monitor.CustomReports.DecryptionSummary + } + if o.Role.Vsys.Webui.Monitor.CustomReports.TrafficLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.TrafficLog = o.Role.Vsys.Webui.Monitor.CustomReports.TrafficLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.TunnelSummary != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.TunnelSummary = o.Role.Vsys.Webui.Monitor.CustomReports.TunnelSummary + } + if o.Role.Vsys.Webui.Monitor.CustomReports.DecryptionLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.DecryptionLog = o.Role.Vsys.Webui.Monitor.CustomReports.DecryptionLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.GtpLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.GtpLog = o.Role.Vsys.Webui.Monitor.CustomReports.GtpLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.SctpLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.SctpLog = o.Role.Vsys.Webui.Monitor.CustomReports.SctpLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.SctpSummary != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.SctpSummary = o.Role.Vsys.Webui.Monitor.CustomReports.SctpSummary + } + if o.Role.Vsys.Webui.Monitor.CustomReports.DataFilteringLog != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.DataFilteringLog = o.Role.Vsys.Webui.Monitor.CustomReports.DataFilteringLog + } + if o.Role.Vsys.Webui.Monitor.CustomReports.GtpSummary != nil { + nestedRole.Vsys.Webui.Monitor.CustomReports.GtpSummary = o.Role.Vsys.Webui.Monitor.CustomReports.GtpSummary + } + } + if o.Role.Vsys.Webui.Monitor.SessionBrowser != nil { + nestedRole.Vsys.Webui.Monitor.SessionBrowser = o.Role.Vsys.Webui.Monitor.SessionBrowser + } + if o.Role.Vsys.Webui.Monitor.ViewCustomReports != nil { + nestedRole.Vsys.Webui.Monitor.ViewCustomReports = o.Role.Vsys.Webui.Monitor.ViewCustomReports + } + } + if o.Role.Vsys.Webui.Tasks != nil { + nestedRole.Vsys.Webui.Tasks = o.Role.Vsys.Webui.Tasks + } + } + if o.Role.Vsys.Xmlapi != nil { + nestedRole.Vsys.Xmlapi = &RoleVsysXmlapi{} + if o.Role.Vsys.Xmlapi.Misc != nil { + entry.Misc["RoleVsysXmlapi"] = o.Role.Vsys.Xmlapi.Misc + } + if o.Role.Vsys.Xmlapi.Config != nil { + nestedRole.Vsys.Xmlapi.Config = o.Role.Vsys.Xmlapi.Config + } + if o.Role.Vsys.Xmlapi.Import != nil { + nestedRole.Vsys.Xmlapi.Import = o.Role.Vsys.Xmlapi.Import + } + if o.Role.Vsys.Xmlapi.Log != nil { + nestedRole.Vsys.Xmlapi.Log = o.Role.Vsys.Xmlapi.Log + } + if o.Role.Vsys.Xmlapi.UserId != nil { + nestedRole.Vsys.Xmlapi.UserId = o.Role.Vsys.Xmlapi.UserId + } + if o.Role.Vsys.Xmlapi.Commit != nil { + nestedRole.Vsys.Xmlapi.Commit = o.Role.Vsys.Xmlapi.Commit + } + if o.Role.Vsys.Xmlapi.Export != nil { + nestedRole.Vsys.Xmlapi.Export = o.Role.Vsys.Xmlapi.Export + } + if o.Role.Vsys.Xmlapi.Iot != nil { + nestedRole.Vsys.Xmlapi.Iot = o.Role.Vsys.Xmlapi.Iot + } + if o.Role.Vsys.Xmlapi.Op != nil { + nestedRole.Vsys.Xmlapi.Op = o.Role.Vsys.Xmlapi.Op + } + if o.Role.Vsys.Xmlapi.Report != nil { + nestedRole.Vsys.Xmlapi.Report = o.Role.Vsys.Xmlapi.Report + } + } + } + } + entry.Role = nestedRole + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !matchRole(a.Role, b.Role) { + return false + } + + return true +} + +func matchRoleDeviceRestapiPolicies(a *RoleDeviceRestapiPolicies, b *RoleDeviceRestapiPolicies) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.NatRules, b.NatRules) { + return false + } + if !util.StringsMatch(a.PolicyBasedForwardingRules, b.PolicyBasedForwardingRules) { + return false + } + if !util.StringsMatch(a.QosRules, b.QosRules) { + return false + } + if !util.StringsMatch(a.ApplicationOverrideRules, b.ApplicationOverrideRules) { + return false + } + if !util.StringsMatch(a.AuthenticationRules, b.AuthenticationRules) { + return false + } + if !util.StringsMatch(a.NetworkPacketBrokerRules, b.NetworkPacketBrokerRules) { + return false + } + if !util.StringsMatch(a.SdwanRules, b.SdwanRules) { + return false + } + if !util.StringsMatch(a.SecurityRules, b.SecurityRules) { + return false + } + if !util.StringsMatch(a.TunnelInspectionRules, b.TunnelInspectionRules) { + return false + } + if !util.StringsMatch(a.DecryptionRules, b.DecryptionRules) { + return false + } + if !util.StringsMatch(a.DosRules, b.DosRules) { + return false + } + return true +} +func matchRoleDeviceRestapiSystem(a *RoleDeviceRestapiSystem, b *RoleDeviceRestapiSystem) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Configuration, b.Configuration) { + return false + } + return true +} +func matchRoleDeviceRestapiDevice(a *RoleDeviceRestapiDevice, b *RoleDeviceRestapiDevice) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.SyslogServerProfiles, b.SyslogServerProfiles) { + return false + } + if !util.StringsMatch(a.VirtualSystems, b.VirtualSystems) { + return false + } + if !util.StringsMatch(a.EmailServerProfiles, b.EmailServerProfiles) { + return false + } + if !util.StringsMatch(a.HttpServerProfiles, b.HttpServerProfiles) { + return false + } + if !util.StringsMatch(a.LdapServerProfiles, b.LdapServerProfiles) { + return false + } + if !util.StringsMatch(a.LogInterfaceSetting, b.LogInterfaceSetting) { + return false + } + if !util.StringsMatch(a.SnmpTrapServerProfiles, b.SnmpTrapServerProfiles) { + return false + } + return true +} +func matchRoleDeviceRestapiNetwork(a *RoleDeviceRestapiNetwork, b *RoleDeviceRestapiNetwork) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.DhcpRelays, b.DhcpRelays) { + return false + } + if !util.StringsMatch(a.GlobalprotectMdmServers, b.GlobalprotectMdmServers) { + return false + } + if !util.StringsMatch(a.InterfaceManagementNetworkProfiles, b.InterfaceManagementNetworkProfiles) { + return false + } + if !util.StringsMatch(a.QosNetworkProfiles, b.QosNetworkProfiles) { + return false + } + if !util.StringsMatch(a.GlobalprotectClientlessAppGroups, b.GlobalprotectClientlessAppGroups) { + return false + } + if !util.StringsMatch(a.TunnelInterfaces, b.TunnelInterfaces) { + return false + } + if !util.StringsMatch(a.VirtualWires, b.VirtualWires) { + return false + } + if !util.StringsMatch(a.BgpRoutingProfiles, b.BgpRoutingProfiles) { + return false + } + if !util.StringsMatch(a.GlobalprotectClientlessApps, b.GlobalprotectClientlessApps) { + return false + } + if !util.StringsMatch(a.GreTunnels, b.GreTunnels) { + return false + } + if !util.StringsMatch(a.IkeCryptoNetworkProfiles, b.IkeCryptoNetworkProfiles) { + return false + } + if !util.StringsMatch(a.LogicalRouters, b.LogicalRouters) { + return false + } + if !util.StringsMatch(a.LoopbackInterfaces, b.LoopbackInterfaces) { + return false + } + if !util.StringsMatch(a.SdwanInterfaceProfiles, b.SdwanInterfaceProfiles) { + return false + } + if !util.StringsMatch(a.AggregateEthernetInterfaces, b.AggregateEthernetInterfaces) { + return false + } + if !util.StringsMatch(a.GlobalprotectPortals, b.GlobalprotectPortals) { + return false + } + if !util.StringsMatch(a.TunnelMonitorNetworkProfiles, b.TunnelMonitorNetworkProfiles) { + return false + } + if !util.StringsMatch(a.BfdNetworkProfiles, b.BfdNetworkProfiles) { + return false + } + if !util.StringsMatch(a.EthernetInterfaces, b.EthernetInterfaces) { + return false + } + if !util.StringsMatch(a.DhcpServers, b.DhcpServers) { + return false + } + if !util.StringsMatch(a.LldpNetworkProfiles, b.LldpNetworkProfiles) { + return false + } + if !util.StringsMatch(a.ZoneProtectionNetworkProfiles, b.ZoneProtectionNetworkProfiles) { + return false + } + if !util.StringsMatch(a.Zones, b.Zones) { + return false + } + if !util.StringsMatch(a.GlobalprotectIpsecCryptoNetworkProfiles, b.GlobalprotectIpsecCryptoNetworkProfiles) { + return false + } + if !util.StringsMatch(a.IpsecTunnels, b.IpsecTunnels) { + return false + } + if !util.StringsMatch(a.QosInterfaces, b.QosInterfaces) { + return false + } + if !util.StringsMatch(a.SdwanInterfaces, b.SdwanInterfaces) { + return false + } + if !util.StringsMatch(a.VirtualRouters, b.VirtualRouters) { + return false + } + if !util.StringsMatch(a.VlanInterfaces, b.VlanInterfaces) { + return false + } + if !util.StringsMatch(a.Vlans, b.Vlans) { + return false + } + if !util.StringsMatch(a.DnsProxies, b.DnsProxies) { + return false + } + if !util.StringsMatch(a.GlobalprotectGateways, b.GlobalprotectGateways) { + return false + } + if !util.StringsMatch(a.IkeGatewayNetworkProfiles, b.IkeGatewayNetworkProfiles) { + return false + } + if !util.StringsMatch(a.IpsecCryptoNetworkProfiles, b.IpsecCryptoNetworkProfiles) { + return false + } + if !util.StringsMatch(a.Lldp, b.Lldp) { + return false + } + return true +} +func matchRoleDeviceRestapiObjects(a *RoleDeviceRestapiObjects, b *RoleDeviceRestapiObjects) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.DosProtectionSecurityProfiles, b.DosProtectionSecurityProfiles) { + return false + } + if !util.StringsMatch(a.AddressGroups, b.AddressGroups) { + return false + } + if !util.StringsMatch(a.DataFilteringSecurityProfiles, b.DataFilteringSecurityProfiles) { + return false + } + if !util.StringsMatch(a.SdwanErrorCorrectionProfiles, b.SdwanErrorCorrectionProfiles) { + return false + } + if !util.StringsMatch(a.VulnerabilityProtectionSecurityProfiles, b.VulnerabilityProtectionSecurityProfiles) { + return false + } + if !util.StringsMatch(a.ApplicationGroups, b.ApplicationGroups) { + return false + } + if !util.StringsMatch(a.FileBlockingSecurityProfiles, b.FileBlockingSecurityProfiles) { + return false + } + if !util.StringsMatch(a.GlobalprotectHipProfiles, b.GlobalprotectHipProfiles) { + return false + } + if !util.StringsMatch(a.LogForwardingProfiles, b.LogForwardingProfiles) { + return false + } + if !util.StringsMatch(a.SctpProtectionSecurityProfiles, b.SctpProtectionSecurityProfiles) { + return false + } + if !util.StringsMatch(a.WildfireAnalysisSecurityProfiles, b.WildfireAnalysisSecurityProfiles) { + return false + } + if !util.StringsMatch(a.Applications, b.Applications) { + return false + } + if !util.StringsMatch(a.CustomDataPatterns, b.CustomDataPatterns) { + return false + } + if !util.StringsMatch(a.CustomVulnerabilitySignatures, b.CustomVulnerabilitySignatures) { + return false + } + if !util.StringsMatch(a.GtpProtectionSecurityProfiles, b.GtpProtectionSecurityProfiles) { + return false + } + if !util.StringsMatch(a.SdwanSaasQualityProfiles, b.SdwanSaasQualityProfiles) { + return false + } + if !util.StringsMatch(a.SecurityProfileGroups, b.SecurityProfileGroups) { + return false + } + if !util.StringsMatch(a.AuthenticationEnforcements, b.AuthenticationEnforcements) { + return false + } + if !util.StringsMatch(a.Schedules, b.Schedules) { + return false + } + if !util.StringsMatch(a.UrlFilteringSecurityProfiles, b.UrlFilteringSecurityProfiles) { + return false + } + if !util.StringsMatch(a.GlobalprotectHipObjects, b.GlobalprotectHipObjects) { + return false + } + if !util.StringsMatch(a.PacketBrokerProfiles, b.PacketBrokerProfiles) { + return false + } + if !util.StringsMatch(a.Regions, b.Regions) { + return false + } + if !util.StringsMatch(a.Services, b.Services) { + return false + } + if !util.StringsMatch(a.ExternalDynamicLists, b.ExternalDynamicLists) { + return false + } + if !util.StringsMatch(a.ServiceGroups, b.ServiceGroups) { + return false + } + if !util.StringsMatch(a.Addresses, b.Addresses) { + return false + } + if !util.StringsMatch(a.AntiSpywareSecurityProfiles, b.AntiSpywareSecurityProfiles) { + return false + } + if !util.StringsMatch(a.AntivirusSecurityProfiles, b.AntivirusSecurityProfiles) { + return false + } + if !util.StringsMatch(a.CustomSpywareSignatures, b.CustomSpywareSignatures) { + return false + } + if !util.StringsMatch(a.DecryptionProfiles, b.DecryptionProfiles) { + return false + } + if !util.StringsMatch(a.Devices, b.Devices) { + return false + } + if !util.StringsMatch(a.Tags, b.Tags) { + return false + } + if !util.StringsMatch(a.ApplicationFilters, b.ApplicationFilters) { + return false + } + if !util.StringsMatch(a.CustomUrlCategories, b.CustomUrlCategories) { + return false + } + if !util.StringsMatch(a.DynamicUserGroups, b.DynamicUserGroups) { + return false + } + if !util.StringsMatch(a.SdwanPathQualityProfiles, b.SdwanPathQualityProfiles) { + return false + } + if !util.StringsMatch(a.SdwanTrafficDistributionProfiles, b.SdwanTrafficDistributionProfiles) { + return false + } + return true +} +func matchRoleDeviceRestapi(a *RoleDeviceRestapi, b *RoleDeviceRestapi) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchRoleDeviceRestapiPolicies(a.Policies, b.Policies) { + return false + } + if !matchRoleDeviceRestapiSystem(a.System, b.System) { + return false + } + if !matchRoleDeviceRestapiDevice(a.Device, b.Device) { + return false + } + if !matchRoleDeviceRestapiNetwork(a.Network, b.Network) { + return false + } + if !matchRoleDeviceRestapiObjects(a.Objects, b.Objects) { + return false + } + return true +} +func matchRoleDeviceWebuiPolicies(a *RoleDeviceWebuiPolicies, b *RoleDeviceWebuiPolicies) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.NatRulebase, b.NatRulebase) { + return false + } + if !util.StringsMatch(a.NetworkPacketBrokerRulebase, b.NetworkPacketBrokerRulebase) { + return false + } + if !util.StringsMatch(a.QosRulebase, b.QosRulebase) { + return false + } + if !util.StringsMatch(a.RuleHitCountReset, b.RuleHitCountReset) { + return false + } + if !util.StringsMatch(a.SdwanRulebase, b.SdwanRulebase) { + return false + } + if !util.StringsMatch(a.SecurityRulebase, b.SecurityRulebase) { + return false + } + if !util.StringsMatch(a.SslDecryptionRulebase, b.SslDecryptionRulebase) { + return false + } + if !util.StringsMatch(a.TunnelInspectRulebase, b.TunnelInspectRulebase) { + return false + } + if !util.StringsMatch(a.ApplicationOverrideRulebase, b.ApplicationOverrideRulebase) { + return false + } + if !util.StringsMatch(a.AuthenticationRulebase, b.AuthenticationRulebase) { + return false + } + if !util.StringsMatch(a.DosRulebase, b.DosRulebase) { + return false + } + if !util.StringsMatch(a.PbfRulebase, b.PbfRulebase) { + return false + } + return true +} +func matchRoleDeviceWebuiPrivacy(a *RoleDeviceWebuiPrivacy, b *RoleDeviceWebuiPrivacy) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.ShowFullIpAddresses, b.ShowFullIpAddresses) { + return false + } + if !util.StringsMatch(a.ShowUserNamesInLogsAndReports, b.ShowUserNamesInLogsAndReports) { + return false + } + if !util.StringsMatch(a.ViewPcapFiles, b.ViewPcapFiles) { + return false + } + return true +} +func matchRoleDeviceWebuiCommit(a *RoleDeviceWebuiCommit, b *RoleDeviceWebuiCommit) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.ObjectLevelChanges, b.ObjectLevelChanges) { + return false + } + if !util.StringsMatch(a.CommitForOtherAdmins, b.CommitForOtherAdmins) { + return false + } + if !util.StringsMatch(a.Device, b.Device) { + return false + } + return true +} +func matchRoleDeviceWebuiMonitorPdfReports(a *RoleDeviceWebuiMonitorPdfReports, b *RoleDeviceWebuiMonitorPdfReports) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.EmailScheduler, b.EmailScheduler) { + return false + } + if !util.StringsMatch(a.ManagePdfSummary, b.ManagePdfSummary) { + return false + } + if !util.StringsMatch(a.PdfSummaryReports, b.PdfSummaryReports) { + return false + } + if !util.StringsMatch(a.ReportGroups, b.ReportGroups) { + return false + } + if !util.StringsMatch(a.SaasApplicationUsageReport, b.SaasApplicationUsageReport) { + return false + } + if !util.StringsMatch(a.UserActivityReport, b.UserActivityReport) { + return false + } + return true +} +func matchRoleDeviceWebuiMonitorLogs(a *RoleDeviceWebuiMonitorLogs, b *RoleDeviceWebuiMonitorLogs) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Authentication, b.Authentication) { + return false + } + if !util.StringsMatch(a.Traffic, b.Traffic) { + return false + } + if !util.StringsMatch(a.Userid, b.Userid) { + return false + } + if !util.StringsMatch(a.Sctp, b.Sctp) { + return false + } + if !util.StringsMatch(a.Configuration, b.Configuration) { + return false + } + if !util.StringsMatch(a.DataFiltering, b.DataFiltering) { + return false + } + if !util.StringsMatch(a.Gtp, b.Gtp) { + return false + } + if !util.StringsMatch(a.Alarm, b.Alarm) { + return false + } + if !util.StringsMatch(a.System, b.System) { + return false + } + if !util.StringsMatch(a.Threat, b.Threat) { + return false + } + if !util.StringsMatch(a.Iptag, b.Iptag) { + return false + } + if !util.StringsMatch(a.Tunnel, b.Tunnel) { + return false + } + if !util.StringsMatch(a.Url, b.Url) { + return false + } + if !util.StringsMatch(a.Wildfire, b.Wildfire) { + return false + } + if !util.StringsMatch(a.Decryption, b.Decryption) { + return false + } + if !util.StringsMatch(a.Globalprotect, b.Globalprotect) { + return false + } + if !util.StringsMatch(a.Hipmatch, b.Hipmatch) { + return false + } + return true +} +func matchRoleDeviceWebuiMonitorAutomatedCorrelationEngine(a *RoleDeviceWebuiMonitorAutomatedCorrelationEngine, b *RoleDeviceWebuiMonitorAutomatedCorrelationEngine) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.CorrelatedEvents, b.CorrelatedEvents) { + return false + } + if !util.StringsMatch(a.CorrelationObjects, b.CorrelationObjects) { + return false + } + return true +} +func matchRoleDeviceWebuiMonitorCustomReports(a *RoleDeviceWebuiMonitorCustomReports, b *RoleDeviceWebuiMonitorCustomReports) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.GtpSummary, b.GtpSummary) { + return false + } + if !util.StringsMatch(a.Iptag, b.Iptag) { + return false + } + if !util.StringsMatch(a.TrafficSummary, b.TrafficSummary) { + return false + } + if !util.StringsMatch(a.TunnelSummary, b.TunnelSummary) { + return false + } + if !util.StringsMatch(a.DecryptionLog, b.DecryptionLog) { + return false + } + if !util.StringsMatch(a.DecryptionSummary, b.DecryptionSummary) { + return false + } + if !util.StringsMatch(a.GtpLog, b.GtpLog) { + return false + } + if !util.StringsMatch(a.Hipmatch, b.Hipmatch) { + return false + } + if !util.StringsMatch(a.SctpLog, b.SctpLog) { + return false + } + if !util.StringsMatch(a.ThreatLog, b.ThreatLog) { + return false + } + if !util.StringsMatch(a.TrafficLog, b.TrafficLog) { + return false + } + if !util.StringsMatch(a.Userid, b.Userid) { + return false + } + if !util.StringsMatch(a.Auth, b.Auth) { + return false + } + if !util.StringsMatch(a.DataFilteringLog, b.DataFilteringLog) { + return false + } + if !util.StringsMatch(a.Globalprotect, b.Globalprotect) { + return false + } + if !util.StringsMatch(a.UrlSummary, b.UrlSummary) { + return false + } + if !util.StringsMatch(a.WildfireLog, b.WildfireLog) { + return false + } + if !util.StringsMatch(a.ApplicationStatistics, b.ApplicationStatistics) { + return false + } + if !util.StringsMatch(a.SctpSummary, b.SctpSummary) { + return false + } + if !util.StringsMatch(a.ThreatSummary, b.ThreatSummary) { + return false + } + if !util.StringsMatch(a.TunnelLog, b.TunnelLog) { + return false + } + if !util.StringsMatch(a.UrlLog, b.UrlLog) { + return false + } + return true +} +func matchRoleDeviceWebuiMonitor(a *RoleDeviceWebuiMonitor, b *RoleDeviceWebuiMonitor) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Botnet, b.Botnet) { + return false + } + if !matchRoleDeviceWebuiMonitorCustomReports(a.CustomReports, b.CustomReports) { + return false + } + if !util.StringsMatch(a.GtpReports, b.GtpReports) { + return false + } + if !util.StringsMatch(a.PacketCapture, b.PacketCapture) { + return false + } + if !util.StringsMatch(a.SctpReports, b.SctpReports) { + return false + } + if !util.StringsMatch(a.ThreatReports, b.ThreatReports) { + return false + } + if !util.StringsMatch(a.TrafficReports, b.TrafficReports) { + return false + } + if !util.StringsMatch(a.ApplicationReports, b.ApplicationReports) { + return false + } + if !matchRoleDeviceWebuiMonitorPdfReports(a.PdfReports, b.PdfReports) { + return false + } + if !util.StringsMatch(a.SessionBrowser, b.SessionBrowser) { + return false + } + if !util.StringsMatch(a.ViewCustomReports, b.ViewCustomReports) { + return false + } + if !util.StringsMatch(a.AppScope, b.AppScope) { + return false + } + if !matchRoleDeviceWebuiMonitorAutomatedCorrelationEngine(a.AutomatedCorrelationEngine, b.AutomatedCorrelationEngine) { + return false + } + if !util.StringsMatch(a.BlockIpList, b.BlockIpList) { + return false + } + if !util.StringsMatch(a.ExternalLogs, b.ExternalLogs) { + return false + } + if !matchRoleDeviceWebuiMonitorLogs(a.Logs, b.Logs) { + return false + } + if !util.StringsMatch(a.UrlFilteringReports, b.UrlFilteringReports) { + return false + } + return true +} +func matchRoleDeviceWebuiObjectsCustomObjects(a *RoleDeviceWebuiObjectsCustomObjects, b *RoleDeviceWebuiObjectsCustomObjects) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.DataPatterns, b.DataPatterns) { + return false + } + if !util.StringsMatch(a.Spyware, b.Spyware) { + return false + } + if !util.StringsMatch(a.UrlCategory, b.UrlCategory) { + return false + } + if !util.StringsMatch(a.Vulnerability, b.Vulnerability) { + return false + } + return true +} +func matchRoleDeviceWebuiObjectsSecurityProfiles(a *RoleDeviceWebuiObjectsSecurityProfiles, b *RoleDeviceWebuiObjectsSecurityProfiles) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.GtpProtection, b.GtpProtection) { + return false + } + if !util.StringsMatch(a.SctpProtection, b.SctpProtection) { + return false + } + if !util.StringsMatch(a.WildfireAnalysis, b.WildfireAnalysis) { + return false + } + if !util.StringsMatch(a.DataFiltering, b.DataFiltering) { + return false + } + if !util.StringsMatch(a.DosProtection, b.DosProtection) { + return false + } + if !util.StringsMatch(a.FileBlocking, b.FileBlocking) { + return false + } + if !util.StringsMatch(a.VulnerabilityProtection, b.VulnerabilityProtection) { + return false + } + if !util.StringsMatch(a.AntiSpyware, b.AntiSpyware) { + return false + } + if !util.StringsMatch(a.Antivirus, b.Antivirus) { + return false + } + if !util.StringsMatch(a.UrlFiltering, b.UrlFiltering) { + return false + } + return true +} +func matchRoleDeviceWebuiObjectsSdwan(a *RoleDeviceWebuiObjectsSdwan, b *RoleDeviceWebuiObjectsSdwan) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.SdwanProfile, b.SdwanProfile) { + return false + } + if !util.StringsMatch(a.SdwanSaasQualityProfile, b.SdwanSaasQualityProfile) { + return false + } + if !util.StringsMatch(a.SdwanDistProfile, b.SdwanDistProfile) { + return false + } + if !util.StringsMatch(a.SdwanErrorCorrectionProfile, b.SdwanErrorCorrectionProfile) { + return false + } + return true +} +func matchRoleDeviceWebuiObjectsGlobalProtect(a *RoleDeviceWebuiObjectsGlobalProtect, b *RoleDeviceWebuiObjectsGlobalProtect) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.HipObjects, b.HipObjects) { + return false + } + if !util.StringsMatch(a.HipProfiles, b.HipProfiles) { + return false + } + return true +} +func matchRoleDeviceWebuiObjectsDecryption(a *RoleDeviceWebuiObjectsDecryption, b *RoleDeviceWebuiObjectsDecryption) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.DecryptionProfile, b.DecryptionProfile) { + return false + } + return true +} +func matchRoleDeviceWebuiObjects(a *RoleDeviceWebuiObjects, b *RoleDeviceWebuiObjects) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.SecurityProfileGroups, b.SecurityProfileGroups) { + return false + } + if !util.StringsMatch(a.Services, b.Services) { + return false + } + if !util.StringsMatch(a.Addresses, b.Addresses) { + return false + } + if !util.StringsMatch(a.DynamicBlockLists, b.DynamicBlockLists) { + return false + } + if !matchRoleDeviceWebuiObjectsGlobalProtect(a.GlobalProtect, b.GlobalProtect) { + return false + } + if !util.StringsMatch(a.LogForwarding, b.LogForwarding) { + return false + } + if !util.StringsMatch(a.PacketBrokerProfile, b.PacketBrokerProfile) { + return false + } + if !matchRoleDeviceWebuiObjectsSdwan(a.Sdwan, b.Sdwan) { + return false + } + if !matchRoleDeviceWebuiObjectsDecryption(a.Decryption, b.Decryption) { + return false + } + if !util.StringsMatch(a.ServiceGroups, b.ServiceGroups) { + return false + } + if !util.StringsMatch(a.Tags, b.Tags) { + return false + } + if !util.StringsMatch(a.AddressGroups, b.AddressGroups) { + return false + } + if !util.StringsMatch(a.ApplicationFilters, b.ApplicationFilters) { + return false + } + if !util.StringsMatch(a.Devices, b.Devices) { + return false + } + if !util.StringsMatch(a.DynamicUserGroups, b.DynamicUserGroups) { + return false + } + if !util.StringsMatch(a.Regions, b.Regions) { + return false + } + if !util.StringsMatch(a.Schedules, b.Schedules) { + return false + } + if !util.StringsMatch(a.ApplicationGroups, b.ApplicationGroups) { + return false + } + if !util.StringsMatch(a.Applications, b.Applications) { + return false + } + if !util.StringsMatch(a.Authentication, b.Authentication) { + return false + } + if !matchRoleDeviceWebuiObjectsCustomObjects(a.CustomObjects, b.CustomObjects) { + return false + } + if !matchRoleDeviceWebuiObjectsSecurityProfiles(a.SecurityProfiles, b.SecurityProfiles) { + return false + } + return true +} +func matchRoleDeviceWebuiOperations(a *RoleDeviceWebuiOperations, b *RoleDeviceWebuiOperations) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.GenerateStatsDumpFile, b.GenerateStatsDumpFile) { + return false + } + if !util.StringsMatch(a.GenerateTechSupportFile, b.GenerateTechSupportFile) { + return false + } + if !util.StringsMatch(a.Reboot, b.Reboot) { + return false + } + if !util.StringsMatch(a.DownloadCoreFiles, b.DownloadCoreFiles) { + return false + } + if !util.StringsMatch(a.DownloadPcapFiles, b.DownloadPcapFiles) { + return false + } + return true +} +func matchRoleDeviceWebuiDeviceSetup(a *RoleDeviceWebuiDeviceSetup, b *RoleDeviceWebuiDeviceSetup) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Telemetry, b.Telemetry) { + return false + } + if !util.StringsMatch(a.ContentId, b.ContentId) { + return false + } + if !util.StringsMatch(a.Hsm, b.Hsm) { + return false + } + if !util.StringsMatch(a.Interfaces, b.Interfaces) { + return false + } + if !util.StringsMatch(a.Session, b.Session) { + return false + } + if !util.StringsMatch(a.Management, b.Management) { + return false + } + if !util.StringsMatch(a.Operations, b.Operations) { + return false + } + if !util.StringsMatch(a.Services, b.Services) { + return false + } + if !util.StringsMatch(a.Wildfire, b.Wildfire) { + return false + } + return true +} +func matchRoleDeviceWebuiDeviceServerProfile(a *RoleDeviceWebuiDeviceServerProfile, b *RoleDeviceWebuiDeviceServerProfile) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Mfa, b.Mfa) { + return false + } + if !util.StringsMatch(a.Netflow, b.Netflow) { + return false + } + if !util.StringsMatch(a.Radius, b.Radius) { + return false + } + if !util.StringsMatch(a.Scp, b.Scp) { + return false + } + if !util.StringsMatch(a.Syslog, b.Syslog) { + return false + } + if !util.StringsMatch(a.Email, b.Email) { + return false + } + if !util.StringsMatch(a.Http, b.Http) { + return false + } + if !util.StringsMatch(a.Ldap, b.Ldap) { + return false + } + if !util.StringsMatch(a.SnmpTrap, b.SnmpTrap) { + return false + } + if !util.StringsMatch(a.Tacplus, b.Tacplus) { + return false + } + if !util.StringsMatch(a.Dns, b.Dns) { + return false + } + if !util.StringsMatch(a.Kerberos, b.Kerberos) { + return false + } + if !util.StringsMatch(a.SamlIdp, b.SamlIdp) { + return false + } + return true +} +func matchRoleDeviceWebuiDeviceLocalUserDatabase(a *RoleDeviceWebuiDeviceLocalUserDatabase, b *RoleDeviceWebuiDeviceLocalUserDatabase) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.UserGroups, b.UserGroups) { + return false + } + if !util.StringsMatch(a.Users, b.Users) { + return false + } + return true +} +func matchRoleDeviceWebuiDevicePolicyRecommendations(a *RoleDeviceWebuiDevicePolicyRecommendations, b *RoleDeviceWebuiDevicePolicyRecommendations) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Iot, b.Iot) { + return false + } + if !util.StringsMatch(a.Saas, b.Saas) { + return false + } + return true +} +func matchRoleDeviceWebuiDeviceCertificateManagement(a *RoleDeviceWebuiDeviceCertificateManagement, b *RoleDeviceWebuiDeviceCertificateManagement) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.OcspResponder, b.OcspResponder) { + return false + } + if !util.StringsMatch(a.Scep, b.Scep) { + return false + } + if !util.StringsMatch(a.SshServiceProfile, b.SshServiceProfile) { + return false + } + if !util.StringsMatch(a.SslDecryptionExclusion, b.SslDecryptionExclusion) { + return false + } + if !util.StringsMatch(a.SslTlsServiceProfile, b.SslTlsServiceProfile) { + return false + } + if !util.StringsMatch(a.CertificateProfile, b.CertificateProfile) { + return false + } + if !util.StringsMatch(a.Certificates, b.Certificates) { + return false + } + return true +} +func matchRoleDeviceWebuiDeviceLogSettings(a *RoleDeviceWebuiDeviceLogSettings, b *RoleDeviceWebuiDeviceLogSettings) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Globalprotect, b.Globalprotect) { + return false + } + if !util.StringsMatch(a.Hipmatch, b.Hipmatch) { + return false + } + if !util.StringsMatch(a.Iptag, b.Iptag) { + return false + } + if !util.StringsMatch(a.ManageLog, b.ManageLog) { + return false + } + if !util.StringsMatch(a.System, b.System) { + return false + } + if !util.StringsMatch(a.UserId, b.UserId) { + return false + } + if !util.StringsMatch(a.Correlation, b.Correlation) { + return false + } + if !util.StringsMatch(a.Config, b.Config) { + return false + } + if !util.StringsMatch(a.CcAlarm, b.CcAlarm) { + return false + } + return true +} +func matchRoleDeviceWebuiDevice(a *RoleDeviceWebuiDevice, b *RoleDeviceWebuiDevice) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.AccessDomain, b.AccessDomain) { + return false + } + if !util.StringsMatch(a.DynamicUpdates, b.DynamicUpdates) { + return false + } + if !util.StringsMatch(a.MasterKey, b.MasterKey) { + return false + } + if !matchRoleDeviceWebuiDeviceSetup(a.Setup, b.Setup) { + return false + } + if !util.StringsMatch(a.Support, b.Support) { + return false + } + if !util.StringsMatch(a.Troubleshooting, b.Troubleshooting) { + return false + } + if !util.StringsMatch(a.AuthenticationProfile, b.AuthenticationProfile) { + return false + } + if !util.StringsMatch(a.ConfigAudit, b.ConfigAudit) { + return false + } + if !util.StringsMatch(a.HighAvailability, b.HighAvailability) { + return false + } + if !util.StringsMatch(a.AuthenticationSequence, b.AuthenticationSequence) { + return false + } + if !util.StringsMatch(a.DeviceQuarantine, b.DeviceQuarantine) { + return false + } + if !matchRoleDeviceWebuiDeviceServerProfile(a.ServerProfile, b.ServerProfile) { + return false + } + if !util.StringsMatch(a.UserIdentification, b.UserIdentification) { + return false + } + if !util.StringsMatch(a.VmInfoSource, b.VmInfoSource) { + return false + } + if !util.StringsMatch(a.GlobalProtectClient, b.GlobalProtectClient) { + return false + } + if !matchRoleDeviceWebuiDeviceLocalUserDatabase(a.LocalUserDatabase, b.LocalUserDatabase) { + return false + } + if !util.StringsMatch(a.Plugins, b.Plugins) { + return false + } + if !util.StringsMatch(a.DhcpSyslogServer, b.DhcpSyslogServer) { + return false + } + if !matchRoleDeviceWebuiDevicePolicyRecommendations(a.PolicyRecommendations, b.PolicyRecommendations) { + return false + } + if !util.StringsMatch(a.Software, b.Software) { + return false + } + if !util.StringsMatch(a.AdminRoles, b.AdminRoles) { + return false + } + if !util.StringsMatch(a.Administrators, b.Administrators) { + return false + } + if !matchRoleDeviceWebuiDeviceCertificateManagement(a.CertificateManagement, b.CertificateManagement) { + return false + } + if !util.StringsMatch(a.LogFwdCard, b.LogFwdCard) { + return false + } + if !matchRoleDeviceWebuiDeviceLogSettings(a.LogSettings, b.LogSettings) { + return false + } + if !util.StringsMatch(a.ScheduledLogExport, b.ScheduledLogExport) { + return false + } + if !util.StringsMatch(a.VirtualSystems, b.VirtualSystems) { + return false + } + if !util.StringsMatch(a.BlockPages, b.BlockPages) { + return false + } + if !util.StringsMatch(a.Licenses, b.Licenses) { + return false + } + if !util.StringsMatch(a.SharedGateways, b.SharedGateways) { + return false + } + if !util.StringsMatch(a.DataRedistribution, b.DataRedistribution) { + return false + } + return true +} +func matchRoleDeviceWebuiGlobal(a *RoleDeviceWebuiGlobal, b *RoleDeviceWebuiGlobal) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.SystemAlarms, b.SystemAlarms) { + return false + } + return true +} +func matchRoleDeviceWebuiSave(a *RoleDeviceWebuiSave, b *RoleDeviceWebuiSave) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.ObjectLevelChanges, b.ObjectLevelChanges) { + return false + } + if !util.StringsMatch(a.PartialSave, b.PartialSave) { + return false + } + if !util.StringsMatch(a.SaveForOtherAdmins, b.SaveForOtherAdmins) { + return false + } + return true +} +func matchRoleDeviceWebuiNetworkGlobalProtect(a *RoleDeviceWebuiNetworkGlobalProtect, b *RoleDeviceWebuiNetworkGlobalProtect) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.ClientlessAppGroups, b.ClientlessAppGroups) { + return false + } + if !util.StringsMatch(a.ClientlessApps, b.ClientlessApps) { + return false + } + if !util.StringsMatch(a.Gateways, b.Gateways) { + return false + } + if !util.StringsMatch(a.Mdm, b.Mdm) { + return false + } + if !util.StringsMatch(a.Portals, b.Portals) { + return false + } + return true +} +func matchRoleDeviceWebuiNetworkNetworkProfiles(a *RoleDeviceWebuiNetworkNetworkProfiles, b *RoleDeviceWebuiNetworkNetworkProfiles) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.TunnelMonitor, b.TunnelMonitor) { + return false + } + if !util.StringsMatch(a.ZoneProtection, b.ZoneProtection) { + return false + } + if !util.StringsMatch(a.BfdProfile, b.BfdProfile) { + return false + } + if !util.StringsMatch(a.GpAppIpsecCrypto, b.GpAppIpsecCrypto) { + return false + } + if !util.StringsMatch(a.IpsecCrypto, b.IpsecCrypto) { + return false + } + if !util.StringsMatch(a.QosProfile, b.QosProfile) { + return false + } + if !util.StringsMatch(a.IkeCrypto, b.IkeCrypto) { + return false + } + if !util.StringsMatch(a.IkeGateways, b.IkeGateways) { + return false + } + if !util.StringsMatch(a.InterfaceMgmt, b.InterfaceMgmt) { + return false + } + if !util.StringsMatch(a.LldpProfile, b.LldpProfile) { + return false + } + return true +} +func matchRoleDeviceWebuiNetworkRoutingRoutingProfiles(a *RoleDeviceWebuiNetworkRoutingRoutingProfiles, b *RoleDeviceWebuiNetworkRoutingRoutingProfiles) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Ospfv3, b.Ospfv3) { + return false + } + if !util.StringsMatch(a.Ripv2, b.Ripv2) { + return false + } + if !util.StringsMatch(a.Bfd, b.Bfd) { + return false + } + if !util.StringsMatch(a.Bgp, b.Bgp) { + return false + } + if !util.StringsMatch(a.Filters, b.Filters) { + return false + } + if !util.StringsMatch(a.Multicast, b.Multicast) { + return false + } + if !util.StringsMatch(a.Ospf, b.Ospf) { + return false + } + return true +} +func matchRoleDeviceWebuiNetworkRouting(a *RoleDeviceWebuiNetworkRouting, b *RoleDeviceWebuiNetworkRouting) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.LogicalRouters, b.LogicalRouters) { + return false + } + if !matchRoleDeviceWebuiNetworkRoutingRoutingProfiles(a.RoutingProfiles, b.RoutingProfiles) { + return false + } + return true +} +func matchRoleDeviceWebuiNetwork(a *RoleDeviceWebuiNetwork, b *RoleDeviceWebuiNetwork) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.SdwanInterfaceProfile, b.SdwanInterfaceProfile) { + return false + } + if !util.StringsMatch(a.Zones, b.Zones) { + return false + } + if !util.StringsMatch(a.Dhcp, b.Dhcp) { + return false + } + if !util.StringsMatch(a.GreTunnels, b.GreTunnels) { + return false + } + if !util.StringsMatch(a.IpsecTunnels, b.IpsecTunnels) { + return false + } + if !util.StringsMatch(a.Lldp, b.Lldp) { + return false + } + if !util.StringsMatch(a.Qos, b.Qos) { + return false + } + if !util.StringsMatch(a.Vlans, b.Vlans) { + return false + } + if !util.StringsMatch(a.VirtualWires, b.VirtualWires) { + return false + } + if !util.StringsMatch(a.SecureWebGateway, b.SecureWebGateway) { + return false + } + if !util.StringsMatch(a.DnsProxy, b.DnsProxy) { + return false + } + if !util.StringsMatch(a.Interfaces, b.Interfaces) { + return false + } + if !matchRoleDeviceWebuiNetworkRouting(a.Routing, b.Routing) { + return false + } + if !util.StringsMatch(a.VirtualRouters, b.VirtualRouters) { + return false + } + if !matchRoleDeviceWebuiNetworkGlobalProtect(a.GlobalProtect, b.GlobalProtect) { + return false + } + if !matchRoleDeviceWebuiNetworkNetworkProfiles(a.NetworkProfiles, b.NetworkProfiles) { + return false + } + return true +} +func matchRoleDeviceWebui(a *RoleDeviceWebui, b *RoleDeviceWebui) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Acc, b.Acc) { + return false + } + if !matchRoleDeviceWebuiDevice(a.Device, b.Device) { + return false + } + if !matchRoleDeviceWebuiGlobal(a.Global, b.Global) { + return false + } + if !matchRoleDeviceWebuiSave(a.Save, b.Save) { + return false + } + if !util.StringsMatch(a.Tasks, b.Tasks) { + return false + } + if !util.StringsMatch(a.Dashboard, b.Dashboard) { + return false + } + if !matchRoleDeviceWebuiNetwork(a.Network, b.Network) { + return false + } + if !util.StringsMatch(a.Validate, b.Validate) { + return false + } + if !matchRoleDeviceWebuiPolicies(a.Policies, b.Policies) { + return false + } + if !matchRoleDeviceWebuiPrivacy(a.Privacy, b.Privacy) { + return false + } + if !matchRoleDeviceWebuiCommit(a.Commit, b.Commit) { + return false + } + if !matchRoleDeviceWebuiMonitor(a.Monitor, b.Monitor) { + return false + } + if !matchRoleDeviceWebuiObjects(a.Objects, b.Objects) { + return false + } + if !matchRoleDeviceWebuiOperations(a.Operations, b.Operations) { + return false + } + return true +} +func matchRoleDeviceXmlapi(a *RoleDeviceXmlapi, b *RoleDeviceXmlapi) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Import, b.Import) { + return false + } + if !util.StringsMatch(a.Iot, b.Iot) { + return false + } + if !util.StringsMatch(a.Op, b.Op) { + return false + } + if !util.StringsMatch(a.Report, b.Report) { + return false + } + if !util.StringsMatch(a.Commit, b.Commit) { + return false + } + if !util.StringsMatch(a.Config, b.Config) { + return false + } + if !util.StringsMatch(a.Export, b.Export) { + return false + } + if !util.StringsMatch(a.Log, b.Log) { + return false + } + if !util.StringsMatch(a.UserId, b.UserId) { + return false + } + return true +} +func matchRoleDevice(a *RoleDevice, b *RoleDevice) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchRoleDeviceRestapi(a.Restapi, b.Restapi) { + return false + } + if !matchRoleDeviceWebui(a.Webui, b.Webui) { + return false + } + if !matchRoleDeviceXmlapi(a.Xmlapi, b.Xmlapi) { + return false + } + if !util.StringsMatch(a.Cli, b.Cli) { + return false + } + return true +} +func matchRoleVsysRestapiDevice(a *RoleVsysRestapiDevice, b *RoleVsysRestapiDevice) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.EmailServerProfiles, b.EmailServerProfiles) { + return false + } + if !util.StringsMatch(a.HttpServerProfiles, b.HttpServerProfiles) { + return false + } + if !util.StringsMatch(a.LdapServerProfiles, b.LdapServerProfiles) { + return false + } + if !util.StringsMatch(a.LogInterfaceSetting, b.LogInterfaceSetting) { + return false + } + if !util.StringsMatch(a.SnmpTrapServerProfiles, b.SnmpTrapServerProfiles) { + return false + } + if !util.StringsMatch(a.SyslogServerProfiles, b.SyslogServerProfiles) { + return false + } + if !util.StringsMatch(a.VirtualSystems, b.VirtualSystems) { + return false + } + return true +} +func matchRoleVsysRestapiNetwork(a *RoleVsysRestapiNetwork, b *RoleVsysRestapiNetwork) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.GlobalprotectClientlessAppGroups, b.GlobalprotectClientlessAppGroups) { + return false + } + if !util.StringsMatch(a.GlobalprotectClientlessApps, b.GlobalprotectClientlessApps) { + return false + } + if !util.StringsMatch(a.GlobalprotectGateways, b.GlobalprotectGateways) { + return false + } + if !util.StringsMatch(a.GlobalprotectMdmServers, b.GlobalprotectMdmServers) { + return false + } + if !util.StringsMatch(a.GlobalprotectPortals, b.GlobalprotectPortals) { + return false + } + if !util.StringsMatch(a.Zones, b.Zones) { + return false + } + if !util.StringsMatch(a.SdwanInterfaceProfiles, b.SdwanInterfaceProfiles) { + return false + } + return true +} +func matchRoleVsysRestapiObjects(a *RoleVsysRestapiObjects, b *RoleVsysRestapiObjects) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.AntivirusSecurityProfiles, b.AntivirusSecurityProfiles) { + return false + } + if !util.StringsMatch(a.UrlFilteringSecurityProfiles, b.UrlFilteringSecurityProfiles) { + return false + } + if !util.StringsMatch(a.WildfireAnalysisSecurityProfiles, b.WildfireAnalysisSecurityProfiles) { + return false + } + if !util.StringsMatch(a.DecryptionProfiles, b.DecryptionProfiles) { + return false + } + if !util.StringsMatch(a.DynamicUserGroups, b.DynamicUserGroups) { + return false + } + if !util.StringsMatch(a.GlobalprotectHipObjects, b.GlobalprotectHipObjects) { + return false + } + if !util.StringsMatch(a.GtpProtectionSecurityProfiles, b.GtpProtectionSecurityProfiles) { + return false + } + if !util.StringsMatch(a.SecurityProfileGroups, b.SecurityProfileGroups) { + return false + } + if !util.StringsMatch(a.AuthenticationEnforcements, b.AuthenticationEnforcements) { + return false + } + if !util.StringsMatch(a.LogForwardingProfiles, b.LogForwardingProfiles) { + return false + } + if !util.StringsMatch(a.PacketBrokerProfiles, b.PacketBrokerProfiles) { + return false + } + if !util.StringsMatch(a.Tags, b.Tags) { + return false + } + if !util.StringsMatch(a.ExternalDynamicLists, b.ExternalDynamicLists) { + return false + } + if !util.StringsMatch(a.Schedules, b.Schedules) { + return false + } + if !util.StringsMatch(a.SdwanErrorCorrectionProfiles, b.SdwanErrorCorrectionProfiles) { + return false + } + if !util.StringsMatch(a.SdwanPathQualityProfiles, b.SdwanPathQualityProfiles) { + return false + } + if !util.StringsMatch(a.DosProtectionSecurityProfiles, b.DosProtectionSecurityProfiles) { + return false + } + if !util.StringsMatch(a.Services, b.Services) { + return false + } + if !util.StringsMatch(a.Addresses, b.Addresses) { + return false + } + if !util.StringsMatch(a.ApplicationFilters, b.ApplicationFilters) { + return false + } + if !util.StringsMatch(a.Applications, b.Applications) { + return false + } + if !util.StringsMatch(a.CustomUrlCategories, b.CustomUrlCategories) { + return false + } + if !util.StringsMatch(a.Devices, b.Devices) { + return false + } + if !util.StringsMatch(a.DataFilteringSecurityProfiles, b.DataFilteringSecurityProfiles) { + return false + } + if !util.StringsMatch(a.GlobalprotectHipProfiles, b.GlobalprotectHipProfiles) { + return false + } + if !util.StringsMatch(a.SdwanTrafficDistributionProfiles, b.SdwanTrafficDistributionProfiles) { + return false + } + if !util.StringsMatch(a.SctpProtectionSecurityProfiles, b.SctpProtectionSecurityProfiles) { + return false + } + if !util.StringsMatch(a.ServiceGroups, b.ServiceGroups) { + return false + } + if !util.StringsMatch(a.VulnerabilityProtectionSecurityProfiles, b.VulnerabilityProtectionSecurityProfiles) { + return false + } + if !util.StringsMatch(a.AddressGroups, b.AddressGroups) { + return false + } + if !util.StringsMatch(a.AntiSpywareSecurityProfiles, b.AntiSpywareSecurityProfiles) { + return false + } + if !util.StringsMatch(a.CustomSpywareSignatures, b.CustomSpywareSignatures) { + return false + } + if !util.StringsMatch(a.CustomVulnerabilitySignatures, b.CustomVulnerabilitySignatures) { + return false + } + if !util.StringsMatch(a.FileBlockingSecurityProfiles, b.FileBlockingSecurityProfiles) { + return false + } + if !util.StringsMatch(a.ApplicationGroups, b.ApplicationGroups) { + return false + } + if !util.StringsMatch(a.CustomDataPatterns, b.CustomDataPatterns) { + return false + } + if !util.StringsMatch(a.Regions, b.Regions) { + return false + } + if !util.StringsMatch(a.SdwanSaasQualityProfiles, b.SdwanSaasQualityProfiles) { + return false + } + return true +} +func matchRoleVsysRestapiPolicies(a *RoleVsysRestapiPolicies, b *RoleVsysRestapiPolicies) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.SdwanRules, b.SdwanRules) { + return false + } + if !util.StringsMatch(a.SecurityRules, b.SecurityRules) { + return false + } + if !util.StringsMatch(a.ApplicationOverrideRules, b.ApplicationOverrideRules) { + return false + } + if !util.StringsMatch(a.AuthenticationRules, b.AuthenticationRules) { + return false + } + if !util.StringsMatch(a.DosRules, b.DosRules) { + return false + } + if !util.StringsMatch(a.NatRules, b.NatRules) { + return false + } + if !util.StringsMatch(a.NetworkPacketBrokerRules, b.NetworkPacketBrokerRules) { + return false + } + if !util.StringsMatch(a.DecryptionRules, b.DecryptionRules) { + return false + } + if !util.StringsMatch(a.PolicyBasedForwardingRules, b.PolicyBasedForwardingRules) { + return false + } + if !util.StringsMatch(a.QosRules, b.QosRules) { + return false + } + if !util.StringsMatch(a.TunnelInspectionRules, b.TunnelInspectionRules) { + return false + } + return true +} +func matchRoleVsysRestapiSystem(a *RoleVsysRestapiSystem, b *RoleVsysRestapiSystem) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Configuration, b.Configuration) { + return false + } + return true +} +func matchRoleVsysRestapi(a *RoleVsysRestapi, b *RoleVsysRestapi) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchRoleVsysRestapiPolicies(a.Policies, b.Policies) { + return false + } + if !matchRoleVsysRestapiSystem(a.System, b.System) { + return false + } + if !matchRoleVsysRestapiDevice(a.Device, b.Device) { + return false + } + if !matchRoleVsysRestapiNetwork(a.Network, b.Network) { + return false + } + if !matchRoleVsysRestapiObjects(a.Objects, b.Objects) { + return false + } + return true +} +func matchRoleVsysWebuiPolicies(a *RoleVsysWebuiPolicies, b *RoleVsysWebuiPolicies) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.RuleHitCountReset, b.RuleHitCountReset) { + return false + } + if !util.StringsMatch(a.SdwanRulebase, b.SdwanRulebase) { + return false + } + if !util.StringsMatch(a.SecurityRulebase, b.SecurityRulebase) { + return false + } + if !util.StringsMatch(a.AuthenticationRulebase, b.AuthenticationRulebase) { + return false + } + if !util.StringsMatch(a.DosRulebase, b.DosRulebase) { + return false + } + if !util.StringsMatch(a.NatRulebase, b.NatRulebase) { + return false + } + if !util.StringsMatch(a.NetworkPacketBrokerRulebase, b.NetworkPacketBrokerRulebase) { + return false + } + if !util.StringsMatch(a.PbfRulebase, b.PbfRulebase) { + return false + } + if !util.StringsMatch(a.ApplicationOverrideRulebase, b.ApplicationOverrideRulebase) { + return false + } + if !util.StringsMatch(a.QosRulebase, b.QosRulebase) { + return false + } + if !util.StringsMatch(a.SslDecryptionRulebase, b.SslDecryptionRulebase) { + return false + } + if !util.StringsMatch(a.TunnelInspectRulebase, b.TunnelInspectRulebase) { + return false + } + return true +} +func matchRoleVsysWebuiNetworkGlobalProtect(a *RoleVsysWebuiNetworkGlobalProtect, b *RoleVsysWebuiNetworkGlobalProtect) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.ClientlessAppGroups, b.ClientlessAppGroups) { + return false + } + if !util.StringsMatch(a.ClientlessApps, b.ClientlessApps) { + return false + } + if !util.StringsMatch(a.Gateways, b.Gateways) { + return false + } + if !util.StringsMatch(a.Mdm, b.Mdm) { + return false + } + if !util.StringsMatch(a.Portals, b.Portals) { + return false + } + return true +} +func matchRoleVsysWebuiNetwork(a *RoleVsysWebuiNetwork, b *RoleVsysWebuiNetwork) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchRoleVsysWebuiNetworkGlobalProtect(a.GlobalProtect, b.GlobalProtect) { + return false + } + if !util.StringsMatch(a.SdwanInterfaceProfile, b.SdwanInterfaceProfile) { + return false + } + if !util.StringsMatch(a.Zones, b.Zones) { + return false + } + return true +} +func matchRoleVsysWebuiObjectsSdwan(a *RoleVsysWebuiObjectsSdwan, b *RoleVsysWebuiObjectsSdwan) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.SdwanSaasQualityProfile, b.SdwanSaasQualityProfile) { + return false + } + if !util.StringsMatch(a.SdwanDistProfile, b.SdwanDistProfile) { + return false + } + if !util.StringsMatch(a.SdwanErrorCorrectionProfile, b.SdwanErrorCorrectionProfile) { + return false + } + if !util.StringsMatch(a.SdwanProfile, b.SdwanProfile) { + return false + } + return true +} +func matchRoleVsysWebuiObjectsGlobalProtect(a *RoleVsysWebuiObjectsGlobalProtect, b *RoleVsysWebuiObjectsGlobalProtect) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.HipObjects, b.HipObjects) { + return false + } + if !util.StringsMatch(a.HipProfiles, b.HipProfiles) { + return false + } + return true +} +func matchRoleVsysWebuiObjectsSecurityProfiles(a *RoleVsysWebuiObjectsSecurityProfiles, b *RoleVsysWebuiObjectsSecurityProfiles) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.AntiSpyware, b.AntiSpyware) { + return false + } + if !util.StringsMatch(a.Antivirus, b.Antivirus) { + return false + } + if !util.StringsMatch(a.DataFiltering, b.DataFiltering) { + return false + } + if !util.StringsMatch(a.SctpProtection, b.SctpProtection) { + return false + } + if !util.StringsMatch(a.WildfireAnalysis, b.WildfireAnalysis) { + return false + } + if !util.StringsMatch(a.DosProtection, b.DosProtection) { + return false + } + if !util.StringsMatch(a.FileBlocking, b.FileBlocking) { + return false + } + if !util.StringsMatch(a.GtpProtection, b.GtpProtection) { + return false + } + if !util.StringsMatch(a.UrlFiltering, b.UrlFiltering) { + return false + } + if !util.StringsMatch(a.VulnerabilityProtection, b.VulnerabilityProtection) { + return false + } + return true +} +func matchRoleVsysWebuiObjectsDecryption(a *RoleVsysWebuiObjectsDecryption, b *RoleVsysWebuiObjectsDecryption) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.DecryptionProfile, b.DecryptionProfile) { + return false + } + return true +} +func matchRoleVsysWebuiObjectsCustomObjects(a *RoleVsysWebuiObjectsCustomObjects, b *RoleVsysWebuiObjectsCustomObjects) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.DataPatterns, b.DataPatterns) { + return false + } + if !util.StringsMatch(a.Spyware, b.Spyware) { + return false + } + if !util.StringsMatch(a.UrlCategory, b.UrlCategory) { + return false + } + if !util.StringsMatch(a.Vulnerability, b.Vulnerability) { + return false + } + return true +} +func matchRoleVsysWebuiObjects(a *RoleVsysWebuiObjects, b *RoleVsysWebuiObjects) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.DynamicBlockLists, b.DynamicBlockLists) { + return false + } + if !util.StringsMatch(a.DynamicUserGroups, b.DynamicUserGroups) { + return false + } + if !util.StringsMatch(a.PacketBrokerProfile, b.PacketBrokerProfile) { + return false + } + if !matchRoleVsysWebuiObjectsSdwan(a.Sdwan, b.Sdwan) { + return false + } + if !util.StringsMatch(a.Addresses, b.Addresses) { + return false + } + if !matchRoleVsysWebuiObjectsDecryption(a.Decryption, b.Decryption) { + return false + } + if !util.StringsMatch(a.Devices, b.Devices) { + return false + } + if !matchRoleVsysWebuiObjectsGlobalProtect(a.GlobalProtect, b.GlobalProtect) { + return false + } + if !util.StringsMatch(a.Schedules, b.Schedules) { + return false + } + if !matchRoleVsysWebuiObjectsSecurityProfiles(a.SecurityProfiles, b.SecurityProfiles) { + return false + } + if !util.StringsMatch(a.ServiceGroups, b.ServiceGroups) { + return false + } + if !util.StringsMatch(a.AddressGroups, b.AddressGroups) { + return false + } + if !util.StringsMatch(a.ApplicationGroups, b.ApplicationGroups) { + return false + } + if !util.StringsMatch(a.Applications, b.Applications) { + return false + } + if !util.StringsMatch(a.Authentication, b.Authentication) { + return false + } + if !util.StringsMatch(a.Regions, b.Regions) { + return false + } + if !util.StringsMatch(a.Tags, b.Tags) { + return false + } + if !util.StringsMatch(a.ApplicationFilters, b.ApplicationFilters) { + return false + } + if !matchRoleVsysWebuiObjectsCustomObjects(a.CustomObjects, b.CustomObjects) { + return false + } + if !util.StringsMatch(a.LogForwarding, b.LogForwarding) { + return false + } + if !util.StringsMatch(a.SecurityProfileGroups, b.SecurityProfileGroups) { + return false + } + if !util.StringsMatch(a.Services, b.Services) { + return false + } + return true +} +func matchRoleVsysWebuiOperations(a *RoleVsysWebuiOperations, b *RoleVsysWebuiOperations) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.GenerateTechSupportFile, b.GenerateTechSupportFile) { + return false + } + if !util.StringsMatch(a.Reboot, b.Reboot) { + return false + } + if !util.StringsMatch(a.DownloadCoreFiles, b.DownloadCoreFiles) { + return false + } + if !util.StringsMatch(a.DownloadPcapFiles, b.DownloadPcapFiles) { + return false + } + if !util.StringsMatch(a.GenerateStatsDumpFile, b.GenerateStatsDumpFile) { + return false + } + return true +} +func matchRoleVsysWebuiPrivacy(a *RoleVsysWebuiPrivacy, b *RoleVsysWebuiPrivacy) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.ShowUserNamesInLogsAndReports, b.ShowUserNamesInLogsAndReports) { + return false + } + if !util.StringsMatch(a.ViewPcapFiles, b.ViewPcapFiles) { + return false + } + if !util.StringsMatch(a.ShowFullIpAddresses, b.ShowFullIpAddresses) { + return false + } + return true +} +func matchRoleVsysWebuiSave(a *RoleVsysWebuiSave, b *RoleVsysWebuiSave) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.PartialSave, b.PartialSave) { + return false + } + if !util.StringsMatch(a.SaveForOtherAdmins, b.SaveForOtherAdmins) { + return false + } + if !util.StringsMatch(a.ObjectLevelChanges, b.ObjectLevelChanges) { + return false + } + return true +} +func matchRoleVsysWebuiCommit(a *RoleVsysWebuiCommit, b *RoleVsysWebuiCommit) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.CommitForOtherAdmins, b.CommitForOtherAdmins) { + return false + } + if !util.StringsMatch(a.VirtualSystems, b.VirtualSystems) { + return false + } + return true +} +func matchRoleVsysWebuiDeviceSetup(a *RoleVsysWebuiDeviceSetup, b *RoleVsysWebuiDeviceSetup) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Hsm, b.Hsm) { + return false + } + if !util.StringsMatch(a.Interfaces, b.Interfaces) { + return false + } + if !util.StringsMatch(a.Management, b.Management) { + return false + } + if !util.StringsMatch(a.Operations, b.Operations) { + return false + } + if !util.StringsMatch(a.ContentId, b.ContentId) { + return false + } + if !util.StringsMatch(a.Services, b.Services) { + return false + } + if !util.StringsMatch(a.Session, b.Session) { + return false + } + if !util.StringsMatch(a.Telemetry, b.Telemetry) { + return false + } + if !util.StringsMatch(a.Wildfire, b.Wildfire) { + return false + } + return true +} +func matchRoleVsysWebuiDeviceCertificateManagement(a *RoleVsysWebuiDeviceCertificateManagement, b *RoleVsysWebuiDeviceCertificateManagement) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.SslTlsServiceProfile, b.SslTlsServiceProfile) { + return false + } + if !util.StringsMatch(a.CertificateProfile, b.CertificateProfile) { + return false + } + if !util.StringsMatch(a.Certificates, b.Certificates) { + return false + } + if !util.StringsMatch(a.OcspResponder, b.OcspResponder) { + return false + } + if !util.StringsMatch(a.Scep, b.Scep) { + return false + } + if !util.StringsMatch(a.SshServiceProfile, b.SshServiceProfile) { + return false + } + if !util.StringsMatch(a.SslDecryptionExclusion, b.SslDecryptionExclusion) { + return false + } + return true +} +func matchRoleVsysWebuiDeviceLocalUserDatabase(a *RoleVsysWebuiDeviceLocalUserDatabase, b *RoleVsysWebuiDeviceLocalUserDatabase) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.UserGroups, b.UserGroups) { + return false + } + if !util.StringsMatch(a.Users, b.Users) { + return false + } + return true +} +func matchRoleVsysWebuiDeviceLogSettings(a *RoleVsysWebuiDeviceLogSettings, b *RoleVsysWebuiDeviceLogSettings) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.UserId, b.UserId) { + return false + } + if !util.StringsMatch(a.Config, b.Config) { + return false + } + if !util.StringsMatch(a.Correlation, b.Correlation) { + return false + } + if !util.StringsMatch(a.Globalprotect, b.Globalprotect) { + return false + } + if !util.StringsMatch(a.Hipmatch, b.Hipmatch) { + return false + } + if !util.StringsMatch(a.Iptag, b.Iptag) { + return false + } + if !util.StringsMatch(a.System, b.System) { + return false + } + return true +} +func matchRoleVsysWebuiDeviceServerProfile(a *RoleVsysWebuiDeviceServerProfile, b *RoleVsysWebuiDeviceServerProfile) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Tacplus, b.Tacplus) { + return false + } + if !util.StringsMatch(a.Dns, b.Dns) { + return false + } + if !util.StringsMatch(a.Http, b.Http) { + return false + } + if !util.StringsMatch(a.Netflow, b.Netflow) { + return false + } + if !util.StringsMatch(a.SamlIdp, b.SamlIdp) { + return false + } + if !util.StringsMatch(a.SnmpTrap, b.SnmpTrap) { + return false + } + if !util.StringsMatch(a.Scp, b.Scp) { + return false + } + if !util.StringsMatch(a.Syslog, b.Syslog) { + return false + } + if !util.StringsMatch(a.Email, b.Email) { + return false + } + if !util.StringsMatch(a.Kerberos, b.Kerberos) { + return false + } + if !util.StringsMatch(a.Ldap, b.Ldap) { + return false + } + if !util.StringsMatch(a.Mfa, b.Mfa) { + return false + } + if !util.StringsMatch(a.Radius, b.Radius) { + return false + } + return true +} +func matchRoleVsysWebuiDevicePolicyRecommendations(a *RoleVsysWebuiDevicePolicyRecommendations, b *RoleVsysWebuiDevicePolicyRecommendations) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Iot, b.Iot) { + return false + } + if !util.StringsMatch(a.Saas, b.Saas) { + return false + } + return true +} +func matchRoleVsysWebuiDevice(a *RoleVsysWebuiDevice, b *RoleVsysWebuiDevice) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.AuthenticationProfile, b.AuthenticationProfile) { + return false + } + if !matchRoleVsysWebuiDeviceSetup(a.Setup, b.Setup) { + return false + } + if !util.StringsMatch(a.Troubleshooting, b.Troubleshooting) { + return false + } + if !util.StringsMatch(a.VmInfoSource, b.VmInfoSource) { + return false + } + if !util.StringsMatch(a.DataRedistribution, b.DataRedistribution) { + return false + } + if !matchRoleVsysWebuiDeviceLocalUserDatabase(a.LocalUserDatabase, b.LocalUserDatabase) { + return false + } + if !matchRoleVsysWebuiDeviceLogSettings(a.LogSettings, b.LogSettings) { + return false + } + if !matchRoleVsysWebuiDeviceServerProfile(a.ServerProfile, b.ServerProfile) { + return false + } + if !util.StringsMatch(a.Administrators, b.Administrators) { + return false + } + if !util.StringsMatch(a.AuthenticationSequence, b.AuthenticationSequence) { + return false + } + if !util.StringsMatch(a.BlockPages, b.BlockPages) { + return false + } + if !matchRoleVsysWebuiDeviceCertificateManagement(a.CertificateManagement, b.CertificateManagement) { + return false + } + if !util.StringsMatch(a.UserIdentification, b.UserIdentification) { + return false + } + if !util.StringsMatch(a.DeviceQuarantine, b.DeviceQuarantine) { + return false + } + if !matchRoleVsysWebuiDevicePolicyRecommendations(a.PolicyRecommendations, b.PolicyRecommendations) { + return false + } + if !util.StringsMatch(a.DhcpSyslogServer, b.DhcpSyslogServer) { + return false + } + return true +} +func matchRoleVsysWebuiMonitorAutomatedCorrelationEngine(a *RoleVsysWebuiMonitorAutomatedCorrelationEngine, b *RoleVsysWebuiMonitorAutomatedCorrelationEngine) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.CorrelatedEvents, b.CorrelatedEvents) { + return false + } + if !util.StringsMatch(a.CorrelationObjects, b.CorrelationObjects) { + return false + } + return true +} +func matchRoleVsysWebuiMonitorCustomReports(a *RoleVsysWebuiMonitorCustomReports, b *RoleVsysWebuiMonitorCustomReports) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Auth, b.Auth) { + return false + } + if !util.StringsMatch(a.DecryptionSummary, b.DecryptionSummary) { + return false + } + if !util.StringsMatch(a.ThreatSummary, b.ThreatSummary) { + return false + } + if !util.StringsMatch(a.WildfireLog, b.WildfireLog) { + return false + } + if !util.StringsMatch(a.DecryptionLog, b.DecryptionLog) { + return false + } + if !util.StringsMatch(a.GtpLog, b.GtpLog) { + return false + } + if !util.StringsMatch(a.TrafficLog, b.TrafficLog) { + return false + } + if !util.StringsMatch(a.TunnelSummary, b.TunnelSummary) { + return false + } + if !util.StringsMatch(a.DataFilteringLog, b.DataFilteringLog) { + return false + } + if !util.StringsMatch(a.GtpSummary, b.GtpSummary) { + return false + } + if !util.StringsMatch(a.SctpLog, b.SctpLog) { + return false + } + if !util.StringsMatch(a.SctpSummary, b.SctpSummary) { + return false + } + if !util.StringsMatch(a.UrlLog, b.UrlLog) { + return false + } + if !util.StringsMatch(a.ApplicationStatistics, b.ApplicationStatistics) { + return false + } + if !util.StringsMatch(a.Globalprotect, b.Globalprotect) { + return false + } + if !util.StringsMatch(a.Hipmatch, b.Hipmatch) { + return false + } + if !util.StringsMatch(a.Iptag, b.Iptag) { + return false + } + if !util.StringsMatch(a.ThreatLog, b.ThreatLog) { + return false + } + if !util.StringsMatch(a.TrafficSummary, b.TrafficSummary) { + return false + } + if !util.StringsMatch(a.TunnelLog, b.TunnelLog) { + return false + } + if !util.StringsMatch(a.UrlSummary, b.UrlSummary) { + return false + } + if !util.StringsMatch(a.Userid, b.Userid) { + return false + } + return true +} +func matchRoleVsysWebuiMonitorLogs(a *RoleVsysWebuiMonitorLogs, b *RoleVsysWebuiMonitorLogs) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Tunnel, b.Tunnel) { + return false + } + if !util.StringsMatch(a.Wildfire, b.Wildfire) { + return false + } + if !util.StringsMatch(a.Userid, b.Userid) { + return false + } + if !util.StringsMatch(a.Authentication, b.Authentication) { + return false + } + if !util.StringsMatch(a.DataFiltering, b.DataFiltering) { + return false + } + if !util.StringsMatch(a.Sctp, b.Sctp) { + return false + } + if !util.StringsMatch(a.Threat, b.Threat) { + return false + } + if !util.StringsMatch(a.Url, b.Url) { + return false + } + if !util.StringsMatch(a.Traffic, b.Traffic) { + return false + } + if !util.StringsMatch(a.Decryption, b.Decryption) { + return false + } + if !util.StringsMatch(a.Globalprotect, b.Globalprotect) { + return false + } + if !util.StringsMatch(a.Gtp, b.Gtp) { + return false + } + if !util.StringsMatch(a.Hipmatch, b.Hipmatch) { + return false + } + if !util.StringsMatch(a.Iptag, b.Iptag) { + return false + } + return true +} +func matchRoleVsysWebuiMonitorPdfReports(a *RoleVsysWebuiMonitorPdfReports, b *RoleVsysWebuiMonitorPdfReports) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.SaasApplicationUsageReport, b.SaasApplicationUsageReport) { + return false + } + if !util.StringsMatch(a.UserActivityReport, b.UserActivityReport) { + return false + } + if !util.StringsMatch(a.EmailScheduler, b.EmailScheduler) { + return false + } + if !util.StringsMatch(a.ManagePdfSummary, b.ManagePdfSummary) { + return false + } + if !util.StringsMatch(a.PdfSummaryReports, b.PdfSummaryReports) { + return false + } + if !util.StringsMatch(a.ReportGroups, b.ReportGroups) { + return false + } + return true +} +func matchRoleVsysWebuiMonitor(a *RoleVsysWebuiMonitor, b *RoleVsysWebuiMonitor) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.BlockIpList, b.BlockIpList) { + return false + } + if !matchRoleVsysWebuiMonitorCustomReports(a.CustomReports, b.CustomReports) { + return false + } + if !util.StringsMatch(a.ExternalLogs, b.ExternalLogs) { + return false + } + if !matchRoleVsysWebuiMonitorLogs(a.Logs, b.Logs) { + return false + } + if !matchRoleVsysWebuiMonitorPdfReports(a.PdfReports, b.PdfReports) { + return false + } + if !util.StringsMatch(a.AppScope, b.AppScope) { + return false + } + if !matchRoleVsysWebuiMonitorAutomatedCorrelationEngine(a.AutomatedCorrelationEngine, b.AutomatedCorrelationEngine) { + return false + } + if !util.StringsMatch(a.SessionBrowser, b.SessionBrowser) { + return false + } + if !util.StringsMatch(a.ViewCustomReports, b.ViewCustomReports) { + return false + } + return true +} +func matchRoleVsysWebui(a *RoleVsysWebui, b *RoleVsysWebui) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchRoleVsysWebuiPolicies(a.Policies, b.Policies) { + return false + } + if !util.StringsMatch(a.Validate, b.Validate) { + return false + } + if !util.StringsMatch(a.Acc, b.Acc) { + return false + } + if !util.StringsMatch(a.Dashboard, b.Dashboard) { + return false + } + if !matchRoleVsysWebuiMonitor(a.Monitor, b.Monitor) { + return false + } + if !matchRoleVsysWebuiNetwork(a.Network, b.Network) { + return false + } + if !matchRoleVsysWebuiObjects(a.Objects, b.Objects) { + return false + } + if !matchRoleVsysWebuiOperations(a.Operations, b.Operations) { + return false + } + if !matchRoleVsysWebuiPrivacy(a.Privacy, b.Privacy) { + return false + } + if !matchRoleVsysWebuiSave(a.Save, b.Save) { + return false + } + if !matchRoleVsysWebuiCommit(a.Commit, b.Commit) { + return false + } + if !matchRoleVsysWebuiDevice(a.Device, b.Device) { + return false + } + if !util.StringsMatch(a.Tasks, b.Tasks) { + return false + } + return true +} +func matchRoleVsysXmlapi(a *RoleVsysXmlapi, b *RoleVsysXmlapi) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Commit, b.Commit) { + return false + } + if !util.StringsMatch(a.Export, b.Export) { + return false + } + if !util.StringsMatch(a.Iot, b.Iot) { + return false + } + if !util.StringsMatch(a.Op, b.Op) { + return false + } + if !util.StringsMatch(a.Report, b.Report) { + return false + } + if !util.StringsMatch(a.Config, b.Config) { + return false + } + if !util.StringsMatch(a.Import, b.Import) { + return false + } + if !util.StringsMatch(a.Log, b.Log) { + return false + } + if !util.StringsMatch(a.UserId, b.UserId) { + return false + } + return true +} +func matchRoleVsys(a *RoleVsys, b *RoleVsys) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Cli, b.Cli) { + return false + } + if !matchRoleVsysRestapi(a.Restapi, b.Restapi) { + return false + } + if !matchRoleVsysWebui(a.Webui, b.Webui) { + return false + } + if !matchRoleVsysXmlapi(a.Xmlapi, b.Xmlapi) { + return false + } + return true +} +func matchRole(a *Role, b *Role) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchRoleDevice(a.Device, b.Device) { + return false + } + if !matchRoleVsys(a.Vsys, b.Vsys) { + return false + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/device/adminrole/interfaces.go b/device/adminrole/interfaces.go new file mode 100644 index 00000000..317fb26a --- /dev/null +++ b/device/adminrole/interfaces.go @@ -0,0 +1,7 @@ +package adminrole + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/device/adminrole/location.go b/device/adminrole/location.go new file mode 100644 index 00000000..574bf9bb --- /dev/null +++ b/device/adminrole/location.go @@ -0,0 +1,107 @@ +package adminrole + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + Template *TemplateLocation `json:"template,omitempty"` +} + +type TemplateLocation struct { + PanoramaDevice string `json:"panorama_device"` + Template string `json:"template"` +} + +func NewTemplateLocation() *Location { + return &Location{Template: &TemplateLocation{ + PanoramaDevice: "localhost.localdomain", + Template: "", + }, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.Template != nil: + if o.Template.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return fmt.Errorf("Template is unspecified") + } + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.Template != nil: + if o.Template.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return nil, fmt.Errorf("Template is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Template.PanoramaDevice}), + "template", + util.AsEntryXpath([]string{o.Template.Template}), + "config", + "shared", + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/device/adminrole/service.go b/device/adminrole/service.go new file mode 100644 index 00000000..8f478b4e --- /dev/null +++ b/device/adminrole/service.go @@ -0,0 +1,281 @@ +package adminrole + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/device/dynamicupdates/config.go b/device/dynamicupdates/config.go new file mode 100644 index 00000000..2f0a8fbe --- /dev/null +++ b/device/dynamicupdates/config.go @@ -0,0 +1,2328 @@ +package dynamicupdates + +import ( + "encoding/xml" + + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type Config struct { + UpdateSchedule *UpdateSchedule + + Misc map[string][]generic.Xml +} +type UpdateSchedule struct { + AntiVirus *UpdateScheduleAntiVirus + AppProfile *UpdateScheduleAppProfile + GlobalProtectClientlessVpn *UpdateScheduleGlobalProtectClientlessVpn + GlobalProtectDatafile *UpdateScheduleGlobalProtectDatafile + StatisticsService *UpdateScheduleStatisticsService + Threats *UpdateScheduleThreats + WfPrivate *UpdateScheduleWfPrivate + Wildfire *UpdateScheduleWildfire +} +type UpdateScheduleAntiVirus struct { + Recurring *UpdateScheduleAntiVirusRecurring +} +type UpdateScheduleAntiVirusRecurring struct { + SyncToPeer *bool + Threshold *int64 + Daily *UpdateScheduleAntiVirusRecurringDaily + Hourly *UpdateScheduleAntiVirusRecurringHourly + None *UpdateScheduleAntiVirusRecurringNone + Weekly *UpdateScheduleAntiVirusRecurringWeekly +} +type UpdateScheduleAntiVirusRecurringDaily struct { + Action *string + At *string +} +type UpdateScheduleAntiVirusRecurringHourly struct { + Action *string + At *int64 +} +type UpdateScheduleAntiVirusRecurringNone struct { +} +type UpdateScheduleAntiVirusRecurringWeekly struct { + Action *string + At *string + DayOfWeek *string +} +type UpdateScheduleAppProfile struct { + Recurring *UpdateScheduleAppProfileRecurring +} +type UpdateScheduleAppProfileRecurring struct { + SyncToPeer *bool + Threshold *int64 + Daily *UpdateScheduleAppProfileRecurringDaily + None *UpdateScheduleAppProfileRecurringNone + Weekly *UpdateScheduleAppProfileRecurringWeekly +} +type UpdateScheduleAppProfileRecurringDaily struct { + Action *string + At *string +} +type UpdateScheduleAppProfileRecurringNone struct { +} +type UpdateScheduleAppProfileRecurringWeekly struct { + Action *string + At *string + DayOfWeek *string +} +type UpdateScheduleGlobalProtectClientlessVpn struct { + Recurring *UpdateScheduleGlobalProtectClientlessVpnRecurring +} +type UpdateScheduleGlobalProtectClientlessVpnRecurring struct { + Daily *UpdateScheduleGlobalProtectClientlessVpnRecurringDaily + Hourly *UpdateScheduleGlobalProtectClientlessVpnRecurringHourly + None *UpdateScheduleGlobalProtectClientlessVpnRecurringNone + Weekly *UpdateScheduleGlobalProtectClientlessVpnRecurringWeekly +} +type UpdateScheduleGlobalProtectClientlessVpnRecurringDaily struct { + Action *string + At *string +} +type UpdateScheduleGlobalProtectClientlessVpnRecurringHourly struct { + Action *string + At *int64 +} +type UpdateScheduleGlobalProtectClientlessVpnRecurringNone struct { +} +type UpdateScheduleGlobalProtectClientlessVpnRecurringWeekly struct { + Action *string + At *string + DayOfWeek *string +} +type UpdateScheduleGlobalProtectDatafile struct { + Recurring *UpdateScheduleGlobalProtectDatafileRecurring +} +type UpdateScheduleGlobalProtectDatafileRecurring struct { + Daily *UpdateScheduleGlobalProtectDatafileRecurringDaily + Hourly *UpdateScheduleGlobalProtectDatafileRecurringHourly + None *UpdateScheduleGlobalProtectDatafileRecurringNone + Weekly *UpdateScheduleGlobalProtectDatafileRecurringWeekly +} +type UpdateScheduleGlobalProtectDatafileRecurringDaily struct { + Action *string + At *string +} +type UpdateScheduleGlobalProtectDatafileRecurringHourly struct { + Action *string + At *int64 +} +type UpdateScheduleGlobalProtectDatafileRecurringNone struct { +} +type UpdateScheduleGlobalProtectDatafileRecurringWeekly struct { + Action *string + At *string + DayOfWeek *string +} +type UpdateScheduleStatisticsService struct { + ApplicationReports *bool + FileIdentificationReports *bool + HealthPerformanceReports *bool + PassiveDnsMonitoring *bool + ThreatPreventionInformation *bool + ThreatPreventionPcap *bool + ThreatPreventionReports *bool + UrlReports *bool +} +type UpdateScheduleThreats struct { + Recurring *UpdateScheduleThreatsRecurring +} +type UpdateScheduleThreatsRecurring struct { + NewAppThreshold *int64 + SyncToPeer *bool + Threshold *int64 + Daily *UpdateScheduleThreatsRecurringDaily + Every30Mins *UpdateScheduleThreatsRecurringEvery30Mins + Hourly *UpdateScheduleThreatsRecurringHourly + None *UpdateScheduleThreatsRecurringNone + Weekly *UpdateScheduleThreatsRecurringWeekly +} +type UpdateScheduleThreatsRecurringDaily struct { + Action *string + At *string + DisableNewContent *bool +} +type UpdateScheduleThreatsRecurringEvery30Mins struct { + Action *string + At *int64 + DisableNewContent *bool +} +type UpdateScheduleThreatsRecurringHourly struct { + Action *string + At *int64 + DisableNewContent *bool +} +type UpdateScheduleThreatsRecurringNone struct { +} +type UpdateScheduleThreatsRecurringWeekly struct { + Action *string + At *string + DayOfWeek *string + DisableNewContent *bool +} +type UpdateScheduleWfPrivate struct { + Recurring *UpdateScheduleWfPrivateRecurring +} +type UpdateScheduleWfPrivateRecurring struct { + SyncToPeer *bool + Every15Mins *UpdateScheduleWfPrivateRecurringEvery15Mins + Every30Mins *UpdateScheduleWfPrivateRecurringEvery30Mins + Every5Mins *UpdateScheduleWfPrivateRecurringEvery5Mins + EveryHour *UpdateScheduleWfPrivateRecurringEveryHour + None *UpdateScheduleWfPrivateRecurringNone +} +type UpdateScheduleWfPrivateRecurringEvery15Mins struct { + Action *string + At *int64 +} +type UpdateScheduleWfPrivateRecurringEvery30Mins struct { + Action *string + At *int64 +} +type UpdateScheduleWfPrivateRecurringEvery5Mins struct { + Action *string + At *int64 +} +type UpdateScheduleWfPrivateRecurringEveryHour struct { + Action *string + At *int64 +} +type UpdateScheduleWfPrivateRecurringNone struct { +} +type UpdateScheduleWildfire struct { + Recurring *UpdateScheduleWildfireRecurring +} +type UpdateScheduleWildfireRecurring struct { + Every15Mins *UpdateScheduleWildfireRecurringEvery15Mins + Every30Mins *UpdateScheduleWildfireRecurringEvery30Mins + EveryHour *UpdateScheduleWildfireRecurringEveryHour + EveryMin *UpdateScheduleWildfireRecurringEveryMin + None *UpdateScheduleWildfireRecurringNone + RealTime *UpdateScheduleWildfireRecurringRealTime +} +type UpdateScheduleWildfireRecurringEvery15Mins struct { + Action *string + At *int64 + SyncToPeer *bool +} +type UpdateScheduleWildfireRecurringEvery30Mins struct { + Action *string + At *int64 + SyncToPeer *bool +} +type UpdateScheduleWildfireRecurringEveryHour struct { + Action *string + At *int64 + SyncToPeer *bool +} +type UpdateScheduleWildfireRecurringEveryMin struct { + Action *string + SyncToPeer *bool +} +type UpdateScheduleWildfireRecurringNone struct { +} +type UpdateScheduleWildfireRecurringRealTime struct { +} +type configXmlContainer struct { + XMLName xml.Name `xml:"result"` + Answer []configXml `xml:"system"` +} +type configXml struct { + XMLName xml.Name `xml:"system"` + UpdateSchedule *UpdateScheduleXml `xml:"update-schedule,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleXml struct { + AntiVirus *UpdateScheduleAntiVirusXml `xml:"anti-virus,omitempty"` + AppProfile *UpdateScheduleAppProfileXml `xml:"app-profile,omitempty"` + GlobalProtectClientlessVpn *UpdateScheduleGlobalProtectClientlessVpnXml `xml:"global-protect-clientless-vpn,omitempty"` + GlobalProtectDatafile *UpdateScheduleGlobalProtectDatafileXml `xml:"global-protect-datafile,omitempty"` + StatisticsService *UpdateScheduleStatisticsServiceXml `xml:"statistics-service,omitempty"` + Threats *UpdateScheduleThreatsXml `xml:"threats,omitempty"` + WfPrivate *UpdateScheduleWfPrivateXml `xml:"wf-private,omitempty"` + Wildfire *UpdateScheduleWildfireXml `xml:"wildfire,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleAntiVirusXml struct { + Recurring *UpdateScheduleAntiVirusRecurringXml `xml:"recurring,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleAntiVirusRecurringXml struct { + SyncToPeer *string `xml:"sync-to-peer,omitempty"` + Threshold *int64 `xml:"threshold,omitempty"` + Daily *UpdateScheduleAntiVirusRecurringDailyXml `xml:"daily,omitempty"` + Hourly *UpdateScheduleAntiVirusRecurringHourlyXml `xml:"hourly,omitempty"` + None *UpdateScheduleAntiVirusRecurringNoneXml `xml:"none,omitempty"` + Weekly *UpdateScheduleAntiVirusRecurringWeeklyXml `xml:"weekly,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleAntiVirusRecurringDailyXml struct { + Action *string `xml:"action,omitempty"` + At *string `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleAntiVirusRecurringHourlyXml struct { + Action *string `xml:"action,omitempty"` + At *int64 `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleAntiVirusRecurringNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleAntiVirusRecurringWeeklyXml struct { + Action *string `xml:"action,omitempty"` + At *string `xml:"at,omitempty"` + DayOfWeek *string `xml:"day-of-week,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleAppProfileXml struct { + Recurring *UpdateScheduleAppProfileRecurringXml `xml:"recurring,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleAppProfileRecurringXml struct { + SyncToPeer *string `xml:"sync-to-peer,omitempty"` + Threshold *int64 `xml:"threshold,omitempty"` + Daily *UpdateScheduleAppProfileRecurringDailyXml `xml:"daily,omitempty"` + None *UpdateScheduleAppProfileRecurringNoneXml `xml:"none,omitempty"` + Weekly *UpdateScheduleAppProfileRecurringWeeklyXml `xml:"weekly,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleAppProfileRecurringDailyXml struct { + Action *string `xml:"action,omitempty"` + At *string `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleAppProfileRecurringNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleAppProfileRecurringWeeklyXml struct { + Action *string `xml:"action,omitempty"` + At *string `xml:"at,omitempty"` + DayOfWeek *string `xml:"day-of-week,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleGlobalProtectClientlessVpnXml struct { + Recurring *UpdateScheduleGlobalProtectClientlessVpnRecurringXml `xml:"recurring,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleGlobalProtectClientlessVpnRecurringXml struct { + Daily *UpdateScheduleGlobalProtectClientlessVpnRecurringDailyXml `xml:"daily,omitempty"` + Hourly *UpdateScheduleGlobalProtectClientlessVpnRecurringHourlyXml `xml:"hourly,omitempty"` + None *UpdateScheduleGlobalProtectClientlessVpnRecurringNoneXml `xml:"none,omitempty"` + Weekly *UpdateScheduleGlobalProtectClientlessVpnRecurringWeeklyXml `xml:"weekly,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleGlobalProtectClientlessVpnRecurringDailyXml struct { + Action *string `xml:"action,omitempty"` + At *string `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleGlobalProtectClientlessVpnRecurringHourlyXml struct { + Action *string `xml:"action,omitempty"` + At *int64 `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleGlobalProtectClientlessVpnRecurringNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleGlobalProtectClientlessVpnRecurringWeeklyXml struct { + Action *string `xml:"action,omitempty"` + At *string `xml:"at,omitempty"` + DayOfWeek *string `xml:"day-of-week,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleGlobalProtectDatafileXml struct { + Recurring *UpdateScheduleGlobalProtectDatafileRecurringXml `xml:"recurring,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleGlobalProtectDatafileRecurringXml struct { + Daily *UpdateScheduleGlobalProtectDatafileRecurringDailyXml `xml:"daily,omitempty"` + Hourly *UpdateScheduleGlobalProtectDatafileRecurringHourlyXml `xml:"hourly,omitempty"` + None *UpdateScheduleGlobalProtectDatafileRecurringNoneXml `xml:"none,omitempty"` + Weekly *UpdateScheduleGlobalProtectDatafileRecurringWeeklyXml `xml:"weekly,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleGlobalProtectDatafileRecurringDailyXml struct { + Action *string `xml:"action,omitempty"` + At *string `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleGlobalProtectDatafileRecurringHourlyXml struct { + Action *string `xml:"action,omitempty"` + At *int64 `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleGlobalProtectDatafileRecurringNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleGlobalProtectDatafileRecurringWeeklyXml struct { + Action *string `xml:"action,omitempty"` + At *string `xml:"at,omitempty"` + DayOfWeek *string `xml:"day-of-week,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleStatisticsServiceXml struct { + ApplicationReports *string `xml:"application-reports,omitempty"` + FileIdentificationReports *string `xml:"file-identification-reports,omitempty"` + HealthPerformanceReports *string `xml:"health-performance-reports,omitempty"` + PassiveDnsMonitoring *string `xml:"passive-dns-monitoring,omitempty"` + ThreatPreventionInformation *string `xml:"threat-prevention-information,omitempty"` + ThreatPreventionPcap *string `xml:"threat-prevention-pcap,omitempty"` + ThreatPreventionReports *string `xml:"threat-prevention-reports,omitempty"` + UrlReports *string `xml:"url-reports,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleThreatsXml struct { + Recurring *UpdateScheduleThreatsRecurringXml `xml:"recurring,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleThreatsRecurringXml struct { + NewAppThreshold *int64 `xml:"new-app-threshold,omitempty"` + SyncToPeer *string `xml:"sync-to-peer,omitempty"` + Threshold *int64 `xml:"threshold,omitempty"` + Daily *UpdateScheduleThreatsRecurringDailyXml `xml:"daily,omitempty"` + Every30Mins *UpdateScheduleThreatsRecurringEvery30MinsXml `xml:"every-30-mins,omitempty"` + Hourly *UpdateScheduleThreatsRecurringHourlyXml `xml:"hourly,omitempty"` + None *UpdateScheduleThreatsRecurringNoneXml `xml:"none,omitempty"` + Weekly *UpdateScheduleThreatsRecurringWeeklyXml `xml:"weekly,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleThreatsRecurringDailyXml struct { + Action *string `xml:"action,omitempty"` + At *string `xml:"at,omitempty"` + DisableNewContent *string `xml:"disable-new-content,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleThreatsRecurringEvery30MinsXml struct { + Action *string `xml:"action,omitempty"` + At *int64 `xml:"at,omitempty"` + DisableNewContent *string `xml:"disable-new-content,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleThreatsRecurringHourlyXml struct { + Action *string `xml:"action,omitempty"` + At *int64 `xml:"at,omitempty"` + DisableNewContent *string `xml:"disable-new-content,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleThreatsRecurringNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleThreatsRecurringWeeklyXml struct { + Action *string `xml:"action,omitempty"` + At *string `xml:"at,omitempty"` + DayOfWeek *string `xml:"day-of-week,omitempty"` + DisableNewContent *string `xml:"disable-new-content,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleWfPrivateXml struct { + Recurring *UpdateScheduleWfPrivateRecurringXml `xml:"recurring,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleWfPrivateRecurringXml struct { + SyncToPeer *string `xml:"sync-to-peer,omitempty"` + Every15Mins *UpdateScheduleWfPrivateRecurringEvery15MinsXml `xml:"every-15-mins,omitempty"` + Every30Mins *UpdateScheduleWfPrivateRecurringEvery30MinsXml `xml:"every-30-mins,omitempty"` + Every5Mins *UpdateScheduleWfPrivateRecurringEvery5MinsXml `xml:"every-5-mins,omitempty"` + EveryHour *UpdateScheduleWfPrivateRecurringEveryHourXml `xml:"every-hour,omitempty"` + None *UpdateScheduleWfPrivateRecurringNoneXml `xml:"none,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleWfPrivateRecurringEvery15MinsXml struct { + Action *string `xml:"action,omitempty"` + At *int64 `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleWfPrivateRecurringEvery30MinsXml struct { + Action *string `xml:"action,omitempty"` + At *int64 `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleWfPrivateRecurringEvery5MinsXml struct { + Action *string `xml:"action,omitempty"` + At *int64 `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleWfPrivateRecurringEveryHourXml struct { + Action *string `xml:"action,omitempty"` + At *int64 `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleWfPrivateRecurringNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleWildfireXml struct { + Recurring *UpdateScheduleWildfireRecurringXml `xml:"recurring,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleWildfireRecurringXml struct { + Every15Mins *UpdateScheduleWildfireRecurringEvery15MinsXml `xml:"every-15-mins,omitempty"` + Every30Mins *UpdateScheduleWildfireRecurringEvery30MinsXml `xml:"every-30-mins,omitempty"` + EveryHour *UpdateScheduleWildfireRecurringEveryHourXml `xml:"every-hour,omitempty"` + EveryMin *UpdateScheduleWildfireRecurringEveryMinXml `xml:"every-min,omitempty"` + None *UpdateScheduleWildfireRecurringNoneXml `xml:"none,omitempty"` + RealTime *UpdateScheduleWildfireRecurringRealTimeXml `xml:"real-time,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleWildfireRecurringEvery15MinsXml struct { + Action *string `xml:"action,omitempty"` + At *int64 `xml:"at,omitempty"` + SyncToPeer *string `xml:"sync-to-peer,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleWildfireRecurringEvery30MinsXml struct { + Action *string `xml:"action,omitempty"` + At *int64 `xml:"at,omitempty"` + SyncToPeer *string `xml:"sync-to-peer,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleWildfireRecurringEveryHourXml struct { + Action *string `xml:"action,omitempty"` + At *int64 `xml:"at,omitempty"` + SyncToPeer *string `xml:"sync-to-peer,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleWildfireRecurringEveryMinXml struct { + Action *string `xml:"action,omitempty"` + SyncToPeer *string `xml:"sync-to-peer,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleWildfireRecurringNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type UpdateScheduleWildfireRecurringRealTimeXml struct { + Misc []generic.Xml `xml:",any"` +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + return specifyConfig, &configXmlContainer{}, nil +} +func specifyConfig(o *Config) (any, error) { + config := configXml{} + var nestedUpdateSchedule *UpdateScheduleXml + if o.UpdateSchedule != nil { + nestedUpdateSchedule = &UpdateScheduleXml{} + if _, ok := o.Misc["UpdateSchedule"]; ok { + nestedUpdateSchedule.Misc = o.Misc["UpdateSchedule"] + } + if o.UpdateSchedule.Threats != nil { + nestedUpdateSchedule.Threats = &UpdateScheduleThreatsXml{} + if _, ok := o.Misc["UpdateScheduleThreats"]; ok { + nestedUpdateSchedule.Threats.Misc = o.Misc["UpdateScheduleThreats"] + } + if o.UpdateSchedule.Threats.Recurring != nil { + nestedUpdateSchedule.Threats.Recurring = &UpdateScheduleThreatsRecurringXml{} + if _, ok := o.Misc["UpdateScheduleThreatsRecurring"]; ok { + nestedUpdateSchedule.Threats.Recurring.Misc = o.Misc["UpdateScheduleThreatsRecurring"] + } + if o.UpdateSchedule.Threats.Recurring.Threshold != nil { + nestedUpdateSchedule.Threats.Recurring.Threshold = o.UpdateSchedule.Threats.Recurring.Threshold + } + if o.UpdateSchedule.Threats.Recurring.NewAppThreshold != nil { + nestedUpdateSchedule.Threats.Recurring.NewAppThreshold = o.UpdateSchedule.Threats.Recurring.NewAppThreshold + } + if o.UpdateSchedule.Threats.Recurring.SyncToPeer != nil { + nestedUpdateSchedule.Threats.Recurring.SyncToPeer = util.YesNo(o.UpdateSchedule.Threats.Recurring.SyncToPeer, nil) + } + if o.UpdateSchedule.Threats.Recurring.Daily != nil { + nestedUpdateSchedule.Threats.Recurring.Daily = &UpdateScheduleThreatsRecurringDailyXml{} + if _, ok := o.Misc["UpdateScheduleThreatsRecurringDaily"]; ok { + nestedUpdateSchedule.Threats.Recurring.Daily.Misc = o.Misc["UpdateScheduleThreatsRecurringDaily"] + } + if o.UpdateSchedule.Threats.Recurring.Daily.At != nil { + nestedUpdateSchedule.Threats.Recurring.Daily.At = o.UpdateSchedule.Threats.Recurring.Daily.At + } + if o.UpdateSchedule.Threats.Recurring.Daily.DisableNewContent != nil { + nestedUpdateSchedule.Threats.Recurring.Daily.DisableNewContent = util.YesNo(o.UpdateSchedule.Threats.Recurring.Daily.DisableNewContent, nil) + } + if o.UpdateSchedule.Threats.Recurring.Daily.Action != nil { + nestedUpdateSchedule.Threats.Recurring.Daily.Action = o.UpdateSchedule.Threats.Recurring.Daily.Action + } + } + if o.UpdateSchedule.Threats.Recurring.Every30Mins != nil { + nestedUpdateSchedule.Threats.Recurring.Every30Mins = &UpdateScheduleThreatsRecurringEvery30MinsXml{} + if _, ok := o.Misc["UpdateScheduleThreatsRecurringEvery30Mins"]; ok { + nestedUpdateSchedule.Threats.Recurring.Every30Mins.Misc = o.Misc["UpdateScheduleThreatsRecurringEvery30Mins"] + } + if o.UpdateSchedule.Threats.Recurring.Every30Mins.At != nil { + nestedUpdateSchedule.Threats.Recurring.Every30Mins.At = o.UpdateSchedule.Threats.Recurring.Every30Mins.At + } + if o.UpdateSchedule.Threats.Recurring.Every30Mins.DisableNewContent != nil { + nestedUpdateSchedule.Threats.Recurring.Every30Mins.DisableNewContent = util.YesNo(o.UpdateSchedule.Threats.Recurring.Every30Mins.DisableNewContent, nil) + } + if o.UpdateSchedule.Threats.Recurring.Every30Mins.Action != nil { + nestedUpdateSchedule.Threats.Recurring.Every30Mins.Action = o.UpdateSchedule.Threats.Recurring.Every30Mins.Action + } + } + if o.UpdateSchedule.Threats.Recurring.Hourly != nil { + nestedUpdateSchedule.Threats.Recurring.Hourly = &UpdateScheduleThreatsRecurringHourlyXml{} + if _, ok := o.Misc["UpdateScheduleThreatsRecurringHourly"]; ok { + nestedUpdateSchedule.Threats.Recurring.Hourly.Misc = o.Misc["UpdateScheduleThreatsRecurringHourly"] + } + if o.UpdateSchedule.Threats.Recurring.Hourly.At != nil { + nestedUpdateSchedule.Threats.Recurring.Hourly.At = o.UpdateSchedule.Threats.Recurring.Hourly.At + } + if o.UpdateSchedule.Threats.Recurring.Hourly.DisableNewContent != nil { + nestedUpdateSchedule.Threats.Recurring.Hourly.DisableNewContent = util.YesNo(o.UpdateSchedule.Threats.Recurring.Hourly.DisableNewContent, nil) + } + if o.UpdateSchedule.Threats.Recurring.Hourly.Action != nil { + nestedUpdateSchedule.Threats.Recurring.Hourly.Action = o.UpdateSchedule.Threats.Recurring.Hourly.Action + } + } + if o.UpdateSchedule.Threats.Recurring.None != nil { + nestedUpdateSchedule.Threats.Recurring.None = &UpdateScheduleThreatsRecurringNoneXml{} + if _, ok := o.Misc["UpdateScheduleThreatsRecurringNone"]; ok { + nestedUpdateSchedule.Threats.Recurring.None.Misc = o.Misc["UpdateScheduleThreatsRecurringNone"] + } + } + if o.UpdateSchedule.Threats.Recurring.Weekly != nil { + nestedUpdateSchedule.Threats.Recurring.Weekly = &UpdateScheduleThreatsRecurringWeeklyXml{} + if _, ok := o.Misc["UpdateScheduleThreatsRecurringWeekly"]; ok { + nestedUpdateSchedule.Threats.Recurring.Weekly.Misc = o.Misc["UpdateScheduleThreatsRecurringWeekly"] + } + if o.UpdateSchedule.Threats.Recurring.Weekly.Action != nil { + nestedUpdateSchedule.Threats.Recurring.Weekly.Action = o.UpdateSchedule.Threats.Recurring.Weekly.Action + } + if o.UpdateSchedule.Threats.Recurring.Weekly.At != nil { + nestedUpdateSchedule.Threats.Recurring.Weekly.At = o.UpdateSchedule.Threats.Recurring.Weekly.At + } + if o.UpdateSchedule.Threats.Recurring.Weekly.DayOfWeek != nil { + nestedUpdateSchedule.Threats.Recurring.Weekly.DayOfWeek = o.UpdateSchedule.Threats.Recurring.Weekly.DayOfWeek + } + if o.UpdateSchedule.Threats.Recurring.Weekly.DisableNewContent != nil { + nestedUpdateSchedule.Threats.Recurring.Weekly.DisableNewContent = util.YesNo(o.UpdateSchedule.Threats.Recurring.Weekly.DisableNewContent, nil) + } + } + } + } + if o.UpdateSchedule.WfPrivate != nil { + nestedUpdateSchedule.WfPrivate = &UpdateScheduleWfPrivateXml{} + if _, ok := o.Misc["UpdateScheduleWfPrivate"]; ok { + nestedUpdateSchedule.WfPrivate.Misc = o.Misc["UpdateScheduleWfPrivate"] + } + if o.UpdateSchedule.WfPrivate.Recurring != nil { + nestedUpdateSchedule.WfPrivate.Recurring = &UpdateScheduleWfPrivateRecurringXml{} + if _, ok := o.Misc["UpdateScheduleWfPrivateRecurring"]; ok { + nestedUpdateSchedule.WfPrivate.Recurring.Misc = o.Misc["UpdateScheduleWfPrivateRecurring"] + } + if o.UpdateSchedule.WfPrivate.Recurring.SyncToPeer != nil { + nestedUpdateSchedule.WfPrivate.Recurring.SyncToPeer = util.YesNo(o.UpdateSchedule.WfPrivate.Recurring.SyncToPeer, nil) + } + if o.UpdateSchedule.WfPrivate.Recurring.Every30Mins != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every30Mins = &UpdateScheduleWfPrivateRecurringEvery30MinsXml{} + if _, ok := o.Misc["UpdateScheduleWfPrivateRecurringEvery30Mins"]; ok { + nestedUpdateSchedule.WfPrivate.Recurring.Every30Mins.Misc = o.Misc["UpdateScheduleWfPrivateRecurringEvery30Mins"] + } + if o.UpdateSchedule.WfPrivate.Recurring.Every30Mins.Action != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every30Mins.Action = o.UpdateSchedule.WfPrivate.Recurring.Every30Mins.Action + } + if o.UpdateSchedule.WfPrivate.Recurring.Every30Mins.At != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every30Mins.At = o.UpdateSchedule.WfPrivate.Recurring.Every30Mins.At + } + } + if o.UpdateSchedule.WfPrivate.Recurring.Every5Mins != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every5Mins = &UpdateScheduleWfPrivateRecurringEvery5MinsXml{} + if _, ok := o.Misc["UpdateScheduleWfPrivateRecurringEvery5Mins"]; ok { + nestedUpdateSchedule.WfPrivate.Recurring.Every5Mins.Misc = o.Misc["UpdateScheduleWfPrivateRecurringEvery5Mins"] + } + if o.UpdateSchedule.WfPrivate.Recurring.Every5Mins.Action != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every5Mins.Action = o.UpdateSchedule.WfPrivate.Recurring.Every5Mins.Action + } + if o.UpdateSchedule.WfPrivate.Recurring.Every5Mins.At != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every5Mins.At = o.UpdateSchedule.WfPrivate.Recurring.Every5Mins.At + } + } + if o.UpdateSchedule.WfPrivate.Recurring.EveryHour != nil { + nestedUpdateSchedule.WfPrivate.Recurring.EveryHour = &UpdateScheduleWfPrivateRecurringEveryHourXml{} + if _, ok := o.Misc["UpdateScheduleWfPrivateRecurringEveryHour"]; ok { + nestedUpdateSchedule.WfPrivate.Recurring.EveryHour.Misc = o.Misc["UpdateScheduleWfPrivateRecurringEveryHour"] + } + if o.UpdateSchedule.WfPrivate.Recurring.EveryHour.At != nil { + nestedUpdateSchedule.WfPrivate.Recurring.EveryHour.At = o.UpdateSchedule.WfPrivate.Recurring.EveryHour.At + } + if o.UpdateSchedule.WfPrivate.Recurring.EveryHour.Action != nil { + nestedUpdateSchedule.WfPrivate.Recurring.EveryHour.Action = o.UpdateSchedule.WfPrivate.Recurring.EveryHour.Action + } + } + if o.UpdateSchedule.WfPrivate.Recurring.None != nil { + nestedUpdateSchedule.WfPrivate.Recurring.None = &UpdateScheduleWfPrivateRecurringNoneXml{} + if _, ok := o.Misc["UpdateScheduleWfPrivateRecurringNone"]; ok { + nestedUpdateSchedule.WfPrivate.Recurring.None.Misc = o.Misc["UpdateScheduleWfPrivateRecurringNone"] + } + } + if o.UpdateSchedule.WfPrivate.Recurring.Every15Mins != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every15Mins = &UpdateScheduleWfPrivateRecurringEvery15MinsXml{} + if _, ok := o.Misc["UpdateScheduleWfPrivateRecurringEvery15Mins"]; ok { + nestedUpdateSchedule.WfPrivate.Recurring.Every15Mins.Misc = o.Misc["UpdateScheduleWfPrivateRecurringEvery15Mins"] + } + if o.UpdateSchedule.WfPrivate.Recurring.Every15Mins.Action != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every15Mins.Action = o.UpdateSchedule.WfPrivate.Recurring.Every15Mins.Action + } + if o.UpdateSchedule.WfPrivate.Recurring.Every15Mins.At != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every15Mins.At = o.UpdateSchedule.WfPrivate.Recurring.Every15Mins.At + } + } + } + } + if o.UpdateSchedule.Wildfire != nil { + nestedUpdateSchedule.Wildfire = &UpdateScheduleWildfireXml{} + if _, ok := o.Misc["UpdateScheduleWildfire"]; ok { + nestedUpdateSchedule.Wildfire.Misc = o.Misc["UpdateScheduleWildfire"] + } + if o.UpdateSchedule.Wildfire.Recurring != nil { + nestedUpdateSchedule.Wildfire.Recurring = &UpdateScheduleWildfireRecurringXml{} + if _, ok := o.Misc["UpdateScheduleWildfireRecurring"]; ok { + nestedUpdateSchedule.Wildfire.Recurring.Misc = o.Misc["UpdateScheduleWildfireRecurring"] + } + if o.UpdateSchedule.Wildfire.Recurring.None != nil { + nestedUpdateSchedule.Wildfire.Recurring.None = &UpdateScheduleWildfireRecurringNoneXml{} + if _, ok := o.Misc["UpdateScheduleWildfireRecurringNone"]; ok { + nestedUpdateSchedule.Wildfire.Recurring.None.Misc = o.Misc["UpdateScheduleWildfireRecurringNone"] + } + } + if o.UpdateSchedule.Wildfire.Recurring.RealTime != nil { + nestedUpdateSchedule.Wildfire.Recurring.RealTime = &UpdateScheduleWildfireRecurringRealTimeXml{} + if _, ok := o.Misc["UpdateScheduleWildfireRecurringRealTime"]; ok { + nestedUpdateSchedule.Wildfire.Recurring.RealTime.Misc = o.Misc["UpdateScheduleWildfireRecurringRealTime"] + } + } + if o.UpdateSchedule.Wildfire.Recurring.Every15Mins != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every15Mins = &UpdateScheduleWildfireRecurringEvery15MinsXml{} + if _, ok := o.Misc["UpdateScheduleWildfireRecurringEvery15Mins"]; ok { + nestedUpdateSchedule.Wildfire.Recurring.Every15Mins.Misc = o.Misc["UpdateScheduleWildfireRecurringEvery15Mins"] + } + if o.UpdateSchedule.Wildfire.Recurring.Every15Mins.Action != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every15Mins.Action = o.UpdateSchedule.Wildfire.Recurring.Every15Mins.Action + } + if o.UpdateSchedule.Wildfire.Recurring.Every15Mins.At != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every15Mins.At = o.UpdateSchedule.Wildfire.Recurring.Every15Mins.At + } + if o.UpdateSchedule.Wildfire.Recurring.Every15Mins.SyncToPeer != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every15Mins.SyncToPeer = util.YesNo(o.UpdateSchedule.Wildfire.Recurring.Every15Mins.SyncToPeer, nil) + } + } + if o.UpdateSchedule.Wildfire.Recurring.Every30Mins != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every30Mins = &UpdateScheduleWildfireRecurringEvery30MinsXml{} + if _, ok := o.Misc["UpdateScheduleWildfireRecurringEvery30Mins"]; ok { + nestedUpdateSchedule.Wildfire.Recurring.Every30Mins.Misc = o.Misc["UpdateScheduleWildfireRecurringEvery30Mins"] + } + if o.UpdateSchedule.Wildfire.Recurring.Every30Mins.Action != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every30Mins.Action = o.UpdateSchedule.Wildfire.Recurring.Every30Mins.Action + } + if o.UpdateSchedule.Wildfire.Recurring.Every30Mins.At != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every30Mins.At = o.UpdateSchedule.Wildfire.Recurring.Every30Mins.At + } + if o.UpdateSchedule.Wildfire.Recurring.Every30Mins.SyncToPeer != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every30Mins.SyncToPeer = util.YesNo(o.UpdateSchedule.Wildfire.Recurring.Every30Mins.SyncToPeer, nil) + } + } + if o.UpdateSchedule.Wildfire.Recurring.EveryHour != nil { + nestedUpdateSchedule.Wildfire.Recurring.EveryHour = &UpdateScheduleWildfireRecurringEveryHourXml{} + if _, ok := o.Misc["UpdateScheduleWildfireRecurringEveryHour"]; ok { + nestedUpdateSchedule.Wildfire.Recurring.EveryHour.Misc = o.Misc["UpdateScheduleWildfireRecurringEveryHour"] + } + if o.UpdateSchedule.Wildfire.Recurring.EveryHour.Action != nil { + nestedUpdateSchedule.Wildfire.Recurring.EveryHour.Action = o.UpdateSchedule.Wildfire.Recurring.EveryHour.Action + } + if o.UpdateSchedule.Wildfire.Recurring.EveryHour.At != nil { + nestedUpdateSchedule.Wildfire.Recurring.EveryHour.At = o.UpdateSchedule.Wildfire.Recurring.EveryHour.At + } + if o.UpdateSchedule.Wildfire.Recurring.EveryHour.SyncToPeer != nil { + nestedUpdateSchedule.Wildfire.Recurring.EveryHour.SyncToPeer = util.YesNo(o.UpdateSchedule.Wildfire.Recurring.EveryHour.SyncToPeer, nil) + } + } + if o.UpdateSchedule.Wildfire.Recurring.EveryMin != nil { + nestedUpdateSchedule.Wildfire.Recurring.EveryMin = &UpdateScheduleWildfireRecurringEveryMinXml{} + if _, ok := o.Misc["UpdateScheduleWildfireRecurringEveryMin"]; ok { + nestedUpdateSchedule.Wildfire.Recurring.EveryMin.Misc = o.Misc["UpdateScheduleWildfireRecurringEveryMin"] + } + if o.UpdateSchedule.Wildfire.Recurring.EveryMin.Action != nil { + nestedUpdateSchedule.Wildfire.Recurring.EveryMin.Action = o.UpdateSchedule.Wildfire.Recurring.EveryMin.Action + } + if o.UpdateSchedule.Wildfire.Recurring.EveryMin.SyncToPeer != nil { + nestedUpdateSchedule.Wildfire.Recurring.EveryMin.SyncToPeer = util.YesNo(o.UpdateSchedule.Wildfire.Recurring.EveryMin.SyncToPeer, nil) + } + } + } + } + if o.UpdateSchedule.AntiVirus != nil { + nestedUpdateSchedule.AntiVirus = &UpdateScheduleAntiVirusXml{} + if _, ok := o.Misc["UpdateScheduleAntiVirus"]; ok { + nestedUpdateSchedule.AntiVirus.Misc = o.Misc["UpdateScheduleAntiVirus"] + } + if o.UpdateSchedule.AntiVirus.Recurring != nil { + nestedUpdateSchedule.AntiVirus.Recurring = &UpdateScheduleAntiVirusRecurringXml{} + if _, ok := o.Misc["UpdateScheduleAntiVirusRecurring"]; ok { + nestedUpdateSchedule.AntiVirus.Recurring.Misc = o.Misc["UpdateScheduleAntiVirusRecurring"] + } + if o.UpdateSchedule.AntiVirus.Recurring.SyncToPeer != nil { + nestedUpdateSchedule.AntiVirus.Recurring.SyncToPeer = util.YesNo(o.UpdateSchedule.AntiVirus.Recurring.SyncToPeer, nil) + } + if o.UpdateSchedule.AntiVirus.Recurring.Threshold != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Threshold = o.UpdateSchedule.AntiVirus.Recurring.Threshold + } + if o.UpdateSchedule.AntiVirus.Recurring.Daily != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Daily = &UpdateScheduleAntiVirusRecurringDailyXml{} + if _, ok := o.Misc["UpdateScheduleAntiVirusRecurringDaily"]; ok { + nestedUpdateSchedule.AntiVirus.Recurring.Daily.Misc = o.Misc["UpdateScheduleAntiVirusRecurringDaily"] + } + if o.UpdateSchedule.AntiVirus.Recurring.Daily.Action != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Daily.Action = o.UpdateSchedule.AntiVirus.Recurring.Daily.Action + } + if o.UpdateSchedule.AntiVirus.Recurring.Daily.At != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Daily.At = o.UpdateSchedule.AntiVirus.Recurring.Daily.At + } + } + if o.UpdateSchedule.AntiVirus.Recurring.Hourly != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Hourly = &UpdateScheduleAntiVirusRecurringHourlyXml{} + if _, ok := o.Misc["UpdateScheduleAntiVirusRecurringHourly"]; ok { + nestedUpdateSchedule.AntiVirus.Recurring.Hourly.Misc = o.Misc["UpdateScheduleAntiVirusRecurringHourly"] + } + if o.UpdateSchedule.AntiVirus.Recurring.Hourly.Action != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Hourly.Action = o.UpdateSchedule.AntiVirus.Recurring.Hourly.Action + } + if o.UpdateSchedule.AntiVirus.Recurring.Hourly.At != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Hourly.At = o.UpdateSchedule.AntiVirus.Recurring.Hourly.At + } + } + if o.UpdateSchedule.AntiVirus.Recurring.None != nil { + nestedUpdateSchedule.AntiVirus.Recurring.None = &UpdateScheduleAntiVirusRecurringNoneXml{} + if _, ok := o.Misc["UpdateScheduleAntiVirusRecurringNone"]; ok { + nestedUpdateSchedule.AntiVirus.Recurring.None.Misc = o.Misc["UpdateScheduleAntiVirusRecurringNone"] + } + } + if o.UpdateSchedule.AntiVirus.Recurring.Weekly != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Weekly = &UpdateScheduleAntiVirusRecurringWeeklyXml{} + if _, ok := o.Misc["UpdateScheduleAntiVirusRecurringWeekly"]; ok { + nestedUpdateSchedule.AntiVirus.Recurring.Weekly.Misc = o.Misc["UpdateScheduleAntiVirusRecurringWeekly"] + } + if o.UpdateSchedule.AntiVirus.Recurring.Weekly.Action != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Weekly.Action = o.UpdateSchedule.AntiVirus.Recurring.Weekly.Action + } + if o.UpdateSchedule.AntiVirus.Recurring.Weekly.At != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Weekly.At = o.UpdateSchedule.AntiVirus.Recurring.Weekly.At + } + if o.UpdateSchedule.AntiVirus.Recurring.Weekly.DayOfWeek != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Weekly.DayOfWeek = o.UpdateSchedule.AntiVirus.Recurring.Weekly.DayOfWeek + } + } + } + } + if o.UpdateSchedule.AppProfile != nil { + nestedUpdateSchedule.AppProfile = &UpdateScheduleAppProfileXml{} + if _, ok := o.Misc["UpdateScheduleAppProfile"]; ok { + nestedUpdateSchedule.AppProfile.Misc = o.Misc["UpdateScheduleAppProfile"] + } + if o.UpdateSchedule.AppProfile.Recurring != nil { + nestedUpdateSchedule.AppProfile.Recurring = &UpdateScheduleAppProfileRecurringXml{} + if _, ok := o.Misc["UpdateScheduleAppProfileRecurring"]; ok { + nestedUpdateSchedule.AppProfile.Recurring.Misc = o.Misc["UpdateScheduleAppProfileRecurring"] + } + if o.UpdateSchedule.AppProfile.Recurring.SyncToPeer != nil { + nestedUpdateSchedule.AppProfile.Recurring.SyncToPeer = util.YesNo(o.UpdateSchedule.AppProfile.Recurring.SyncToPeer, nil) + } + if o.UpdateSchedule.AppProfile.Recurring.Threshold != nil { + nestedUpdateSchedule.AppProfile.Recurring.Threshold = o.UpdateSchedule.AppProfile.Recurring.Threshold + } + if o.UpdateSchedule.AppProfile.Recurring.Daily != nil { + nestedUpdateSchedule.AppProfile.Recurring.Daily = &UpdateScheduleAppProfileRecurringDailyXml{} + if _, ok := o.Misc["UpdateScheduleAppProfileRecurringDaily"]; ok { + nestedUpdateSchedule.AppProfile.Recurring.Daily.Misc = o.Misc["UpdateScheduleAppProfileRecurringDaily"] + } + if o.UpdateSchedule.AppProfile.Recurring.Daily.Action != nil { + nestedUpdateSchedule.AppProfile.Recurring.Daily.Action = o.UpdateSchedule.AppProfile.Recurring.Daily.Action + } + if o.UpdateSchedule.AppProfile.Recurring.Daily.At != nil { + nestedUpdateSchedule.AppProfile.Recurring.Daily.At = o.UpdateSchedule.AppProfile.Recurring.Daily.At + } + } + if o.UpdateSchedule.AppProfile.Recurring.None != nil { + nestedUpdateSchedule.AppProfile.Recurring.None = &UpdateScheduleAppProfileRecurringNoneXml{} + if _, ok := o.Misc["UpdateScheduleAppProfileRecurringNone"]; ok { + nestedUpdateSchedule.AppProfile.Recurring.None.Misc = o.Misc["UpdateScheduleAppProfileRecurringNone"] + } + } + if o.UpdateSchedule.AppProfile.Recurring.Weekly != nil { + nestedUpdateSchedule.AppProfile.Recurring.Weekly = &UpdateScheduleAppProfileRecurringWeeklyXml{} + if _, ok := o.Misc["UpdateScheduleAppProfileRecurringWeekly"]; ok { + nestedUpdateSchedule.AppProfile.Recurring.Weekly.Misc = o.Misc["UpdateScheduleAppProfileRecurringWeekly"] + } + if o.UpdateSchedule.AppProfile.Recurring.Weekly.DayOfWeek != nil { + nestedUpdateSchedule.AppProfile.Recurring.Weekly.DayOfWeek = o.UpdateSchedule.AppProfile.Recurring.Weekly.DayOfWeek + } + if o.UpdateSchedule.AppProfile.Recurring.Weekly.Action != nil { + nestedUpdateSchedule.AppProfile.Recurring.Weekly.Action = o.UpdateSchedule.AppProfile.Recurring.Weekly.Action + } + if o.UpdateSchedule.AppProfile.Recurring.Weekly.At != nil { + nestedUpdateSchedule.AppProfile.Recurring.Weekly.At = o.UpdateSchedule.AppProfile.Recurring.Weekly.At + } + } + } + } + if o.UpdateSchedule.GlobalProtectClientlessVpn != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn = &UpdateScheduleGlobalProtectClientlessVpnXml{} + if _, ok := o.Misc["UpdateScheduleGlobalProtectClientlessVpn"]; ok { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Misc = o.Misc["UpdateScheduleGlobalProtectClientlessVpn"] + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring = &UpdateScheduleGlobalProtectClientlessVpnRecurringXml{} + if _, ok := o.Misc["UpdateScheduleGlobalProtectClientlessVpnRecurring"]; ok { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Misc = o.Misc["UpdateScheduleGlobalProtectClientlessVpnRecurring"] + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly = &UpdateScheduleGlobalProtectClientlessVpnRecurringWeeklyXml{} + if _, ok := o.Misc["UpdateScheduleGlobalProtectClientlessVpnRecurringWeekly"]; ok { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.Misc = o.Misc["UpdateScheduleGlobalProtectClientlessVpnRecurringWeekly"] + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.At != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.At = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.At + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.DayOfWeek != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.DayOfWeek = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.DayOfWeek + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.Action != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.Action = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.Action + } + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily = &UpdateScheduleGlobalProtectClientlessVpnRecurringDailyXml{} + if _, ok := o.Misc["UpdateScheduleGlobalProtectClientlessVpnRecurringDaily"]; ok { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily.Misc = o.Misc["UpdateScheduleGlobalProtectClientlessVpnRecurringDaily"] + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily.Action != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily.Action = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily.Action + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily.At != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily.At = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily.At + } + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly = &UpdateScheduleGlobalProtectClientlessVpnRecurringHourlyXml{} + if _, ok := o.Misc["UpdateScheduleGlobalProtectClientlessVpnRecurringHourly"]; ok { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly.Misc = o.Misc["UpdateScheduleGlobalProtectClientlessVpnRecurringHourly"] + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly.Action != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly.Action = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly.Action + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly.At != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly.At = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly.At + } + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.None != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.None = &UpdateScheduleGlobalProtectClientlessVpnRecurringNoneXml{} + if _, ok := o.Misc["UpdateScheduleGlobalProtectClientlessVpnRecurringNone"]; ok { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.None.Misc = o.Misc["UpdateScheduleGlobalProtectClientlessVpnRecurringNone"] + } + } + } + } + if o.UpdateSchedule.GlobalProtectDatafile != nil { + nestedUpdateSchedule.GlobalProtectDatafile = &UpdateScheduleGlobalProtectDatafileXml{} + if _, ok := o.Misc["UpdateScheduleGlobalProtectDatafile"]; ok { + nestedUpdateSchedule.GlobalProtectDatafile.Misc = o.Misc["UpdateScheduleGlobalProtectDatafile"] + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring = &UpdateScheduleGlobalProtectDatafileRecurringXml{} + if _, ok := o.Misc["UpdateScheduleGlobalProtectDatafileRecurring"]; ok { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Misc = o.Misc["UpdateScheduleGlobalProtectDatafileRecurring"] + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Daily != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Daily = &UpdateScheduleGlobalProtectDatafileRecurringDailyXml{} + if _, ok := o.Misc["UpdateScheduleGlobalProtectDatafileRecurringDaily"]; ok { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Daily.Misc = o.Misc["UpdateScheduleGlobalProtectDatafileRecurringDaily"] + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Daily.Action != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Daily.Action = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Daily.Action + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Daily.At != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Daily.At = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Daily.At + } + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Hourly != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Hourly = &UpdateScheduleGlobalProtectDatafileRecurringHourlyXml{} + if _, ok := o.Misc["UpdateScheduleGlobalProtectDatafileRecurringHourly"]; ok { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Hourly.Misc = o.Misc["UpdateScheduleGlobalProtectDatafileRecurringHourly"] + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Hourly.Action != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Hourly.Action = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Hourly.Action + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Hourly.At != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Hourly.At = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Hourly.At + } + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.None != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.None = &UpdateScheduleGlobalProtectDatafileRecurringNoneXml{} + if _, ok := o.Misc["UpdateScheduleGlobalProtectDatafileRecurringNone"]; ok { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.None.Misc = o.Misc["UpdateScheduleGlobalProtectDatafileRecurringNone"] + } + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Weekly = &UpdateScheduleGlobalProtectDatafileRecurringWeeklyXml{} + if _, ok := o.Misc["UpdateScheduleGlobalProtectDatafileRecurringWeekly"]; ok { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.Misc = o.Misc["UpdateScheduleGlobalProtectDatafileRecurringWeekly"] + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.Action != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.Action = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.Action + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.At != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.At = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.At + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.DayOfWeek != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.DayOfWeek = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.DayOfWeek + } + } + } + } + if o.UpdateSchedule.StatisticsService != nil { + nestedUpdateSchedule.StatisticsService = &UpdateScheduleStatisticsServiceXml{} + if _, ok := o.Misc["UpdateScheduleStatisticsService"]; ok { + nestedUpdateSchedule.StatisticsService.Misc = o.Misc["UpdateScheduleStatisticsService"] + } + if o.UpdateSchedule.StatisticsService.ThreatPreventionPcap != nil { + nestedUpdateSchedule.StatisticsService.ThreatPreventionPcap = util.YesNo(o.UpdateSchedule.StatisticsService.ThreatPreventionPcap, nil) + } + if o.UpdateSchedule.StatisticsService.ThreatPreventionReports != nil { + nestedUpdateSchedule.StatisticsService.ThreatPreventionReports = util.YesNo(o.UpdateSchedule.StatisticsService.ThreatPreventionReports, nil) + } + if o.UpdateSchedule.StatisticsService.UrlReports != nil { + nestedUpdateSchedule.StatisticsService.UrlReports = util.YesNo(o.UpdateSchedule.StatisticsService.UrlReports, nil) + } + if o.UpdateSchedule.StatisticsService.ApplicationReports != nil { + nestedUpdateSchedule.StatisticsService.ApplicationReports = util.YesNo(o.UpdateSchedule.StatisticsService.ApplicationReports, nil) + } + if o.UpdateSchedule.StatisticsService.FileIdentificationReports != nil { + nestedUpdateSchedule.StatisticsService.FileIdentificationReports = util.YesNo(o.UpdateSchedule.StatisticsService.FileIdentificationReports, nil) + } + if o.UpdateSchedule.StatisticsService.HealthPerformanceReports != nil { + nestedUpdateSchedule.StatisticsService.HealthPerformanceReports = util.YesNo(o.UpdateSchedule.StatisticsService.HealthPerformanceReports, nil) + } + if o.UpdateSchedule.StatisticsService.PassiveDnsMonitoring != nil { + nestedUpdateSchedule.StatisticsService.PassiveDnsMonitoring = util.YesNo(o.UpdateSchedule.StatisticsService.PassiveDnsMonitoring, nil) + } + if o.UpdateSchedule.StatisticsService.ThreatPreventionInformation != nil { + nestedUpdateSchedule.StatisticsService.ThreatPreventionInformation = util.YesNo(o.UpdateSchedule.StatisticsService.ThreatPreventionInformation, nil) + } + } + } + config.UpdateSchedule = nestedUpdateSchedule + + config.Misc = o.Misc["Config"] + + return config, nil +} +func (c *configXmlContainer) Normalize() ([]*Config, error) { + configList := make([]*Config, 0, len(c.Answer)) + for _, o := range c.Answer { + config := &Config{ + Misc: make(map[string][]generic.Xml), + } + var nestedUpdateSchedule *UpdateSchedule + if o.UpdateSchedule != nil { + nestedUpdateSchedule = &UpdateSchedule{} + if o.UpdateSchedule.Misc != nil { + config.Misc["UpdateSchedule"] = o.UpdateSchedule.Misc + } + if o.UpdateSchedule.Wildfire != nil { + nestedUpdateSchedule.Wildfire = &UpdateScheduleWildfire{} + if o.UpdateSchedule.Wildfire.Misc != nil { + config.Misc["UpdateScheduleWildfire"] = o.UpdateSchedule.Wildfire.Misc + } + if o.UpdateSchedule.Wildfire.Recurring != nil { + nestedUpdateSchedule.Wildfire.Recurring = &UpdateScheduleWildfireRecurring{} + if o.UpdateSchedule.Wildfire.Recurring.Misc != nil { + config.Misc["UpdateScheduleWildfireRecurring"] = o.UpdateSchedule.Wildfire.Recurring.Misc + } + if o.UpdateSchedule.Wildfire.Recurring.EveryMin != nil { + nestedUpdateSchedule.Wildfire.Recurring.EveryMin = &UpdateScheduleWildfireRecurringEveryMin{} + if o.UpdateSchedule.Wildfire.Recurring.EveryMin.Misc != nil { + config.Misc["UpdateScheduleWildfireRecurringEveryMin"] = o.UpdateSchedule.Wildfire.Recurring.EveryMin.Misc + } + if o.UpdateSchedule.Wildfire.Recurring.EveryMin.Action != nil { + nestedUpdateSchedule.Wildfire.Recurring.EveryMin.Action = o.UpdateSchedule.Wildfire.Recurring.EveryMin.Action + } + if o.UpdateSchedule.Wildfire.Recurring.EveryMin.SyncToPeer != nil { + nestedUpdateSchedule.Wildfire.Recurring.EveryMin.SyncToPeer = util.AsBool(o.UpdateSchedule.Wildfire.Recurring.EveryMin.SyncToPeer, nil) + } + } + if o.UpdateSchedule.Wildfire.Recurring.None != nil { + nestedUpdateSchedule.Wildfire.Recurring.None = &UpdateScheduleWildfireRecurringNone{} + if o.UpdateSchedule.Wildfire.Recurring.None.Misc != nil { + config.Misc["UpdateScheduleWildfireRecurringNone"] = o.UpdateSchedule.Wildfire.Recurring.None.Misc + } + } + if o.UpdateSchedule.Wildfire.Recurring.RealTime != nil { + nestedUpdateSchedule.Wildfire.Recurring.RealTime = &UpdateScheduleWildfireRecurringRealTime{} + if o.UpdateSchedule.Wildfire.Recurring.RealTime.Misc != nil { + config.Misc["UpdateScheduleWildfireRecurringRealTime"] = o.UpdateSchedule.Wildfire.Recurring.RealTime.Misc + } + } + if o.UpdateSchedule.Wildfire.Recurring.Every15Mins != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every15Mins = &UpdateScheduleWildfireRecurringEvery15Mins{} + if o.UpdateSchedule.Wildfire.Recurring.Every15Mins.Misc != nil { + config.Misc["UpdateScheduleWildfireRecurringEvery15Mins"] = o.UpdateSchedule.Wildfire.Recurring.Every15Mins.Misc + } + if o.UpdateSchedule.Wildfire.Recurring.Every15Mins.Action != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every15Mins.Action = o.UpdateSchedule.Wildfire.Recurring.Every15Mins.Action + } + if o.UpdateSchedule.Wildfire.Recurring.Every15Mins.At != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every15Mins.At = o.UpdateSchedule.Wildfire.Recurring.Every15Mins.At + } + if o.UpdateSchedule.Wildfire.Recurring.Every15Mins.SyncToPeer != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every15Mins.SyncToPeer = util.AsBool(o.UpdateSchedule.Wildfire.Recurring.Every15Mins.SyncToPeer, nil) + } + } + if o.UpdateSchedule.Wildfire.Recurring.Every30Mins != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every30Mins = &UpdateScheduleWildfireRecurringEvery30Mins{} + if o.UpdateSchedule.Wildfire.Recurring.Every30Mins.Misc != nil { + config.Misc["UpdateScheduleWildfireRecurringEvery30Mins"] = o.UpdateSchedule.Wildfire.Recurring.Every30Mins.Misc + } + if o.UpdateSchedule.Wildfire.Recurring.Every30Mins.Action != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every30Mins.Action = o.UpdateSchedule.Wildfire.Recurring.Every30Mins.Action + } + if o.UpdateSchedule.Wildfire.Recurring.Every30Mins.At != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every30Mins.At = o.UpdateSchedule.Wildfire.Recurring.Every30Mins.At + } + if o.UpdateSchedule.Wildfire.Recurring.Every30Mins.SyncToPeer != nil { + nestedUpdateSchedule.Wildfire.Recurring.Every30Mins.SyncToPeer = util.AsBool(o.UpdateSchedule.Wildfire.Recurring.Every30Mins.SyncToPeer, nil) + } + } + if o.UpdateSchedule.Wildfire.Recurring.EveryHour != nil { + nestedUpdateSchedule.Wildfire.Recurring.EveryHour = &UpdateScheduleWildfireRecurringEveryHour{} + if o.UpdateSchedule.Wildfire.Recurring.EveryHour.Misc != nil { + config.Misc["UpdateScheduleWildfireRecurringEveryHour"] = o.UpdateSchedule.Wildfire.Recurring.EveryHour.Misc + } + if o.UpdateSchedule.Wildfire.Recurring.EveryHour.Action != nil { + nestedUpdateSchedule.Wildfire.Recurring.EveryHour.Action = o.UpdateSchedule.Wildfire.Recurring.EveryHour.Action + } + if o.UpdateSchedule.Wildfire.Recurring.EveryHour.At != nil { + nestedUpdateSchedule.Wildfire.Recurring.EveryHour.At = o.UpdateSchedule.Wildfire.Recurring.EveryHour.At + } + if o.UpdateSchedule.Wildfire.Recurring.EveryHour.SyncToPeer != nil { + nestedUpdateSchedule.Wildfire.Recurring.EveryHour.SyncToPeer = util.AsBool(o.UpdateSchedule.Wildfire.Recurring.EveryHour.SyncToPeer, nil) + } + } + } + } + if o.UpdateSchedule.AntiVirus != nil { + nestedUpdateSchedule.AntiVirus = &UpdateScheduleAntiVirus{} + if o.UpdateSchedule.AntiVirus.Misc != nil { + config.Misc["UpdateScheduleAntiVirus"] = o.UpdateSchedule.AntiVirus.Misc + } + if o.UpdateSchedule.AntiVirus.Recurring != nil { + nestedUpdateSchedule.AntiVirus.Recurring = &UpdateScheduleAntiVirusRecurring{} + if o.UpdateSchedule.AntiVirus.Recurring.Misc != nil { + config.Misc["UpdateScheduleAntiVirusRecurring"] = o.UpdateSchedule.AntiVirus.Recurring.Misc + } + if o.UpdateSchedule.AntiVirus.Recurring.SyncToPeer != nil { + nestedUpdateSchedule.AntiVirus.Recurring.SyncToPeer = util.AsBool(o.UpdateSchedule.AntiVirus.Recurring.SyncToPeer, nil) + } + if o.UpdateSchedule.AntiVirus.Recurring.Threshold != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Threshold = o.UpdateSchedule.AntiVirus.Recurring.Threshold + } + if o.UpdateSchedule.AntiVirus.Recurring.Daily != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Daily = &UpdateScheduleAntiVirusRecurringDaily{} + if o.UpdateSchedule.AntiVirus.Recurring.Daily.Misc != nil { + config.Misc["UpdateScheduleAntiVirusRecurringDaily"] = o.UpdateSchedule.AntiVirus.Recurring.Daily.Misc + } + if o.UpdateSchedule.AntiVirus.Recurring.Daily.Action != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Daily.Action = o.UpdateSchedule.AntiVirus.Recurring.Daily.Action + } + if o.UpdateSchedule.AntiVirus.Recurring.Daily.At != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Daily.At = o.UpdateSchedule.AntiVirus.Recurring.Daily.At + } + } + if o.UpdateSchedule.AntiVirus.Recurring.Hourly != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Hourly = &UpdateScheduleAntiVirusRecurringHourly{} + if o.UpdateSchedule.AntiVirus.Recurring.Hourly.Misc != nil { + config.Misc["UpdateScheduleAntiVirusRecurringHourly"] = o.UpdateSchedule.AntiVirus.Recurring.Hourly.Misc + } + if o.UpdateSchedule.AntiVirus.Recurring.Hourly.Action != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Hourly.Action = o.UpdateSchedule.AntiVirus.Recurring.Hourly.Action + } + if o.UpdateSchedule.AntiVirus.Recurring.Hourly.At != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Hourly.At = o.UpdateSchedule.AntiVirus.Recurring.Hourly.At + } + } + if o.UpdateSchedule.AntiVirus.Recurring.None != nil { + nestedUpdateSchedule.AntiVirus.Recurring.None = &UpdateScheduleAntiVirusRecurringNone{} + if o.UpdateSchedule.AntiVirus.Recurring.None.Misc != nil { + config.Misc["UpdateScheduleAntiVirusRecurringNone"] = o.UpdateSchedule.AntiVirus.Recurring.None.Misc + } + } + if o.UpdateSchedule.AntiVirus.Recurring.Weekly != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Weekly = &UpdateScheduleAntiVirusRecurringWeekly{} + if o.UpdateSchedule.AntiVirus.Recurring.Weekly.Misc != nil { + config.Misc["UpdateScheduleAntiVirusRecurringWeekly"] = o.UpdateSchedule.AntiVirus.Recurring.Weekly.Misc + } + if o.UpdateSchedule.AntiVirus.Recurring.Weekly.At != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Weekly.At = o.UpdateSchedule.AntiVirus.Recurring.Weekly.At + } + if o.UpdateSchedule.AntiVirus.Recurring.Weekly.DayOfWeek != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Weekly.DayOfWeek = o.UpdateSchedule.AntiVirus.Recurring.Weekly.DayOfWeek + } + if o.UpdateSchedule.AntiVirus.Recurring.Weekly.Action != nil { + nestedUpdateSchedule.AntiVirus.Recurring.Weekly.Action = o.UpdateSchedule.AntiVirus.Recurring.Weekly.Action + } + } + } + } + if o.UpdateSchedule.AppProfile != nil { + nestedUpdateSchedule.AppProfile = &UpdateScheduleAppProfile{} + if o.UpdateSchedule.AppProfile.Misc != nil { + config.Misc["UpdateScheduleAppProfile"] = o.UpdateSchedule.AppProfile.Misc + } + if o.UpdateSchedule.AppProfile.Recurring != nil { + nestedUpdateSchedule.AppProfile.Recurring = &UpdateScheduleAppProfileRecurring{} + if o.UpdateSchedule.AppProfile.Recurring.Misc != nil { + config.Misc["UpdateScheduleAppProfileRecurring"] = o.UpdateSchedule.AppProfile.Recurring.Misc + } + if o.UpdateSchedule.AppProfile.Recurring.SyncToPeer != nil { + nestedUpdateSchedule.AppProfile.Recurring.SyncToPeer = util.AsBool(o.UpdateSchedule.AppProfile.Recurring.SyncToPeer, nil) + } + if o.UpdateSchedule.AppProfile.Recurring.Threshold != nil { + nestedUpdateSchedule.AppProfile.Recurring.Threshold = o.UpdateSchedule.AppProfile.Recurring.Threshold + } + if o.UpdateSchedule.AppProfile.Recurring.Daily != nil { + nestedUpdateSchedule.AppProfile.Recurring.Daily = &UpdateScheduleAppProfileRecurringDaily{} + if o.UpdateSchedule.AppProfile.Recurring.Daily.Misc != nil { + config.Misc["UpdateScheduleAppProfileRecurringDaily"] = o.UpdateSchedule.AppProfile.Recurring.Daily.Misc + } + if o.UpdateSchedule.AppProfile.Recurring.Daily.At != nil { + nestedUpdateSchedule.AppProfile.Recurring.Daily.At = o.UpdateSchedule.AppProfile.Recurring.Daily.At + } + if o.UpdateSchedule.AppProfile.Recurring.Daily.Action != nil { + nestedUpdateSchedule.AppProfile.Recurring.Daily.Action = o.UpdateSchedule.AppProfile.Recurring.Daily.Action + } + } + if o.UpdateSchedule.AppProfile.Recurring.None != nil { + nestedUpdateSchedule.AppProfile.Recurring.None = &UpdateScheduleAppProfileRecurringNone{} + if o.UpdateSchedule.AppProfile.Recurring.None.Misc != nil { + config.Misc["UpdateScheduleAppProfileRecurringNone"] = o.UpdateSchedule.AppProfile.Recurring.None.Misc + } + } + if o.UpdateSchedule.AppProfile.Recurring.Weekly != nil { + nestedUpdateSchedule.AppProfile.Recurring.Weekly = &UpdateScheduleAppProfileRecurringWeekly{} + if o.UpdateSchedule.AppProfile.Recurring.Weekly.Misc != nil { + config.Misc["UpdateScheduleAppProfileRecurringWeekly"] = o.UpdateSchedule.AppProfile.Recurring.Weekly.Misc + } + if o.UpdateSchedule.AppProfile.Recurring.Weekly.Action != nil { + nestedUpdateSchedule.AppProfile.Recurring.Weekly.Action = o.UpdateSchedule.AppProfile.Recurring.Weekly.Action + } + if o.UpdateSchedule.AppProfile.Recurring.Weekly.At != nil { + nestedUpdateSchedule.AppProfile.Recurring.Weekly.At = o.UpdateSchedule.AppProfile.Recurring.Weekly.At + } + if o.UpdateSchedule.AppProfile.Recurring.Weekly.DayOfWeek != nil { + nestedUpdateSchedule.AppProfile.Recurring.Weekly.DayOfWeek = o.UpdateSchedule.AppProfile.Recurring.Weekly.DayOfWeek + } + } + } + } + if o.UpdateSchedule.GlobalProtectClientlessVpn != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn = &UpdateScheduleGlobalProtectClientlessVpn{} + if o.UpdateSchedule.GlobalProtectClientlessVpn.Misc != nil { + config.Misc["UpdateScheduleGlobalProtectClientlessVpn"] = o.UpdateSchedule.GlobalProtectClientlessVpn.Misc + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring = &UpdateScheduleGlobalProtectClientlessVpnRecurring{} + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Misc != nil { + config.Misc["UpdateScheduleGlobalProtectClientlessVpnRecurring"] = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Misc + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily = &UpdateScheduleGlobalProtectClientlessVpnRecurringDaily{} + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily.Misc != nil { + config.Misc["UpdateScheduleGlobalProtectClientlessVpnRecurringDaily"] = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily.Misc + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily.Action != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily.Action = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily.Action + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily.At != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily.At = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Daily.At + } + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly = &UpdateScheduleGlobalProtectClientlessVpnRecurringHourly{} + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly.Misc != nil { + config.Misc["UpdateScheduleGlobalProtectClientlessVpnRecurringHourly"] = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly.Misc + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly.Action != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly.Action = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly.Action + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly.At != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly.At = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Hourly.At + } + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.None != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.None = &UpdateScheduleGlobalProtectClientlessVpnRecurringNone{} + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.None.Misc != nil { + config.Misc["UpdateScheduleGlobalProtectClientlessVpnRecurringNone"] = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.None.Misc + } + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly = &UpdateScheduleGlobalProtectClientlessVpnRecurringWeekly{} + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.Misc != nil { + config.Misc["UpdateScheduleGlobalProtectClientlessVpnRecurringWeekly"] = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.Misc + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.At != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.At = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.At + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.DayOfWeek != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.DayOfWeek = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.DayOfWeek + } + if o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.Action != nil { + nestedUpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.Action = o.UpdateSchedule.GlobalProtectClientlessVpn.Recurring.Weekly.Action + } + } + } + } + if o.UpdateSchedule.GlobalProtectDatafile != nil { + nestedUpdateSchedule.GlobalProtectDatafile = &UpdateScheduleGlobalProtectDatafile{} + if o.UpdateSchedule.GlobalProtectDatafile.Misc != nil { + config.Misc["UpdateScheduleGlobalProtectDatafile"] = o.UpdateSchedule.GlobalProtectDatafile.Misc + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring = &UpdateScheduleGlobalProtectDatafileRecurring{} + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Misc != nil { + config.Misc["UpdateScheduleGlobalProtectDatafileRecurring"] = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Misc + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Daily != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Daily = &UpdateScheduleGlobalProtectDatafileRecurringDaily{} + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Daily.Misc != nil { + config.Misc["UpdateScheduleGlobalProtectDatafileRecurringDaily"] = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Daily.Misc + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Daily.Action != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Daily.Action = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Daily.Action + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Daily.At != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Daily.At = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Daily.At + } + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Hourly != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Hourly = &UpdateScheduleGlobalProtectDatafileRecurringHourly{} + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Hourly.Misc != nil { + config.Misc["UpdateScheduleGlobalProtectDatafileRecurringHourly"] = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Hourly.Misc + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Hourly.Action != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Hourly.Action = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Hourly.Action + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Hourly.At != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Hourly.At = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Hourly.At + } + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.None != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.None = &UpdateScheduleGlobalProtectDatafileRecurringNone{} + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.None.Misc != nil { + config.Misc["UpdateScheduleGlobalProtectDatafileRecurringNone"] = o.UpdateSchedule.GlobalProtectDatafile.Recurring.None.Misc + } + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Weekly = &UpdateScheduleGlobalProtectDatafileRecurringWeekly{} + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.Misc != nil { + config.Misc["UpdateScheduleGlobalProtectDatafileRecurringWeekly"] = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.Misc + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.Action != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.Action = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.Action + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.At != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.At = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.At + } + if o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.DayOfWeek != nil { + nestedUpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.DayOfWeek = o.UpdateSchedule.GlobalProtectDatafile.Recurring.Weekly.DayOfWeek + } + } + } + } + if o.UpdateSchedule.StatisticsService != nil { + nestedUpdateSchedule.StatisticsService = &UpdateScheduleStatisticsService{} + if o.UpdateSchedule.StatisticsService.Misc != nil { + config.Misc["UpdateScheduleStatisticsService"] = o.UpdateSchedule.StatisticsService.Misc + } + if o.UpdateSchedule.StatisticsService.ThreatPreventionPcap != nil { + nestedUpdateSchedule.StatisticsService.ThreatPreventionPcap = util.AsBool(o.UpdateSchedule.StatisticsService.ThreatPreventionPcap, nil) + } + if o.UpdateSchedule.StatisticsService.ThreatPreventionReports != nil { + nestedUpdateSchedule.StatisticsService.ThreatPreventionReports = util.AsBool(o.UpdateSchedule.StatisticsService.ThreatPreventionReports, nil) + } + if o.UpdateSchedule.StatisticsService.UrlReports != nil { + nestedUpdateSchedule.StatisticsService.UrlReports = util.AsBool(o.UpdateSchedule.StatisticsService.UrlReports, nil) + } + if o.UpdateSchedule.StatisticsService.ApplicationReports != nil { + nestedUpdateSchedule.StatisticsService.ApplicationReports = util.AsBool(o.UpdateSchedule.StatisticsService.ApplicationReports, nil) + } + if o.UpdateSchedule.StatisticsService.FileIdentificationReports != nil { + nestedUpdateSchedule.StatisticsService.FileIdentificationReports = util.AsBool(o.UpdateSchedule.StatisticsService.FileIdentificationReports, nil) + } + if o.UpdateSchedule.StatisticsService.HealthPerformanceReports != nil { + nestedUpdateSchedule.StatisticsService.HealthPerformanceReports = util.AsBool(o.UpdateSchedule.StatisticsService.HealthPerformanceReports, nil) + } + if o.UpdateSchedule.StatisticsService.PassiveDnsMonitoring != nil { + nestedUpdateSchedule.StatisticsService.PassiveDnsMonitoring = util.AsBool(o.UpdateSchedule.StatisticsService.PassiveDnsMonitoring, nil) + } + if o.UpdateSchedule.StatisticsService.ThreatPreventionInformation != nil { + nestedUpdateSchedule.StatisticsService.ThreatPreventionInformation = util.AsBool(o.UpdateSchedule.StatisticsService.ThreatPreventionInformation, nil) + } + } + if o.UpdateSchedule.Threats != nil { + nestedUpdateSchedule.Threats = &UpdateScheduleThreats{} + if o.UpdateSchedule.Threats.Misc != nil { + config.Misc["UpdateScheduleThreats"] = o.UpdateSchedule.Threats.Misc + } + if o.UpdateSchedule.Threats.Recurring != nil { + nestedUpdateSchedule.Threats.Recurring = &UpdateScheduleThreatsRecurring{} + if o.UpdateSchedule.Threats.Recurring.Misc != nil { + config.Misc["UpdateScheduleThreatsRecurring"] = o.UpdateSchedule.Threats.Recurring.Misc + } + if o.UpdateSchedule.Threats.Recurring.NewAppThreshold != nil { + nestedUpdateSchedule.Threats.Recurring.NewAppThreshold = o.UpdateSchedule.Threats.Recurring.NewAppThreshold + } + if o.UpdateSchedule.Threats.Recurring.SyncToPeer != nil { + nestedUpdateSchedule.Threats.Recurring.SyncToPeer = util.AsBool(o.UpdateSchedule.Threats.Recurring.SyncToPeer, nil) + } + if o.UpdateSchedule.Threats.Recurring.Threshold != nil { + nestedUpdateSchedule.Threats.Recurring.Threshold = o.UpdateSchedule.Threats.Recurring.Threshold + } + if o.UpdateSchedule.Threats.Recurring.Daily != nil { + nestedUpdateSchedule.Threats.Recurring.Daily = &UpdateScheduleThreatsRecurringDaily{} + if o.UpdateSchedule.Threats.Recurring.Daily.Misc != nil { + config.Misc["UpdateScheduleThreatsRecurringDaily"] = o.UpdateSchedule.Threats.Recurring.Daily.Misc + } + if o.UpdateSchedule.Threats.Recurring.Daily.Action != nil { + nestedUpdateSchedule.Threats.Recurring.Daily.Action = o.UpdateSchedule.Threats.Recurring.Daily.Action + } + if o.UpdateSchedule.Threats.Recurring.Daily.At != nil { + nestedUpdateSchedule.Threats.Recurring.Daily.At = o.UpdateSchedule.Threats.Recurring.Daily.At + } + if o.UpdateSchedule.Threats.Recurring.Daily.DisableNewContent != nil { + nestedUpdateSchedule.Threats.Recurring.Daily.DisableNewContent = util.AsBool(o.UpdateSchedule.Threats.Recurring.Daily.DisableNewContent, nil) + } + } + if o.UpdateSchedule.Threats.Recurring.Every30Mins != nil { + nestedUpdateSchedule.Threats.Recurring.Every30Mins = &UpdateScheduleThreatsRecurringEvery30Mins{} + if o.UpdateSchedule.Threats.Recurring.Every30Mins.Misc != nil { + config.Misc["UpdateScheduleThreatsRecurringEvery30Mins"] = o.UpdateSchedule.Threats.Recurring.Every30Mins.Misc + } + if o.UpdateSchedule.Threats.Recurring.Every30Mins.At != nil { + nestedUpdateSchedule.Threats.Recurring.Every30Mins.At = o.UpdateSchedule.Threats.Recurring.Every30Mins.At + } + if o.UpdateSchedule.Threats.Recurring.Every30Mins.DisableNewContent != nil { + nestedUpdateSchedule.Threats.Recurring.Every30Mins.DisableNewContent = util.AsBool(o.UpdateSchedule.Threats.Recurring.Every30Mins.DisableNewContent, nil) + } + if o.UpdateSchedule.Threats.Recurring.Every30Mins.Action != nil { + nestedUpdateSchedule.Threats.Recurring.Every30Mins.Action = o.UpdateSchedule.Threats.Recurring.Every30Mins.Action + } + } + if o.UpdateSchedule.Threats.Recurring.Hourly != nil { + nestedUpdateSchedule.Threats.Recurring.Hourly = &UpdateScheduleThreatsRecurringHourly{} + if o.UpdateSchedule.Threats.Recurring.Hourly.Misc != nil { + config.Misc["UpdateScheduleThreatsRecurringHourly"] = o.UpdateSchedule.Threats.Recurring.Hourly.Misc + } + if o.UpdateSchedule.Threats.Recurring.Hourly.At != nil { + nestedUpdateSchedule.Threats.Recurring.Hourly.At = o.UpdateSchedule.Threats.Recurring.Hourly.At + } + if o.UpdateSchedule.Threats.Recurring.Hourly.DisableNewContent != nil { + nestedUpdateSchedule.Threats.Recurring.Hourly.DisableNewContent = util.AsBool(o.UpdateSchedule.Threats.Recurring.Hourly.DisableNewContent, nil) + } + if o.UpdateSchedule.Threats.Recurring.Hourly.Action != nil { + nestedUpdateSchedule.Threats.Recurring.Hourly.Action = o.UpdateSchedule.Threats.Recurring.Hourly.Action + } + } + if o.UpdateSchedule.Threats.Recurring.None != nil { + nestedUpdateSchedule.Threats.Recurring.None = &UpdateScheduleThreatsRecurringNone{} + if o.UpdateSchedule.Threats.Recurring.None.Misc != nil { + config.Misc["UpdateScheduleThreatsRecurringNone"] = o.UpdateSchedule.Threats.Recurring.None.Misc + } + } + if o.UpdateSchedule.Threats.Recurring.Weekly != nil { + nestedUpdateSchedule.Threats.Recurring.Weekly = &UpdateScheduleThreatsRecurringWeekly{} + if o.UpdateSchedule.Threats.Recurring.Weekly.Misc != nil { + config.Misc["UpdateScheduleThreatsRecurringWeekly"] = o.UpdateSchedule.Threats.Recurring.Weekly.Misc + } + if o.UpdateSchedule.Threats.Recurring.Weekly.Action != nil { + nestedUpdateSchedule.Threats.Recurring.Weekly.Action = o.UpdateSchedule.Threats.Recurring.Weekly.Action + } + if o.UpdateSchedule.Threats.Recurring.Weekly.At != nil { + nestedUpdateSchedule.Threats.Recurring.Weekly.At = o.UpdateSchedule.Threats.Recurring.Weekly.At + } + if o.UpdateSchedule.Threats.Recurring.Weekly.DayOfWeek != nil { + nestedUpdateSchedule.Threats.Recurring.Weekly.DayOfWeek = o.UpdateSchedule.Threats.Recurring.Weekly.DayOfWeek + } + if o.UpdateSchedule.Threats.Recurring.Weekly.DisableNewContent != nil { + nestedUpdateSchedule.Threats.Recurring.Weekly.DisableNewContent = util.AsBool(o.UpdateSchedule.Threats.Recurring.Weekly.DisableNewContent, nil) + } + } + } + } + if o.UpdateSchedule.WfPrivate != nil { + nestedUpdateSchedule.WfPrivate = &UpdateScheduleWfPrivate{} + if o.UpdateSchedule.WfPrivate.Misc != nil { + config.Misc["UpdateScheduleWfPrivate"] = o.UpdateSchedule.WfPrivate.Misc + } + if o.UpdateSchedule.WfPrivate.Recurring != nil { + nestedUpdateSchedule.WfPrivate.Recurring = &UpdateScheduleWfPrivateRecurring{} + if o.UpdateSchedule.WfPrivate.Recurring.Misc != nil { + config.Misc["UpdateScheduleWfPrivateRecurring"] = o.UpdateSchedule.WfPrivate.Recurring.Misc + } + if o.UpdateSchedule.WfPrivate.Recurring.SyncToPeer != nil { + nestedUpdateSchedule.WfPrivate.Recurring.SyncToPeer = util.AsBool(o.UpdateSchedule.WfPrivate.Recurring.SyncToPeer, nil) + } + if o.UpdateSchedule.WfPrivate.Recurring.Every15Mins != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every15Mins = &UpdateScheduleWfPrivateRecurringEvery15Mins{} + if o.UpdateSchedule.WfPrivate.Recurring.Every15Mins.Misc != nil { + config.Misc["UpdateScheduleWfPrivateRecurringEvery15Mins"] = o.UpdateSchedule.WfPrivate.Recurring.Every15Mins.Misc + } + if o.UpdateSchedule.WfPrivate.Recurring.Every15Mins.Action != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every15Mins.Action = o.UpdateSchedule.WfPrivate.Recurring.Every15Mins.Action + } + if o.UpdateSchedule.WfPrivate.Recurring.Every15Mins.At != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every15Mins.At = o.UpdateSchedule.WfPrivate.Recurring.Every15Mins.At + } + } + if o.UpdateSchedule.WfPrivate.Recurring.Every30Mins != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every30Mins = &UpdateScheduleWfPrivateRecurringEvery30Mins{} + if o.UpdateSchedule.WfPrivate.Recurring.Every30Mins.Misc != nil { + config.Misc["UpdateScheduleWfPrivateRecurringEvery30Mins"] = o.UpdateSchedule.WfPrivate.Recurring.Every30Mins.Misc + } + if o.UpdateSchedule.WfPrivate.Recurring.Every30Mins.Action != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every30Mins.Action = o.UpdateSchedule.WfPrivate.Recurring.Every30Mins.Action + } + if o.UpdateSchedule.WfPrivate.Recurring.Every30Mins.At != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every30Mins.At = o.UpdateSchedule.WfPrivate.Recurring.Every30Mins.At + } + } + if o.UpdateSchedule.WfPrivate.Recurring.Every5Mins != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every5Mins = &UpdateScheduleWfPrivateRecurringEvery5Mins{} + if o.UpdateSchedule.WfPrivate.Recurring.Every5Mins.Misc != nil { + config.Misc["UpdateScheduleWfPrivateRecurringEvery5Mins"] = o.UpdateSchedule.WfPrivate.Recurring.Every5Mins.Misc + } + if o.UpdateSchedule.WfPrivate.Recurring.Every5Mins.Action != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every5Mins.Action = o.UpdateSchedule.WfPrivate.Recurring.Every5Mins.Action + } + if o.UpdateSchedule.WfPrivate.Recurring.Every5Mins.At != nil { + nestedUpdateSchedule.WfPrivate.Recurring.Every5Mins.At = o.UpdateSchedule.WfPrivate.Recurring.Every5Mins.At + } + } + if o.UpdateSchedule.WfPrivate.Recurring.EveryHour != nil { + nestedUpdateSchedule.WfPrivate.Recurring.EveryHour = &UpdateScheduleWfPrivateRecurringEveryHour{} + if o.UpdateSchedule.WfPrivate.Recurring.EveryHour.Misc != nil { + config.Misc["UpdateScheduleWfPrivateRecurringEveryHour"] = o.UpdateSchedule.WfPrivate.Recurring.EveryHour.Misc + } + if o.UpdateSchedule.WfPrivate.Recurring.EveryHour.At != nil { + nestedUpdateSchedule.WfPrivate.Recurring.EveryHour.At = o.UpdateSchedule.WfPrivate.Recurring.EveryHour.At + } + if o.UpdateSchedule.WfPrivate.Recurring.EveryHour.Action != nil { + nestedUpdateSchedule.WfPrivate.Recurring.EveryHour.Action = o.UpdateSchedule.WfPrivate.Recurring.EveryHour.Action + } + } + if o.UpdateSchedule.WfPrivate.Recurring.None != nil { + nestedUpdateSchedule.WfPrivate.Recurring.None = &UpdateScheduleWfPrivateRecurringNone{} + if o.UpdateSchedule.WfPrivate.Recurring.None.Misc != nil { + config.Misc["UpdateScheduleWfPrivateRecurringNone"] = o.UpdateSchedule.WfPrivate.Recurring.None.Misc + } + } + } + } + } + config.UpdateSchedule = nestedUpdateSchedule + + config.Misc["Config"] = o.Misc + + configList = append(configList, config) + } + + return configList, nil +} + +func SpecMatches(a, b *Config) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !matchUpdateSchedule(a.UpdateSchedule, b.UpdateSchedule) { + return false + } + + return true +} + +func matchUpdateScheduleGlobalProtectClientlessVpnRecurringDaily(a *UpdateScheduleGlobalProtectClientlessVpnRecurringDaily, b *UpdateScheduleGlobalProtectClientlessVpnRecurringDaily) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.StringsMatch(a.At, b.At) { + return false + } + return true +} +func matchUpdateScheduleGlobalProtectClientlessVpnRecurringHourly(a *UpdateScheduleGlobalProtectClientlessVpnRecurringHourly, b *UpdateScheduleGlobalProtectClientlessVpnRecurringHourly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.Ints64Match(a.At, b.At) { + return false + } + return true +} +func matchUpdateScheduleGlobalProtectClientlessVpnRecurringNone(a *UpdateScheduleGlobalProtectClientlessVpnRecurringNone, b *UpdateScheduleGlobalProtectClientlessVpnRecurringNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchUpdateScheduleGlobalProtectClientlessVpnRecurringWeekly(a *UpdateScheduleGlobalProtectClientlessVpnRecurringWeekly, b *UpdateScheduleGlobalProtectClientlessVpnRecurringWeekly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.StringsMatch(a.DayOfWeek, b.DayOfWeek) { + return false + } + return true +} +func matchUpdateScheduleGlobalProtectClientlessVpnRecurring(a *UpdateScheduleGlobalProtectClientlessVpnRecurring, b *UpdateScheduleGlobalProtectClientlessVpnRecurring) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchUpdateScheduleGlobalProtectClientlessVpnRecurringDaily(a.Daily, b.Daily) { + return false + } + if !matchUpdateScheduleGlobalProtectClientlessVpnRecurringHourly(a.Hourly, b.Hourly) { + return false + } + if !matchUpdateScheduleGlobalProtectClientlessVpnRecurringNone(a.None, b.None) { + return false + } + if !matchUpdateScheduleGlobalProtectClientlessVpnRecurringWeekly(a.Weekly, b.Weekly) { + return false + } + return true +} +func matchUpdateScheduleGlobalProtectClientlessVpn(a *UpdateScheduleGlobalProtectClientlessVpn, b *UpdateScheduleGlobalProtectClientlessVpn) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchUpdateScheduleGlobalProtectClientlessVpnRecurring(a.Recurring, b.Recurring) { + return false + } + return true +} +func matchUpdateScheduleGlobalProtectDatafileRecurringNone(a *UpdateScheduleGlobalProtectDatafileRecurringNone, b *UpdateScheduleGlobalProtectDatafileRecurringNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchUpdateScheduleGlobalProtectDatafileRecurringWeekly(a *UpdateScheduleGlobalProtectDatafileRecurringWeekly, b *UpdateScheduleGlobalProtectDatafileRecurringWeekly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.StringsMatch(a.DayOfWeek, b.DayOfWeek) { + return false + } + return true +} +func matchUpdateScheduleGlobalProtectDatafileRecurringDaily(a *UpdateScheduleGlobalProtectDatafileRecurringDaily, b *UpdateScheduleGlobalProtectDatafileRecurringDaily) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.StringsMatch(a.At, b.At) { + return false + } + return true +} +func matchUpdateScheduleGlobalProtectDatafileRecurringHourly(a *UpdateScheduleGlobalProtectDatafileRecurringHourly, b *UpdateScheduleGlobalProtectDatafileRecurringHourly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.Ints64Match(a.At, b.At) { + return false + } + return true +} +func matchUpdateScheduleGlobalProtectDatafileRecurring(a *UpdateScheduleGlobalProtectDatafileRecurring, b *UpdateScheduleGlobalProtectDatafileRecurring) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchUpdateScheduleGlobalProtectDatafileRecurringHourly(a.Hourly, b.Hourly) { + return false + } + if !matchUpdateScheduleGlobalProtectDatafileRecurringNone(a.None, b.None) { + return false + } + if !matchUpdateScheduleGlobalProtectDatafileRecurringWeekly(a.Weekly, b.Weekly) { + return false + } + if !matchUpdateScheduleGlobalProtectDatafileRecurringDaily(a.Daily, b.Daily) { + return false + } + return true +} +func matchUpdateScheduleGlobalProtectDatafile(a *UpdateScheduleGlobalProtectDatafile, b *UpdateScheduleGlobalProtectDatafile) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchUpdateScheduleGlobalProtectDatafileRecurring(a.Recurring, b.Recurring) { + return false + } + return true +} +func matchUpdateScheduleStatisticsService(a *UpdateScheduleStatisticsService, b *UpdateScheduleStatisticsService) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.UrlReports, b.UrlReports) { + return false + } + if !util.BoolsMatch(a.ApplicationReports, b.ApplicationReports) { + return false + } + if !util.BoolsMatch(a.FileIdentificationReports, b.FileIdentificationReports) { + return false + } + if !util.BoolsMatch(a.HealthPerformanceReports, b.HealthPerformanceReports) { + return false + } + if !util.BoolsMatch(a.PassiveDnsMonitoring, b.PassiveDnsMonitoring) { + return false + } + if !util.BoolsMatch(a.ThreatPreventionInformation, b.ThreatPreventionInformation) { + return false + } + if !util.BoolsMatch(a.ThreatPreventionPcap, b.ThreatPreventionPcap) { + return false + } + if !util.BoolsMatch(a.ThreatPreventionReports, b.ThreatPreventionReports) { + return false + } + return true +} +func matchUpdateScheduleThreatsRecurringHourly(a *UpdateScheduleThreatsRecurringHourly, b *UpdateScheduleThreatsRecurringHourly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.DisableNewContent, b.DisableNewContent) { + return false + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.Ints64Match(a.At, b.At) { + return false + } + return true +} +func matchUpdateScheduleThreatsRecurringNone(a *UpdateScheduleThreatsRecurringNone, b *UpdateScheduleThreatsRecurringNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchUpdateScheduleThreatsRecurringWeekly(a *UpdateScheduleThreatsRecurringWeekly, b *UpdateScheduleThreatsRecurringWeekly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.StringsMatch(a.DayOfWeek, b.DayOfWeek) { + return false + } + if !util.BoolsMatch(a.DisableNewContent, b.DisableNewContent) { + return false + } + return true +} +func matchUpdateScheduleThreatsRecurringDaily(a *UpdateScheduleThreatsRecurringDaily, b *UpdateScheduleThreatsRecurringDaily) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.BoolsMatch(a.DisableNewContent, b.DisableNewContent) { + return false + } + return true +} +func matchUpdateScheduleThreatsRecurringEvery30Mins(a *UpdateScheduleThreatsRecurringEvery30Mins, b *UpdateScheduleThreatsRecurringEvery30Mins) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.Ints64Match(a.At, b.At) { + return false + } + if !util.BoolsMatch(a.DisableNewContent, b.DisableNewContent) { + return false + } + return true +} +func matchUpdateScheduleThreatsRecurring(a *UpdateScheduleThreatsRecurring, b *UpdateScheduleThreatsRecurring) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.NewAppThreshold, b.NewAppThreshold) { + return false + } + if !util.BoolsMatch(a.SyncToPeer, b.SyncToPeer) { + return false + } + if !util.Ints64Match(a.Threshold, b.Threshold) { + return false + } + if !matchUpdateScheduleThreatsRecurringNone(a.None, b.None) { + return false + } + if !matchUpdateScheduleThreatsRecurringWeekly(a.Weekly, b.Weekly) { + return false + } + if !matchUpdateScheduleThreatsRecurringDaily(a.Daily, b.Daily) { + return false + } + if !matchUpdateScheduleThreatsRecurringEvery30Mins(a.Every30Mins, b.Every30Mins) { + return false + } + if !matchUpdateScheduleThreatsRecurringHourly(a.Hourly, b.Hourly) { + return false + } + return true +} +func matchUpdateScheduleThreats(a *UpdateScheduleThreats, b *UpdateScheduleThreats) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchUpdateScheduleThreatsRecurring(a.Recurring, b.Recurring) { + return false + } + return true +} +func matchUpdateScheduleWfPrivateRecurringEvery15Mins(a *UpdateScheduleWfPrivateRecurringEvery15Mins, b *UpdateScheduleWfPrivateRecurringEvery15Mins) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.Ints64Match(a.At, b.At) { + return false + } + return true +} +func matchUpdateScheduleWfPrivateRecurringEvery30Mins(a *UpdateScheduleWfPrivateRecurringEvery30Mins, b *UpdateScheduleWfPrivateRecurringEvery30Mins) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.At, b.At) { + return false + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + return true +} +func matchUpdateScheduleWfPrivateRecurringEvery5Mins(a *UpdateScheduleWfPrivateRecurringEvery5Mins, b *UpdateScheduleWfPrivateRecurringEvery5Mins) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.Ints64Match(a.At, b.At) { + return false + } + return true +} +func matchUpdateScheduleWfPrivateRecurringEveryHour(a *UpdateScheduleWfPrivateRecurringEveryHour, b *UpdateScheduleWfPrivateRecurringEveryHour) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.Ints64Match(a.At, b.At) { + return false + } + return true +} +func matchUpdateScheduleWfPrivateRecurringNone(a *UpdateScheduleWfPrivateRecurringNone, b *UpdateScheduleWfPrivateRecurringNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchUpdateScheduleWfPrivateRecurring(a *UpdateScheduleWfPrivateRecurring, b *UpdateScheduleWfPrivateRecurring) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.SyncToPeer, b.SyncToPeer) { + return false + } + if !matchUpdateScheduleWfPrivateRecurringEvery15Mins(a.Every15Mins, b.Every15Mins) { + return false + } + if !matchUpdateScheduleWfPrivateRecurringEvery30Mins(a.Every30Mins, b.Every30Mins) { + return false + } + if !matchUpdateScheduleWfPrivateRecurringEvery5Mins(a.Every5Mins, b.Every5Mins) { + return false + } + if !matchUpdateScheduleWfPrivateRecurringEveryHour(a.EveryHour, b.EveryHour) { + return false + } + if !matchUpdateScheduleWfPrivateRecurringNone(a.None, b.None) { + return false + } + return true +} +func matchUpdateScheduleWfPrivate(a *UpdateScheduleWfPrivate, b *UpdateScheduleWfPrivate) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchUpdateScheduleWfPrivateRecurring(a.Recurring, b.Recurring) { + return false + } + return true +} +func matchUpdateScheduleWildfireRecurringEvery15Mins(a *UpdateScheduleWildfireRecurringEvery15Mins, b *UpdateScheduleWildfireRecurringEvery15Mins) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.Ints64Match(a.At, b.At) { + return false + } + if !util.BoolsMatch(a.SyncToPeer, b.SyncToPeer) { + return false + } + return true +} +func matchUpdateScheduleWildfireRecurringEvery30Mins(a *UpdateScheduleWildfireRecurringEvery30Mins, b *UpdateScheduleWildfireRecurringEvery30Mins) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.Ints64Match(a.At, b.At) { + return false + } + if !util.BoolsMatch(a.SyncToPeer, b.SyncToPeer) { + return false + } + return true +} +func matchUpdateScheduleWildfireRecurringEveryHour(a *UpdateScheduleWildfireRecurringEveryHour, b *UpdateScheduleWildfireRecurringEveryHour) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.SyncToPeer, b.SyncToPeer) { + return false + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.Ints64Match(a.At, b.At) { + return false + } + return true +} +func matchUpdateScheduleWildfireRecurringEveryMin(a *UpdateScheduleWildfireRecurringEveryMin, b *UpdateScheduleWildfireRecurringEveryMin) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.BoolsMatch(a.SyncToPeer, b.SyncToPeer) { + return false + } + return true +} +func matchUpdateScheduleWildfireRecurringNone(a *UpdateScheduleWildfireRecurringNone, b *UpdateScheduleWildfireRecurringNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchUpdateScheduleWildfireRecurringRealTime(a *UpdateScheduleWildfireRecurringRealTime, b *UpdateScheduleWildfireRecurringRealTime) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchUpdateScheduleWildfireRecurring(a *UpdateScheduleWildfireRecurring, b *UpdateScheduleWildfireRecurring) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchUpdateScheduleWildfireRecurringEveryHour(a.EveryHour, b.EveryHour) { + return false + } + if !matchUpdateScheduleWildfireRecurringEveryMin(a.EveryMin, b.EveryMin) { + return false + } + if !matchUpdateScheduleWildfireRecurringNone(a.None, b.None) { + return false + } + if !matchUpdateScheduleWildfireRecurringRealTime(a.RealTime, b.RealTime) { + return false + } + if !matchUpdateScheduleWildfireRecurringEvery15Mins(a.Every15Mins, b.Every15Mins) { + return false + } + if !matchUpdateScheduleWildfireRecurringEvery30Mins(a.Every30Mins, b.Every30Mins) { + return false + } + return true +} +func matchUpdateScheduleWildfire(a *UpdateScheduleWildfire, b *UpdateScheduleWildfire) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchUpdateScheduleWildfireRecurring(a.Recurring, b.Recurring) { + return false + } + return true +} +func matchUpdateScheduleAntiVirusRecurringDaily(a *UpdateScheduleAntiVirusRecurringDaily, b *UpdateScheduleAntiVirusRecurringDaily) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.StringsMatch(a.At, b.At) { + return false + } + return true +} +func matchUpdateScheduleAntiVirusRecurringHourly(a *UpdateScheduleAntiVirusRecurringHourly, b *UpdateScheduleAntiVirusRecurringHourly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.Ints64Match(a.At, b.At) { + return false + } + return true +} +func matchUpdateScheduleAntiVirusRecurringNone(a *UpdateScheduleAntiVirusRecurringNone, b *UpdateScheduleAntiVirusRecurringNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchUpdateScheduleAntiVirusRecurringWeekly(a *UpdateScheduleAntiVirusRecurringWeekly, b *UpdateScheduleAntiVirusRecurringWeekly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.StringsMatch(a.DayOfWeek, b.DayOfWeek) { + return false + } + return true +} +func matchUpdateScheduleAntiVirusRecurring(a *UpdateScheduleAntiVirusRecurring, b *UpdateScheduleAntiVirusRecurring) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Threshold, b.Threshold) { + return false + } + if !util.BoolsMatch(a.SyncToPeer, b.SyncToPeer) { + return false + } + if !matchUpdateScheduleAntiVirusRecurringDaily(a.Daily, b.Daily) { + return false + } + if !matchUpdateScheduleAntiVirusRecurringHourly(a.Hourly, b.Hourly) { + return false + } + if !matchUpdateScheduleAntiVirusRecurringNone(a.None, b.None) { + return false + } + if !matchUpdateScheduleAntiVirusRecurringWeekly(a.Weekly, b.Weekly) { + return false + } + return true +} +func matchUpdateScheduleAntiVirus(a *UpdateScheduleAntiVirus, b *UpdateScheduleAntiVirus) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchUpdateScheduleAntiVirusRecurring(a.Recurring, b.Recurring) { + return false + } + return true +} +func matchUpdateScheduleAppProfileRecurringDaily(a *UpdateScheduleAppProfileRecurringDaily, b *UpdateScheduleAppProfileRecurringDaily) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + return true +} +func matchUpdateScheduleAppProfileRecurringNone(a *UpdateScheduleAppProfileRecurringNone, b *UpdateScheduleAppProfileRecurringNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchUpdateScheduleAppProfileRecurringWeekly(a *UpdateScheduleAppProfileRecurringWeekly, b *UpdateScheduleAppProfileRecurringWeekly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.StringsMatch(a.DayOfWeek, b.DayOfWeek) { + return false + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + return true +} +func matchUpdateScheduleAppProfileRecurring(a *UpdateScheduleAppProfileRecurring, b *UpdateScheduleAppProfileRecurring) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.SyncToPeer, b.SyncToPeer) { + return false + } + if !util.Ints64Match(a.Threshold, b.Threshold) { + return false + } + if !matchUpdateScheduleAppProfileRecurringDaily(a.Daily, b.Daily) { + return false + } + if !matchUpdateScheduleAppProfileRecurringNone(a.None, b.None) { + return false + } + if !matchUpdateScheduleAppProfileRecurringWeekly(a.Weekly, b.Weekly) { + return false + } + return true +} +func matchUpdateScheduleAppProfile(a *UpdateScheduleAppProfile, b *UpdateScheduleAppProfile) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchUpdateScheduleAppProfileRecurring(a.Recurring, b.Recurring) { + return false + } + return true +} +func matchUpdateSchedule(a *UpdateSchedule, b *UpdateSchedule) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchUpdateScheduleGlobalProtectClientlessVpn(a.GlobalProtectClientlessVpn, b.GlobalProtectClientlessVpn) { + return false + } + if !matchUpdateScheduleGlobalProtectDatafile(a.GlobalProtectDatafile, b.GlobalProtectDatafile) { + return false + } + if !matchUpdateScheduleStatisticsService(a.StatisticsService, b.StatisticsService) { + return false + } + if !matchUpdateScheduleThreats(a.Threats, b.Threats) { + return false + } + if !matchUpdateScheduleWfPrivate(a.WfPrivate, b.WfPrivate) { + return false + } + if !matchUpdateScheduleWildfire(a.Wildfire, b.Wildfire) { + return false + } + if !matchUpdateScheduleAntiVirus(a.AntiVirus, b.AntiVirus) { + return false + } + if !matchUpdateScheduleAppProfile(a.AppProfile, b.AppProfile) { + return false + } + return true +} diff --git a/device/dynamicupdates/interfaces.go b/device/dynamicupdates/interfaces.go new file mode 100644 index 00000000..6c9ed8a5 --- /dev/null +++ b/device/dynamicupdates/interfaces.go @@ -0,0 +1,7 @@ +package dynamicupdates + +type Specifier func(*Config) (any, error) + +type Normalizer interface { + Normalize() ([]*Config, error) +} diff --git a/device/dynamicupdates/location.go b/device/dynamicupdates/location.go new file mode 100644 index 00000000..7321a8e2 --- /dev/null +++ b/device/dynamicupdates/location.go @@ -0,0 +1,180 @@ +package dynamicupdates + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + System *SystemLocation `json:"system,omitempty"` + Template *TemplateLocation `json:"template,omitempty"` + TemplateStack *TemplateStackLocation `json:"template_stack,omitempty"` +} + +type SystemLocation struct { + NgfwDevice string `json:"ngfw_device"` +} + +type TemplateLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + Template string `json:"template"` +} + +type TemplateStackLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + TemplateStack string `json:"template_stack"` +} + +func NewSystemLocation() *Location { + return &Location{System: &SystemLocation{ + NgfwDevice: "localhost.localdomain", + }, + } +} +func NewTemplateLocation() *Location { + return &Location{Template: &TemplateLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + Template: "", + }, + } +} +func NewTemplateStackLocation() *Location { + return &Location{TemplateStack: &TemplateStackLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + TemplateStack: "", + }, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.System != nil: + if o.System.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + count++ + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return fmt.Errorf("Template is unspecified") + } + count++ + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return fmt.Errorf("TemplateStack is unspecified") + } + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.System != nil: + if o.System.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.System.NgfwDevice}), + "deviceconfig", + "system", + } + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return nil, fmt.Errorf("Template is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Template.PanoramaDevice}), + "template", + util.AsEntryXpath([]string{o.Template.Template}), + "config", + "devices", + util.AsEntryXpath([]string{o.Template.NgfwDevice}), + "deviceconfig", + "system", + } + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return nil, fmt.Errorf("TemplateStack is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.PanoramaDevice}), + "template-stack", + util.AsEntryXpath([]string{o.TemplateStack.TemplateStack}), + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.NgfwDevice}), + "deviceconfig", + "system", + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) Xpath(vn version.Number) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + + return ans, nil +} diff --git a/device/dynamicupdates/service.go b/device/dynamicupdates/service.go new file mode 100644 index 00000000..48a8f0c8 --- /dev/null +++ b/device/dynamicupdates/service.go @@ -0,0 +1,173 @@ +package dynamicupdates + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, config *Config) (*Config, error) { + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.Xpath(vn) + if err != nil { + return nil, err + } + createSpec, err := specifier(config) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, action string) (*Config, error) { + return s.read(ctx, loc, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location) (*Config, error) { + return s.read(ctx, loc, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, action string, usePanosConfig bool) (*Config, error) { + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.Xpath(vn) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +func (s *Service) Update(ctx context.Context, loc Location, entry *Config) (*Config, error) { + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Config + old, err = s.Read(ctx, loc, "get") + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.Xpath(vn) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, config *Config) error { + return s.delete(ctx, loc, config) +} +func (s *Service) delete(ctx context.Context, loc Location, config *Config) error { + + vn := s.client.Versioning() + path, err := loc.Xpath(vn) + if err != nil { + return err + } + deleteSuffixes := []string{} + + for _, suffix := range deleteSuffixes { + cmd := &xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(append(path, suffix)), + Target: s.client.GetTarget(), + } + + _, _, err = s.client.Communicate(ctx, cmd, false, nil) + + if err != nil { + return err + } + } + return nil +} diff --git a/device/services/dns/config.go b/device/services/dns/config.go index 52b0caa4..4e04f765 100644 --- a/device/services/dns/config.go +++ b/device/services/dns/config.go @@ -93,12 +93,12 @@ func (c *configXmlContainer) Normalize() ([]*Config, error) { if o.DnsSetting.Servers.Misc != nil { config.Misc["DnsSettingServers"] = o.DnsSetting.Servers.Misc } - if o.DnsSetting.Servers.Secondary != nil { - nestedDnsSetting.Servers.Secondary = o.DnsSetting.Servers.Secondary - } if o.DnsSetting.Servers.Primary != nil { nestedDnsSetting.Servers.Primary = o.DnsSetting.Servers.Primary } + if o.DnsSetting.Servers.Secondary != nil { + nestedDnsSetting.Servers.Secondary = o.DnsSetting.Servers.Secondary + } } } config.DnsSetting = nestedDnsSetting diff --git a/device/services/dns/service.go b/device/services/dns/service.go index 83ca11b0..011e80d4 100644 --- a/device/services/dns/service.go +++ b/device/services/dns/service.go @@ -155,8 +155,6 @@ func (s *Service) delete(ctx context.Context, loc Location, config *Config) erro return err } deleteSuffixes := []string{} - deleteSuffixes = append(deleteSuffixes, "dns-setting") - deleteSuffixes = append(deleteSuffixes, "fqdn-refresh-time") for _, suffix := range deleteSuffixes { cmd := &xmlapi.Config{ diff --git a/device/services/ntp/config.go b/device/services/ntp/config.go index 1bbd4c06..c7734fa4 100644 --- a/device/services/ntp/config.go +++ b/device/services/ntp/config.go @@ -22,19 +22,26 @@ type NtpServersPrimaryNtpServer struct { NtpServerAddress *string } type NtpServersPrimaryNtpServerAuthenticationType struct { - Autokey *string - None *string + Autokey *NtpServersPrimaryNtpServerAuthenticationTypeAutokey + None *NtpServersPrimaryNtpServerAuthenticationTypeNone SymmetricKey *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKey } +type NtpServersPrimaryNtpServerAuthenticationTypeAutokey struct { +} +type NtpServersPrimaryNtpServerAuthenticationTypeNone struct { +} type NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKey struct { - KeyId *int64 - Md5 *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyMd5 - Sha1 *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeySha1 + Algorithm *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm + KeyId *int64 +} +type NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm struct { + Md5 *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5 + Sha1 *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1 } -type NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyMd5 struct { +type NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5 struct { AuthenticationKey *string } -type NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeySha1 struct { +type NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1 struct { AuthenticationKey *string } type NtpServersSecondaryNtpServer struct { @@ -42,19 +49,26 @@ type NtpServersSecondaryNtpServer struct { NtpServerAddress *string } type NtpServersSecondaryNtpServerAuthenticationType struct { - Autokey *string - None *string + Autokey *NtpServersSecondaryNtpServerAuthenticationTypeAutokey + None *NtpServersSecondaryNtpServerAuthenticationTypeNone SymmetricKey *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKey } +type NtpServersSecondaryNtpServerAuthenticationTypeAutokey struct { +} +type NtpServersSecondaryNtpServerAuthenticationTypeNone struct { +} type NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKey struct { - KeyId *int64 - Md5 *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyMd5 - Sha1 *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeySha1 + Algorithm *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm + KeyId *int64 +} +type NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm struct { + Md5 *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5 + Sha1 *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1 } -type NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyMd5 struct { +type NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5 struct { AuthenticationKey *string } -type NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeySha1 struct { +type NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1 struct { AuthenticationKey *string } type configXmlContainer struct { @@ -80,25 +94,36 @@ type NtpServersPrimaryNtpServerXml struct { Misc []generic.Xml `xml:",any"` } type NtpServersPrimaryNtpServerAuthenticationTypeXml struct { - Autokey *string `xml:"autokey,omitempty"` - None *string `xml:"none,omitempty"` + Autokey *NtpServersPrimaryNtpServerAuthenticationTypeAutokeyXml `xml:"autokey,omitempty"` + None *NtpServersPrimaryNtpServerAuthenticationTypeNoneXml `xml:"none,omitempty"` SymmetricKey *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyXml `xml:"symmetric-key,omitempty"` Misc []generic.Xml `xml:",any"` } +type NtpServersPrimaryNtpServerAuthenticationTypeAutokeyXml struct { + Misc []generic.Xml `xml:",any"` +} +type NtpServersPrimaryNtpServerAuthenticationTypeNoneXml struct { + Misc []generic.Xml `xml:",any"` +} type NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyXml struct { - KeyId *int64 `xml:"key-id,omitempty"` - Md5 *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyMd5Xml `xml:"algorithm>md5,omitempty"` - Sha1 *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeySha1Xml `xml:"algorithm>sha1,omitempty"` + Algorithm *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmXml `xml:"algorithm,omitempty"` + KeyId *int64 `xml:"key-id,omitempty"` Misc []generic.Xml `xml:",any"` } -type NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyMd5Xml struct { +type NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmXml struct { + Md5 *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5Xml `xml:"md5,omitempty"` + Sha1 *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1Xml `xml:"sha1,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5Xml struct { AuthenticationKey *string `xml:"authentication-key,omitempty"` Misc []generic.Xml `xml:",any"` } -type NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeySha1Xml struct { +type NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1Xml struct { AuthenticationKey *string `xml:"authentication-key,omitempty"` Misc []generic.Xml `xml:",any"` @@ -110,25 +135,36 @@ type NtpServersSecondaryNtpServerXml struct { Misc []generic.Xml `xml:",any"` } type NtpServersSecondaryNtpServerAuthenticationTypeXml struct { - Autokey *string `xml:"autokey,omitempty"` - None *string `xml:"none,omitempty"` + Autokey *NtpServersSecondaryNtpServerAuthenticationTypeAutokeyXml `xml:"autokey,omitempty"` + None *NtpServersSecondaryNtpServerAuthenticationTypeNoneXml `xml:"none,omitempty"` SymmetricKey *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyXml `xml:"symmetric-key,omitempty"` Misc []generic.Xml `xml:",any"` } +type NtpServersSecondaryNtpServerAuthenticationTypeAutokeyXml struct { + Misc []generic.Xml `xml:",any"` +} +type NtpServersSecondaryNtpServerAuthenticationTypeNoneXml struct { + Misc []generic.Xml `xml:",any"` +} type NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyXml struct { - KeyId *int64 `xml:"key-id,omitempty"` - Md5 *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyMd5Xml `xml:"algorithm>md5,omitempty"` - Sha1 *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeySha1Xml `xml:"algorithm>sha1,omitempty"` + Algorithm *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmXml `xml:"algorithm,omitempty"` + KeyId *int64 `xml:"key-id,omitempty"` Misc []generic.Xml `xml:",any"` } -type NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyMd5Xml struct { +type NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmXml struct { + Md5 *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5Xml `xml:"md5,omitempty"` + Sha1 *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1Xml `xml:"sha1,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5Xml struct { AuthenticationKey *string `xml:"authentication-key,omitempty"` Misc []generic.Xml `xml:",any"` } -type NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeySha1Xml struct { +type NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1Xml struct { AuthenticationKey *string `xml:"authentication-key,omitempty"` Misc []generic.Xml `xml:",any"` @@ -150,48 +186,60 @@ func specifyConfig(o *Config) (any, error) { if _, ok := o.Misc["NtpServersPrimaryNtpServer"]; ok { nestedNtpServers.PrimaryNtpServer.Misc = o.Misc["NtpServersPrimaryNtpServer"] } - if o.NtpServers.PrimaryNtpServer.NtpServerAddress != nil { - nestedNtpServers.PrimaryNtpServer.NtpServerAddress = o.NtpServers.PrimaryNtpServer.NtpServerAddress - } if o.NtpServers.PrimaryNtpServer.AuthenticationType != nil { nestedNtpServers.PrimaryNtpServer.AuthenticationType = &NtpServersPrimaryNtpServerAuthenticationTypeXml{} if _, ok := o.Misc["NtpServersPrimaryNtpServerAuthenticationType"]; ok { nestedNtpServers.PrimaryNtpServer.AuthenticationType.Misc = o.Misc["NtpServersPrimaryNtpServerAuthenticationType"] } + if o.NtpServers.PrimaryNtpServer.AuthenticationType.Autokey != nil { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.Autokey = &NtpServersPrimaryNtpServerAuthenticationTypeAutokeyXml{} + if _, ok := o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeAutokey"]; ok { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.Autokey.Misc = o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeAutokey"] + } + } if o.NtpServers.PrimaryNtpServer.AuthenticationType.None != nil { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.None = o.NtpServers.PrimaryNtpServer.AuthenticationType.None + nestedNtpServers.PrimaryNtpServer.AuthenticationType.None = &NtpServersPrimaryNtpServerAuthenticationTypeNoneXml{} + if _, ok := o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeNone"]; ok { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.None.Misc = o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeNone"] + } } if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey != nil { nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey = &NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyXml{} if _, ok := o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKey"]; ok { nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Misc = o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKey"] } - if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.KeyId != nil { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.KeyId = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.KeyId - } - if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Md5 != nil { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Md5 = &NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyMd5Xml{} - if _, ok := o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyMd5"]; ok { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Md5.Misc = o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyMd5"] - } - if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Md5.AuthenticationKey != nil { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Md5.AuthenticationKey = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Md5.AuthenticationKey + if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm != nil { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm = &NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmXml{} + if _, ok := o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm"]; ok { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Misc = o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm"] } - } - if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Sha1 != nil { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Sha1 = &NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeySha1Xml{} - if _, ok := o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeySha1"]; ok { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Sha1.Misc = o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeySha1"] + if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5 != nil { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5 = &NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5Xml{} + if _, ok := o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5"]; ok { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.Misc = o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5"] + } + if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.AuthenticationKey != nil { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.AuthenticationKey = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.AuthenticationKey + } } - if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Sha1.AuthenticationKey != nil { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Sha1.AuthenticationKey = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Sha1.AuthenticationKey + if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1 != nil { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1 = &NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1Xml{} + if _, ok := o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1"]; ok { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.Misc = o.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1"] + } + if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.AuthenticationKey != nil { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.AuthenticationKey = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.AuthenticationKey + } } } - } - if o.NtpServers.PrimaryNtpServer.AuthenticationType.Autokey != nil { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.Autokey = o.NtpServers.PrimaryNtpServer.AuthenticationType.Autokey + if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.KeyId != nil { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.KeyId = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.KeyId + } } } + if o.NtpServers.PrimaryNtpServer.NtpServerAddress != nil { + nestedNtpServers.PrimaryNtpServer.NtpServerAddress = o.NtpServers.PrimaryNtpServer.NtpServerAddress + } } if o.NtpServers.SecondaryNtpServer != nil { nestedNtpServers.SecondaryNtpServer = &NtpServersSecondaryNtpServerXml{} @@ -203,38 +251,50 @@ func specifyConfig(o *Config) (any, error) { if _, ok := o.Misc["NtpServersSecondaryNtpServerAuthenticationType"]; ok { nestedNtpServers.SecondaryNtpServer.AuthenticationType.Misc = o.Misc["NtpServersSecondaryNtpServerAuthenticationType"] } + if o.NtpServers.SecondaryNtpServer.AuthenticationType.Autokey != nil { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.Autokey = &NtpServersSecondaryNtpServerAuthenticationTypeAutokeyXml{} + if _, ok := o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeAutokey"]; ok { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.Autokey.Misc = o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeAutokey"] + } + } if o.NtpServers.SecondaryNtpServer.AuthenticationType.None != nil { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.None = o.NtpServers.SecondaryNtpServer.AuthenticationType.None + nestedNtpServers.SecondaryNtpServer.AuthenticationType.None = &NtpServersSecondaryNtpServerAuthenticationTypeNoneXml{} + if _, ok := o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeNone"]; ok { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.None.Misc = o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeNone"] + } } if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey != nil { nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey = &NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyXml{} if _, ok := o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKey"]; ok { nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Misc = o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKey"] } - if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.KeyId != nil { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.KeyId = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.KeyId - } - if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Md5 != nil { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Md5 = &NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyMd5Xml{} - if _, ok := o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyMd5"]; ok { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Md5.Misc = o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyMd5"] - } - if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Md5.AuthenticationKey != nil { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Md5.AuthenticationKey = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Md5.AuthenticationKey + if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm != nil { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm = &NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmXml{} + if _, ok := o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm"]; ok { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Misc = o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm"] } - } - if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Sha1 != nil { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Sha1 = &NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeySha1Xml{} - if _, ok := o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeySha1"]; ok { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Sha1.Misc = o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeySha1"] + if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5 != nil { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5 = &NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5Xml{} + if _, ok := o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5"]; ok { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.Misc = o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5"] + } + if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.AuthenticationKey != nil { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.AuthenticationKey = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.AuthenticationKey + } } - if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Sha1.AuthenticationKey != nil { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Sha1.AuthenticationKey = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Sha1.AuthenticationKey + if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1 != nil { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1 = &NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1Xml{} + if _, ok := o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1"]; ok { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.Misc = o.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1"] + } + if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.AuthenticationKey != nil { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.AuthenticationKey = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.AuthenticationKey + } } } - } - if o.NtpServers.SecondaryNtpServer.AuthenticationType.Autokey != nil { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.Autokey = o.NtpServers.SecondaryNtpServer.AuthenticationType.Autokey + if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.KeyId != nil { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.KeyId = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.KeyId + } } } if o.NtpServers.SecondaryNtpServer.NtpServerAddress != nil { @@ -265,47 +325,59 @@ func (c *configXmlContainer) Normalize() ([]*Config, error) { if o.NtpServers.PrimaryNtpServer.Misc != nil { config.Misc["NtpServersPrimaryNtpServer"] = o.NtpServers.PrimaryNtpServer.Misc } - if o.NtpServers.PrimaryNtpServer.NtpServerAddress != nil { - nestedNtpServers.PrimaryNtpServer.NtpServerAddress = o.NtpServers.PrimaryNtpServer.NtpServerAddress - } if o.NtpServers.PrimaryNtpServer.AuthenticationType != nil { nestedNtpServers.PrimaryNtpServer.AuthenticationType = &NtpServersPrimaryNtpServerAuthenticationType{} if o.NtpServers.PrimaryNtpServer.AuthenticationType.Misc != nil { config.Misc["NtpServersPrimaryNtpServerAuthenticationType"] = o.NtpServers.PrimaryNtpServer.AuthenticationType.Misc } + if o.NtpServers.PrimaryNtpServer.AuthenticationType.Autokey != nil { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.Autokey = &NtpServersPrimaryNtpServerAuthenticationTypeAutokey{} + if o.NtpServers.PrimaryNtpServer.AuthenticationType.Autokey.Misc != nil { + config.Misc["NtpServersPrimaryNtpServerAuthenticationTypeAutokey"] = o.NtpServers.PrimaryNtpServer.AuthenticationType.Autokey.Misc + } + } if o.NtpServers.PrimaryNtpServer.AuthenticationType.None != nil { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.None = o.NtpServers.PrimaryNtpServer.AuthenticationType.None + nestedNtpServers.PrimaryNtpServer.AuthenticationType.None = &NtpServersPrimaryNtpServerAuthenticationTypeNone{} + if o.NtpServers.PrimaryNtpServer.AuthenticationType.None.Misc != nil { + config.Misc["NtpServersPrimaryNtpServerAuthenticationTypeNone"] = o.NtpServers.PrimaryNtpServer.AuthenticationType.None.Misc + } } if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey != nil { nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey = &NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKey{} if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Misc != nil { config.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKey"] = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Misc } - if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.KeyId != nil { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.KeyId = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.KeyId - } - if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Md5 != nil { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Md5 = &NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyMd5{} - if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Md5.Misc != nil { - config.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyMd5"] = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Md5.Misc + if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm != nil { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm = &NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm{} + if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Misc != nil { + config.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm"] = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Misc } - if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Md5.AuthenticationKey != nil { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Md5.AuthenticationKey = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Md5.AuthenticationKey + if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5 != nil { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5 = &NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5{} + if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.Misc != nil { + config.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5"] = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.Misc + } + if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.AuthenticationKey != nil { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.AuthenticationKey = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.AuthenticationKey + } } - } - if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Sha1 != nil { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Sha1 = &NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeySha1{} - if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Sha1.Misc != nil { - config.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeySha1"] = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Sha1.Misc - } - if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Sha1.AuthenticationKey != nil { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Sha1.AuthenticationKey = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Sha1.AuthenticationKey + if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1 != nil { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1 = &NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1{} + if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.Misc != nil { + config.Misc["NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1"] = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.Misc + } + if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.AuthenticationKey != nil { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.AuthenticationKey = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.AuthenticationKey + } } } + if o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.KeyId != nil { + nestedNtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.KeyId = o.NtpServers.PrimaryNtpServer.AuthenticationType.SymmetricKey.KeyId + } } - if o.NtpServers.PrimaryNtpServer.AuthenticationType.Autokey != nil { - nestedNtpServers.PrimaryNtpServer.AuthenticationType.Autokey = o.NtpServers.PrimaryNtpServer.AuthenticationType.Autokey - } + } + if o.NtpServers.PrimaryNtpServer.NtpServerAddress != nil { + nestedNtpServers.PrimaryNtpServer.NtpServerAddress = o.NtpServers.PrimaryNtpServer.NtpServerAddress } } if o.NtpServers.SecondaryNtpServer != nil { @@ -313,48 +385,60 @@ func (c *configXmlContainer) Normalize() ([]*Config, error) { if o.NtpServers.SecondaryNtpServer.Misc != nil { config.Misc["NtpServersSecondaryNtpServer"] = o.NtpServers.SecondaryNtpServer.Misc } - if o.NtpServers.SecondaryNtpServer.NtpServerAddress != nil { - nestedNtpServers.SecondaryNtpServer.NtpServerAddress = o.NtpServers.SecondaryNtpServer.NtpServerAddress - } if o.NtpServers.SecondaryNtpServer.AuthenticationType != nil { nestedNtpServers.SecondaryNtpServer.AuthenticationType = &NtpServersSecondaryNtpServerAuthenticationType{} if o.NtpServers.SecondaryNtpServer.AuthenticationType.Misc != nil { config.Misc["NtpServersSecondaryNtpServerAuthenticationType"] = o.NtpServers.SecondaryNtpServer.AuthenticationType.Misc } + if o.NtpServers.SecondaryNtpServer.AuthenticationType.Autokey != nil { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.Autokey = &NtpServersSecondaryNtpServerAuthenticationTypeAutokey{} + if o.NtpServers.SecondaryNtpServer.AuthenticationType.Autokey.Misc != nil { + config.Misc["NtpServersSecondaryNtpServerAuthenticationTypeAutokey"] = o.NtpServers.SecondaryNtpServer.AuthenticationType.Autokey.Misc + } + } if o.NtpServers.SecondaryNtpServer.AuthenticationType.None != nil { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.None = o.NtpServers.SecondaryNtpServer.AuthenticationType.None + nestedNtpServers.SecondaryNtpServer.AuthenticationType.None = &NtpServersSecondaryNtpServerAuthenticationTypeNone{} + if o.NtpServers.SecondaryNtpServer.AuthenticationType.None.Misc != nil { + config.Misc["NtpServersSecondaryNtpServerAuthenticationTypeNone"] = o.NtpServers.SecondaryNtpServer.AuthenticationType.None.Misc + } } if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey != nil { nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey = &NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKey{} if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Misc != nil { config.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKey"] = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Misc } - if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.KeyId != nil { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.KeyId = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.KeyId - } - if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Md5 != nil { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Md5 = &NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyMd5{} - if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Md5.Misc != nil { - config.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyMd5"] = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Md5.Misc + if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm != nil { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm = &NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm{} + if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Misc != nil { + config.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm"] = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Misc } - if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Md5.AuthenticationKey != nil { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Md5.AuthenticationKey = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Md5.AuthenticationKey + if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5 != nil { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5 = &NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5{} + if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.Misc != nil { + config.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5"] = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.Misc + } + if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.AuthenticationKey != nil { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.AuthenticationKey = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Md5.AuthenticationKey + } } - } - if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Sha1 != nil { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Sha1 = &NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeySha1{} - if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Sha1.Misc != nil { - config.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeySha1"] = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Sha1.Misc - } - if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Sha1.AuthenticationKey != nil { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Sha1.AuthenticationKey = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Sha1.AuthenticationKey + if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1 != nil { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1 = &NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1{} + if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.Misc != nil { + config.Misc["NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1"] = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.Misc + } + if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.AuthenticationKey != nil { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.AuthenticationKey = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.Algorithm.Sha1.AuthenticationKey + } } } - } - if o.NtpServers.SecondaryNtpServer.AuthenticationType.Autokey != nil { - nestedNtpServers.SecondaryNtpServer.AuthenticationType.Autokey = o.NtpServers.SecondaryNtpServer.AuthenticationType.Autokey + if o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.KeyId != nil { + nestedNtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.KeyId = o.NtpServers.SecondaryNtpServer.AuthenticationType.SymmetricKey.KeyId + } } } + if o.NtpServers.SecondaryNtpServer.NtpServerAddress != nil { + nestedNtpServers.SecondaryNtpServer.NtpServerAddress = o.NtpServers.SecondaryNtpServer.NtpServerAddress + } } } config.NtpServers = nestedNtpServers @@ -382,7 +466,23 @@ func SpecMatches(a, b *Config) bool { return true } -func matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyMd5(a *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyMd5, b *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyMd5) bool { +func matchNtpServersPrimaryNtpServerAuthenticationTypeAutokey(a *NtpServersPrimaryNtpServerAuthenticationTypeAutokey, b *NtpServersPrimaryNtpServerAuthenticationTypeAutokey) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchNtpServersPrimaryNtpServerAuthenticationTypeNone(a *NtpServersPrimaryNtpServerAuthenticationTypeNone, b *NtpServersPrimaryNtpServerAuthenticationTypeNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5(a *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5, b *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { @@ -393,7 +493,7 @@ func matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyMd5(a *NtpServ } return true } -func matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeySha1(a *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeySha1, b *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeySha1) bool { +func matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1(a *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1, b *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { @@ -404,19 +504,30 @@ func matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeySha1(a *NtpSer } return true } -func matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKey(a *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKey, b *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKey) bool { +func matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm(a *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm, b *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.Ints64Match(a.KeyId, b.KeyId) { + if !matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5(a.Md5, b.Md5) { + return false + } + if !matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1(a.Sha1, b.Sha1) { + return false + } + return true +} +func matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKey(a *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKey, b *NtpServersPrimaryNtpServerAuthenticationTypeSymmetricKey) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyMd5(a.Md5, b.Md5) { + if !matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm(a.Algorithm, b.Algorithm) { return false } - if !matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKeySha1(a.Sha1, b.Sha1) { + if !util.Ints64Match(a.KeyId, b.KeyId) { return false } return true @@ -427,13 +538,13 @@ func matchNtpServersPrimaryNtpServerAuthenticationType(a *NtpServersPrimaryNtpSe } else if a == nil && b == nil { return true } - if !util.StringsMatch(a.None, b.None) { + if !matchNtpServersPrimaryNtpServerAuthenticationTypeAutokey(a.Autokey, b.Autokey) { return false } - if !matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKey(a.SymmetricKey, b.SymmetricKey) { + if !matchNtpServersPrimaryNtpServerAuthenticationTypeNone(a.None, b.None) { return false } - if !util.StringsMatch(a.Autokey, b.Autokey) { + if !matchNtpServersPrimaryNtpServerAuthenticationTypeSymmetricKey(a.SymmetricKey, b.SymmetricKey) { return false } return true @@ -452,7 +563,23 @@ func matchNtpServersPrimaryNtpServer(a *NtpServersPrimaryNtpServer, b *NtpServer } return true } -func matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyMd5(a *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyMd5, b *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyMd5) bool { +func matchNtpServersSecondaryNtpServerAuthenticationTypeAutokey(a *NtpServersSecondaryNtpServerAuthenticationTypeAutokey, b *NtpServersSecondaryNtpServerAuthenticationTypeAutokey) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchNtpServersSecondaryNtpServerAuthenticationTypeNone(a *NtpServersSecondaryNtpServerAuthenticationTypeNone, b *NtpServersSecondaryNtpServerAuthenticationTypeNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5(a *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5, b *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { @@ -463,7 +590,7 @@ func matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyMd5(a *NtpSe } return true } -func matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeySha1(a *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeySha1, b *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeySha1) bool { +func matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1(a *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1, b *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { @@ -474,19 +601,30 @@ func matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeySha1(a *NtpS } return true } -func matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKey(a *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKey, b *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKey) bool { +func matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm(a *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm, b *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.Ints64Match(a.KeyId, b.KeyId) { + if !matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmMd5(a.Md5, b.Md5) { + return false + } + if !matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithmSha1(a.Sha1, b.Sha1) { + return false + } + return true +} +func matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKey(a *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKey, b *NtpServersSecondaryNtpServerAuthenticationTypeSymmetricKey) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyMd5(a.Md5, b.Md5) { + if !matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeyAlgorithm(a.Algorithm, b.Algorithm) { return false } - if !matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKeySha1(a.Sha1, b.Sha1) { + if !util.Ints64Match(a.KeyId, b.KeyId) { return false } return true @@ -497,13 +635,13 @@ func matchNtpServersSecondaryNtpServerAuthenticationType(a *NtpServersSecondaryN } else if a == nil && b == nil { return true } - if !util.StringsMatch(a.None, b.None) { + if !matchNtpServersSecondaryNtpServerAuthenticationTypeAutokey(a.Autokey, b.Autokey) { return false } - if !matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKey(a.SymmetricKey, b.SymmetricKey) { + if !matchNtpServersSecondaryNtpServerAuthenticationTypeNone(a.None, b.None) { return false } - if !util.StringsMatch(a.Autokey, b.Autokey) { + if !matchNtpServersSecondaryNtpServerAuthenticationTypeSymmetricKey(a.SymmetricKey, b.SymmetricKey) { return false } return true @@ -514,10 +652,10 @@ func matchNtpServersSecondaryNtpServer(a *NtpServersSecondaryNtpServer, b *NtpSe } else if a == nil && b == nil { return true } - if !util.StringsMatch(a.NtpServerAddress, b.NtpServerAddress) { + if !matchNtpServersSecondaryNtpServerAuthenticationType(a.AuthenticationType, b.AuthenticationType) { return false } - if !matchNtpServersSecondaryNtpServerAuthenticationType(a.AuthenticationType, b.AuthenticationType) { + if !util.StringsMatch(a.NtpServerAddress, b.NtpServerAddress) { return false } return true diff --git a/device/services/ntp/service.go b/device/services/ntp/service.go index da4ab757..9ebf97f9 100644 --- a/device/services/ntp/service.go +++ b/device/services/ntp/service.go @@ -155,7 +155,6 @@ func (s *Service) delete(ctx context.Context, loc Location, config *Config) erro return err } deleteSuffixes := []string{} - deleteSuffixes = append(deleteSuffixes, "ntp-servers") for _, suffix := range deleteSuffixes { cmd := &xmlapi.Config{ diff --git a/example/main.go b/example/main.go index 7c04e4df..500c6a54 100644 --- a/example/main.go +++ b/example/main.go @@ -16,10 +16,10 @@ import ( "github.com/PaloAltoNetworks/pango/network/zone" "github.com/PaloAltoNetworks/pango/objects/address" address_group "github.com/PaloAltoNetworks/pango/objects/address/group" + tag "github.com/PaloAltoNetworks/pango/objects/admintag" "github.com/PaloAltoNetworks/pango/objects/service" service_group "github.com/PaloAltoNetworks/pango/objects/service/group" - "github.com/PaloAltoNetworks/pango/objects/tag" - "github.com/PaloAltoNetworks/pango/panorama/device_group" + "github.com/PaloAltoNetworks/pango/panorama/devicegroup" "github.com/PaloAltoNetworks/pango/panorama/template" "github.com/PaloAltoNetworks/pango/panorama/template_stack" "github.com/PaloAltoNetworks/pango/policies/rules/security" @@ -37,24 +37,32 @@ func main() { SkipVerifyCertificate: true, ApiKeyInRequest: true, } + if err = c.Setup(); err != nil { log.Printf("Failed to setup client: %s", err) return } - log.Printf("Setup client %s (%s)", c.Hostname, c.Username) + log.Printf("Client set up: %s@%s", c.Username, c.Hostname) if err = c.Initialize(ctx); err != nil { log.Printf("Failed to initialize client: %s", err) return } + log.Print("Client initialized") + + if err = c.RetrieveSystemInfo(ctx); err != nil { + log.Printf("Failed to retrieve system info: %s", err) + return + } + log.Print("System info retrieved") if ok, _ := c.IsPanorama(); ok { - log.Printf("Connected to Panorama, so templates and device groups are going to be created") + log.Printf("Connected to Panorama, create templates and device groups") checkTemplate(c, ctx) checkTemplateStack(c, ctx) checkDeviceGroup(c, ctx) } else { - log.Printf("Connected to firewall, so templates and device groups are not going to be created") + log.Printf("Connected to firewall, skip creating templates and device groups") } // CHECKS @@ -77,7 +85,7 @@ func main() { } func checkTemplate(c *pango.Client, ctx context.Context) { - entry := template.Entry{ + entry := &template.Entry{ Name: "codegen_template", Description: util.String("This is a template created by codegen."), DefaultVsys: util.String("vsys1"), @@ -107,7 +115,7 @@ func checkTemplate(c *pango.Client, ctx context.Context) { } func checkTemplateStack(c *pango.Client, ctx context.Context) { - entry := template_stack.Entry{ + entry := &template_stack.Entry{ Name: "codegen_template_stack", Description: util.String("This is a template stack created by codegen."), Templates: []string{"codegen_template"}, @@ -126,15 +134,14 @@ func checkTemplateStack(c *pango.Client, ctx context.Context) { } func checkDeviceGroup(c *pango.Client, ctx context.Context) { - entry := device_group.Entry{ + entry := &devicegroup.Entry{ Name: "codegen_device_group", Description: util.String("This is a device group created by codegen."), Templates: []string{"codegen_template"}, } - location := device_group.NewPanoramaLocation() - - api := device_group.NewService(c) + location := devicegroup.NewPanoramaLocation() + api := devicegroup.NewService(c) reply, err := api.Create(ctx, *location, entry) if err != nil { @@ -146,7 +153,7 @@ func checkDeviceGroup(c *pango.Client, ctx context.Context) { func checkSharedObjects(c *pango.Client, ctx context.Context) { if ok, _ := c.IsPanorama(); ok { - addressObject := address.Entry{ + addressObject := &address.Entry{ Name: "codegen_address_shared1", Description: util.String("This is a shared address created by codegen."), IpNetmask: util.String("1.2.3.4"), @@ -155,7 +162,9 @@ func checkSharedObjects(c *pango.Client, ctx context.Context) { addressLocation := address.Location{ Shared: true, } + addressApi := address.NewService(c) + addressReply, err := addressApi.Create(ctx, addressLocation, addressObject) if err != nil { log.Printf("Failed to create object: %s", err) @@ -173,7 +182,7 @@ func checkSharedObjects(c *pango.Client, ctx context.Context) { } func checkVr(c *pango.Client, ctx context.Context) { - entry := virtual_router.Entry{ + entry := &virtual_router.Entry{ Name: "codegen_vr", Protocol: &virtual_router.Protocol{ Bgp: &virtual_router.ProtocolBgp{ @@ -221,7 +230,7 @@ func checkVr(c *pango.Client, ctx context.Context) { Ecmp: &virtual_router.Ecmp{ Enable: util.Bool(true), SymmetricReturn: util.Bool(true), - MaxPaths: util.Int(3), + MaxPath: util.Int(3), Algorithm: &virtual_router.EcmpAlgorithm{ // IpHash: &virtual_router.EcmpAlgorithmIpHash{ // HashSeed: util.Int(1234), @@ -242,11 +251,12 @@ func checkVr(c *pango.Client, ctx context.Context) { // }, }, }, - AdministrativeDistances: &virtual_router.AdministrativeDistances{ + AdminDists: &virtual_router.AdminDists{ OspfInt: util.Int(77), OspfExt: util.Int(88), }, } + var location *virtual_router.Location if ok, _ := c.IsPanorama(); ok { location = virtual_router.NewTemplateLocation() @@ -254,6 +264,7 @@ func checkVr(c *pango.Client, ctx context.Context) { } else { location = virtual_router.NewNgfwLocation() } + api := virtual_router.NewService(c) reply, err := api.Create(ctx, *location, entry) @@ -265,21 +276,32 @@ func checkVr(c *pango.Client, ctx context.Context) { } func checkEthernetLayer3Static(c *pango.Client, ctx context.Context) { - entry := ethernet.Entry{ + entry := ðernet.Entry{ Name: "ethernet1/2", Comment: util.String("This is a ethernet1/2"), Layer3: ðernet.Layer3{ - NdpProxy: util.Bool(true), - Lldp: util.Bool(true), + NdpProxy: ðernet.Layer3NdpProxy{ + Enabled: util.Bool(true), + }, + Lldp: ðernet.Layer3Lldp{ + Enable: util.Bool(true), + }, AdjustTcpMss: ðernet.Layer3AdjustTcpMss{ Enable: util.Bool(true), Ipv4MssAdjustment: util.Int(250), Ipv6MssAdjustment: util.Int(250), }, Mtu: util.Int(1280), - Ips: []string{"11.11.11.11", "22.22.22.22"}, + Ip: []ethernet.Layer3Ip{ + { + Name: "11.11.11.11", + }, + { + Name: "22.22.22.22", + }, + }, Ipv6: ðernet.Layer3Ipv6{ - Addresses: []ethernet.Layer3Ipv6Addresses{ + Address: []ethernet.Layer3Ipv6Address{ { EnableOnInterface: util.Bool(false), Name: "2001:0000:130F:0000:0000:09C0:876A:230B", @@ -293,6 +315,7 @@ func checkEthernetLayer3Static(c *pango.Client, ctx context.Context) { InterfaceManagementProfile: util.String("codegen_mgmt_profile"), }, } + var location *ethernet.Location if ok, _ := c.IsPanorama(); ok { location = ethernet.NewTemplateLocation() @@ -300,9 +323,11 @@ func checkEthernetLayer3Static(c *pango.Client, ctx context.Context) { } else { location = ethernet.NewNgfwLocation() } + + var importLocation []ethernet.ImportLocation api := ethernet.NewService(c) - reply, err := api.Create(ctx, *location, entry) + reply, err := api.Create(ctx, *location, importLocation, entry) if err != nil { log.Printf("Failed to create ethernet: %s", err) return @@ -311,7 +336,7 @@ func checkEthernetLayer3Static(c *pango.Client, ctx context.Context) { } func checkEthernetLayer3Dhcp(c *pango.Client, ctx context.Context) { - entry := ethernet.Entry{ + entry := ðernet.Entry{ Name: "ethernet1/3", Comment: util.String("This is a ethernet1/3"), Layer3: ðernet.Layer3{ @@ -327,6 +352,7 @@ func checkEthernetLayer3Dhcp(c *pango.Client, ctx context.Context) { }, }, } + var location *ethernet.Location if ok, _ := c.IsPanorama(); ok { location = ethernet.NewTemplateLocation() @@ -334,9 +360,11 @@ func checkEthernetLayer3Dhcp(c *pango.Client, ctx context.Context) { } else { location = ethernet.NewNgfwLocation() } + + var importLocation []ethernet.ImportLocation api := ethernet.NewService(c) - reply, err := api.Create(ctx, *location, entry) + reply, err := api.Create(ctx, *location, importLocation, entry) if err != nil { log.Printf("Failed to create ethernet: %s", err) return @@ -345,11 +373,12 @@ func checkEthernetLayer3Dhcp(c *pango.Client, ctx context.Context) { } func checkEthernetHa(c *pango.Client, ctx context.Context) { - entry := ethernet.Entry{ + entry := ðernet.Entry{ Name: "ethernet1/10", Comment: util.String("This is a ethernet1/10"), Ha: ðernet.Ha{}, } + var location *ethernet.Location if ok, _ := c.IsPanorama(); ok { location = ethernet.NewTemplateLocation() @@ -357,9 +386,11 @@ func checkEthernetHa(c *pango.Client, ctx context.Context) { } else { location = ethernet.NewNgfwLocation() } + + var importLocation []ethernet.ImportLocation api := ethernet.NewService(c) - reply, err := api.Create(ctx, *location, entry) + reply, err := api.Create(ctx, *location, importLocation, entry) if err != nil { log.Printf("Failed to create ethernet: %s", err) return @@ -368,7 +399,7 @@ func checkEthernetHa(c *pango.Client, ctx context.Context) { } func checkLoopback(c *pango.Client, ctx context.Context) { - entry := loopback.Entry{ + entry := &loopback.Entry{ Name: "loopback.123", AdjustTcpMss: &loopback.AdjustTcpMss{ Enable: util.Bool(true), @@ -377,9 +408,16 @@ func checkLoopback(c *pango.Client, ctx context.Context) { }, Comment: util.String("This is a loopback entry"), Mtu: util.Int(1280), - Ips: []string{"1.1.1.1", "2.2.2.2"}, + Ip: []loopback.Ip{ + { + Name: "1.1.1.1", + }, + { + Name: "2.2.2.2", + }, + }, Ipv6: &loopback.Ipv6{ - Addresses: []loopback.Ipv6Addresses{ + Address: []loopback.Ipv6Address{ { EnableOnInterface: util.Bool(false), Name: "2001:0000:130F:0000:0000:09C0:876A:130B", @@ -392,6 +430,7 @@ func checkLoopback(c *pango.Client, ctx context.Context) { }, InterfaceManagementProfile: util.String("codegen_mgmt_profile"), } + var location *loopback.Location if ok, _ := c.IsPanorama(); ok { location = loopback.NewTemplateLocation() @@ -399,6 +438,7 @@ func checkLoopback(c *pango.Client, ctx context.Context) { } else { location = loopback.NewNgfwLocation() } + api := loopback.NewService(c) reply, err := api.Create(ctx, *location, entry) @@ -410,7 +450,7 @@ func checkLoopback(c *pango.Client, ctx context.Context) { } func checkZone(c *pango.Client, ctx context.Context) { - entry := zone.Entry{ + entry := &zone.Entry{ Name: "codegen_zone", EnableUserIdentification: util.Bool(true), Network: &zone.Network{ @@ -424,6 +464,7 @@ func checkZone(c *pango.Client, ctx context.Context) { ExcludeList: []string{"1.2.3.4"}, }, } + var location *zone.Location if ok, _ := c.IsPanorama(); ok { location = zone.NewTemplateLocation() @@ -431,6 +472,7 @@ func checkZone(c *pango.Client, ctx context.Context) { } else { location = zone.NewVsysLocation() } + api := zone.NewService(c) reply, err := api.Create(ctx, *location, entry) @@ -442,12 +484,16 @@ func checkZone(c *pango.Client, ctx context.Context) { } func checkInterfaceMgmtProfile(c *pango.Client, ctx context.Context) { - entry := interface_management.Entry{ - Name: "codegen_mgmt_profile", - Http: util.Bool(true), - Ping: util.Bool(true), - PermittedIps: []string{"1.1.1.1", "2.2.2.2"}, + entry := &interface_management.Entry{ + Name: "codegen_mgmt_profile", + Http: util.Bool(true), + Ping: util.Bool(true), + PermittedIp: []interface_management.PermittedIp{ + {Name: "1.1.1.1"}, + {Name: "2.2.2.2"}, + }, } + var location *interface_management.Location if ok, _ := c.IsPanorama(); ok { location = interface_management.NewTemplateLocation() @@ -455,6 +501,7 @@ func checkInterfaceMgmtProfile(c *pango.Client, ctx context.Context) { } else { location = interface_management.NewNgfwLocation() } + api := interface_management.NewService(c) reply, err := api.Create(ctx, *location, entry) @@ -474,6 +521,7 @@ func checkVrZoneWithEthernet(c *pango.Client, ctx context.Context) { } else { locationVr = virtual_router.NewNgfwLocation() } + apiVr := virtual_router.NewService(c) replyVr, err := apiVr.Read(ctx, *locationVr, "codegen_vr", "get") @@ -483,14 +531,14 @@ func checkVrZoneWithEthernet(c *pango.Client, ctx context.Context) { } log.Printf("VR %s read\n", replyVr.Name) - replyVr.Interfaces = []string{"ethernet1/2", "ethernet1/3"} + replyVr.Interface = []string{"ethernet1/2", "ethernet1/3"} - replyVr, err = apiVr.Update(ctx, *locationVr, *replyVr, "codegen_vr") + replyVr, err = apiVr.Update(ctx, *locationVr, replyVr, "codegen_vr") if err != nil { log.Printf("Failed to update VR: %s", err) return } - log.Printf("VR %s updated with %s\n", replyVr.Name, replyVr.Interfaces) + log.Printf("VR %s updated with %s\n", replyVr.Name, replyVr.Interface) // UPDATE ZONE ABOUT INTERFACES var locationZone *zone.Location @@ -500,6 +548,7 @@ func checkVrZoneWithEthernet(c *pango.Client, ctx context.Context) { } else { locationZone = zone.NewVsysLocation() } + apiZone := zone.NewService(c) replyZone, err := apiZone.Read(ctx, *locationZone, "codegen_zone", "get") @@ -514,7 +563,7 @@ func checkVrZoneWithEthernet(c *pango.Client, ctx context.Context) { Layer3: []string{"ethernet1/2", "ethernet1/3"}, } - replyZone, err = apiZone.Update(ctx, *locationZone, *replyZone, "codegen_zone") + replyZone, err = apiZone.Update(ctx, *locationZone, replyZone, "codegen_zone") if err != nil { log.Printf("Failed to update zone: %s", err) return @@ -522,14 +571,14 @@ func checkVrZoneWithEthernet(c *pango.Client, ctx context.Context) { log.Printf("Zone %s updated with %s\n", replyZone.Name, replyZone.Network.Layer3) // DELETE INTERFACES FROM VR - replyVr.Interfaces = []string{} + replyVr.Interface = []string{} - replyVr, err = apiVr.Update(ctx, *locationVr, *replyVr, "codegen_vr") + replyVr, err = apiVr.Update(ctx, *locationVr, replyVr, "codegen_vr") if err != nil { log.Printf("Failed to update VR: %s", err) return } - log.Printf("VR %s updated with %s\n", replyVr.Name, replyVr.Interfaces) + log.Printf("VR %s updated with %s\n", replyVr.Name, replyVr.Interface) // DELETE INTERFACES FROM ZONE replyZone.Network = &zone.Network{ @@ -537,7 +586,7 @@ func checkVrZoneWithEthernet(c *pango.Client, ctx context.Context) { Layer3: []string{}, } - replyZone, err = apiZone.Update(ctx, *locationZone, *replyZone, "codegen_zone") + replyZone, err = apiZone.Update(ctx, *locationZone, replyZone, "codegen_zone") if err != nil { log.Printf("Failed to update zone: %s", err) return @@ -552,11 +601,13 @@ func checkVrZoneWithEthernet(c *pango.Client, ctx context.Context) { } else { ethernetLocation = ethernet.NewNgfwLocation() } + + var importLocation []ethernet.ImportLocation api := ethernet.NewService(c) interfacesToDelete := []string{"ethernet1/2", "ethernet1/3"} for _, iface := range interfacesToDelete { - err = api.Delete(ctx, *ethernetLocation, iface) + err = api.Delete(ctx, *ethernetLocation, importLocation, iface) if err != nil { log.Printf("Failed to delete ethernet: %s", err) return @@ -567,16 +618,16 @@ func checkVrZoneWithEthernet(c *pango.Client, ctx context.Context) { func checkSecurityPolicyRules(c *pango.Client, ctx context.Context) { // SECURITY POLICY RULE - ADD - securityPolicyRuleEntry := security.Entry{ - Name: "codegen_rule", - Description: util.String("initial description"), - Action: util.String("allow"), - SourceZones: []string{"any"}, - SourceAddresses: []string{"any"}, - DestinationZones: []string{"any"}, - DestinationAddresses: []string{"any"}, - Applications: []string{"any"}, - Services: []string{"application-default"}, + securityPolicyRuleEntry := &security.Entry{ + Name: "codegen_rule", + Description: util.String("initial description"), + Action: util.String("allow"), + From: []string{"any"}, + To: []string{"any"}, + Source: []string{"any"}, + Destination: []string{"any"}, + Application: []string{"any"}, + Service: []string{"application-default"}, } var securityPolicyRuleLocation *security.Location @@ -588,6 +639,7 @@ func checkSecurityPolicyRules(c *pango.Client, ctx context.Context) { } securityPolicyRuleApi := security.NewService(c) + securityPolicyRuleReply, err := securityPolicyRuleApi.Create(ctx, *securityPolicyRuleLocation, securityPolicyRuleEntry) if err != nil { log.Printf("Failed to create security policy rule: %s", err) @@ -662,6 +714,7 @@ func checkSecurityPolicyRules(c *pango.Client, ctx context.Context) { log.Printf("Failed to get audit comments for security policy rule: %s", err) return } + for _, comment := range comments { log.Printf("Security policy rule '%s:%s' comment history: '%s:%s'", *securityPolicyRuleReply.Uuid, securityPolicyRuleReply.Name, comment.Time, comment.Comment) } @@ -695,20 +748,21 @@ func checkSecurityPolicyRulesMove(c *pango.Client, ctx context.Context) { securityPolicyRuleApi := security.NewService(c) + var securityPolicyRulesEntries []*security.Entry securityPolicyRulesNames := make([]string, 10) - var securityPolicyRulesEntries []security.Entry + for i := 0; i < 10; i++ { securityPolicyRulesNames[i] = fmt.Sprintf("codegen_rule%d", i) - securityPolicyRuleItem := security.Entry{ - Name: securityPolicyRulesNames[i], - Description: util.String("initial description"), - Action: util.String("allow"), - SourceZones: []string{"any"}, - SourceAddresses: []string{"any"}, - DestinationZones: []string{"any"}, - DestinationAddresses: []string{"any"}, - Applications: []string{"any"}, - Services: []string{"application-default"}, + securityPolicyRuleItem := &security.Entry{ + Name: securityPolicyRulesNames[i], + Description: util.String("initial description"), + Action: util.String("allow"), + From: []string{"any"}, + To: []string{"any"}, + Source: []string{"any"}, + Destination: []string{"any"}, + Application: []string{"any"}, + Service: []string{"application-default"}, } securityPolicyRulesEntries = append(securityPolicyRulesEntries, securityPolicyRuleItem) securityPolicyRuleItemReply, err := securityPolicyRuleApi.Create(ctx, *securityPolicyRuleLocation, securityPolicyRuleItem) @@ -718,6 +772,7 @@ func checkSecurityPolicyRulesMove(c *pango.Client, ctx context.Context) { } log.Printf("Security policy rule '%s:%s' with description '%s' created", *securityPolicyRuleItemReply.Uuid, securityPolicyRuleItemReply.Name, *securityPolicyRuleItemReply.Description) } + rulePositionBefore7 := rule.Position{ First: nil, Last: nil, @@ -734,9 +789,11 @@ func checkSecurityPolicyRulesMove(c *pango.Client, ctx context.Context) { SomewhereAfter: nil, DirectlyAfter: nil, } - var securityPolicyRulesEntriesToMove []security.Entry + + var securityPolicyRulesEntriesToMove []*security.Entry securityPolicyRulesEntriesToMove = append(securityPolicyRulesEntriesToMove, securityPolicyRulesEntries[3]) securityPolicyRulesEntriesToMove = append(securityPolicyRulesEntriesToMove, securityPolicyRulesEntries[5]) + for _, securityPolicyRuleItemToMove := range securityPolicyRulesEntriesToMove { log.Printf("Security policy rule '%s' is going to be moved", securityPolicyRuleItemToMove.Name) } @@ -745,7 +802,8 @@ func checkSecurityPolicyRulesMove(c *pango.Client, ctx context.Context) { log.Printf("Failed to move security policy rules %v: %s", securityPolicyRulesEntriesToMove, err) return } - securityPolicyRulesEntriesToMove = []security.Entry{securityPolicyRulesEntries[1]} + + securityPolicyRulesEntriesToMove = []*security.Entry{securityPolicyRulesEntries[1]} for _, securityPolicyRuleItemToMove := range securityPolicyRulesEntriesToMove { log.Printf("Security policy rule '%s' is going to be moved", securityPolicyRuleItemToMove.Name) } @@ -754,6 +812,7 @@ func checkSecurityPolicyRulesMove(c *pango.Client, ctx context.Context) { log.Printf("Failed to move security policy rules %v: %s", securityPolicyRulesEntriesToMove, err) return } + err = securityPolicyRuleApi.Delete(ctx, *securityPolicyRuleLocation, securityPolicyRulesNames...) if err != nil { log.Printf("Failed to delete security policy rules %s: %s", securityPolicyRulesNames, err) @@ -764,7 +823,7 @@ func checkSecurityPolicyRulesMove(c *pango.Client, ctx context.Context) { func checkTag(c *pango.Client, ctx context.Context) { // TAG - CREATE tagColor := tag.ColorAzureBlue - tagObject := tag.Entry{ + tagObject := &tag.Entry{ Name: "codegen_color", Color: &tagColor, } @@ -796,7 +855,7 @@ func checkTag(c *pango.Client, ctx context.Context) { func checkAddress(c *pango.Client, ctx context.Context) { // ADDRESS - CREATE - addressObject := address.Entry{ + addressObject := &address.Entry{ Name: "codegen_address_test1", IpNetmask: util.String("12.13.14.25"), } @@ -810,6 +869,7 @@ func checkAddress(c *pango.Client, ctx context.Context) { } addressApi := address.NewService(c) + addressReply, err := addressApi.Create(ctx, *addressLocation, addressObject) if err != nil { log.Printf("Failed to create object: %s", err) @@ -828,7 +888,7 @@ func checkAddress(c *pango.Client, ctx context.Context) { } // ADDRESS - GROUP - addressGroupObject := address_group.Entry{ + addressGroupObject := &address_group.Entry{ Name: "codegen_address_group_test1", Static: []string{addressReply.Name}, } @@ -842,6 +902,7 @@ func checkAddress(c *pango.Client, ctx context.Context) { } addressGroupApi := address_group.NewService(c) + addressGroupReply, err := addressGroupApi.Create(ctx, *addressGroupLocation, addressGroupObject) if err != nil { log.Printf("Failed to create object: %s", err) @@ -868,12 +929,12 @@ func checkAddress(c *pango.Client, ctx context.Context) { func checkService(c *pango.Client, ctx context.Context) { // SERVICE - ADD - serviceObject := service.Entry{ + serviceObject := &service.Entry{ Name: "codegen_service_test1", Description: util.String("test description"), Protocol: &service.Protocol{ Tcp: &service.ProtocolTcp{ - DestinationPort: util.Int(8642), + Port: util.String("8642"), Override: &service.ProtocolTcpOverride{ HalfcloseTimeout: util.Int(124), Timeout: util.Int(125), @@ -892,32 +953,31 @@ func checkService(c *pango.Client, ctx context.Context) { } serviceApi := service.NewService(c) + serviceReply, err := serviceApi.Create(ctx, *serviceLocation, serviceObject) if err != nil { log.Printf("Failed to create object: %s", err) return } - log.Printf("Service '%s=%d' created", serviceReply.Name, *serviceReply.Protocol.Tcp.DestinationPort) + log.Printf("Service '%s=%s' created", serviceReply.Name, *serviceReply.Protocol.Tcp.Port) // SERVICE - UPDATE 1 serviceObject.Description = util.String("changed description") - serviceReply, err = serviceApi.Update(ctx, *serviceLocation, serviceObject, serviceReply.Name) if err != nil { log.Printf("Failed to update object: %s", err) return } - log.Printf("Service '%s=%d' updated", serviceReply.Name, *serviceReply.Protocol.Tcp.DestinationPort) + log.Printf("Service '%s=%s' updated", serviceReply.Name, *serviceReply.Protocol.Tcp.Port) // SERVICE - UPDATE 2 - serviceObject.Protocol.Tcp.DestinationPort = util.Int(1234) - + serviceObject.Protocol.Tcp.Port = util.String("1234") serviceReply, err = serviceApi.Update(ctx, *serviceLocation, serviceObject, serviceReply.Name) if err != nil { log.Printf("Failed to update object: %s", err) return } - log.Printf("Service '%s=%d' updated", serviceReply.Name, *serviceReply.Protocol.Tcp.DestinationPort) + log.Printf("Service '%s=%s' updated", serviceReply.Name, *serviceReply.Protocol.Tcp.Port) // SERVICE - RENAME newServiceName := "codegen_service_test2" @@ -928,10 +988,10 @@ func checkService(c *pango.Client, ctx context.Context) { log.Printf("Failed to update object: %s", err) return } - log.Printf("Service '%s=%d' renamed", serviceReply.Name, *serviceReply.Protocol.Tcp.DestinationPort) + log.Printf("Service '%s=%s' renamed", serviceReply.Name, *serviceReply.Protocol.Tcp.Port) // SERVICE GROUP ADD - serviceGroupEntry := service_group.Entry{ + serviceGroupEntry := &service_group.Entry{ Name: "codegen_service_group_test1", Members: []string{serviceReply.Name}, } @@ -945,6 +1005,7 @@ func checkService(c *pango.Client, ctx context.Context) { } serviceGroupApi := service_group.NewService(c) + serviceGroupReply, err := serviceGroupApi.Create(ctx, *serviceGroupLocation, serviceGroupEntry) if err != nil { log.Printf("Failed to create object: %s", err) @@ -983,15 +1044,18 @@ func checkService(c *pango.Client, ctx context.Context) { serviceLocation = service.NewVsysLocation() serviceApi = service.NewService(c) + serviceReply, err = serviceApi.Read(ctx, *serviceLocation, "test", "get") if err != nil { log.Printf("Failed to read object: %s", err) return } + readDescription := "" if serviceReply.Description != nil { readDescription = *serviceReply.Description } + keys := make([]string, 0, len(serviceReply.Misc)) xmls := make([]string, 0, len(serviceReply.Misc)) for key := range serviceReply.Misc { @@ -999,21 +1063,23 @@ func checkService(c *pango.Client, ctx context.Context) { data, _ := xml.Marshal(serviceReply.Misc[key]) xmls = append(xmls, string(data)) } - log.Printf("Service '%s=%d, description: %s misc XML: %s, misc keys: %s' read", - serviceReply.Name, *serviceReply.Protocol.Tcp.DestinationPort, readDescription, xmls, keys) + log.Printf("Service '%s=%s, description: %s misc XML: %s, misc keys: %s' read", + serviceReply.Name, *serviceReply.Protocol.Tcp.Port, readDescription, xmls, keys) // SERVICE - UPDATE 3 serviceReply.Description = util.String("some text changed now") - serviceReply, err = serviceApi.Update(ctx, *serviceLocation, *serviceReply, "test") + serviceReply, err = serviceApi.Update(ctx, *serviceLocation, serviceReply, "test") if err != nil { log.Printf("Failed to update object: %s", err) return } + readDescription = "" if serviceReply.Description != nil { readDescription = *serviceReply.Description } + keys = make([]string, 0, len(serviceReply.Misc)) xmls = make([]string, 0, len(serviceReply.Misc)) for key := range serviceReply.Misc { @@ -1021,13 +1087,13 @@ func checkService(c *pango.Client, ctx context.Context) { data, _ := xml.Marshal(serviceReply.Misc[key]) xmls = append(xmls, string(data)) } - log.Printf("Service '%s=%d, description: %s misc XML: %s, misc keys: %s' update", - serviceReply.Name, *serviceReply.Protocol.Tcp.DestinationPort, readDescription, xmls, keys) + log.Printf("Service '%s=%s, description: %s misc XML: %s, misc keys: %s' update", + serviceReply.Name, *serviceReply.Protocol.Tcp.Port, readDescription, xmls, keys) } func checkNtp(c *pango.Client, ctx context.Context) { // NTP - ADD - ntpConfig := ntp.Config{ + ntpConfig := &ntp.Config{ NtpServers: &ntp.NtpServers{ PrimaryNtpServer: &ntp.NtpServersPrimaryNtpServer{ NtpServerAddress: util.String("11.12.13.14"), @@ -1044,6 +1110,7 @@ func checkNtp(c *pango.Client, ctx context.Context) { } ntpApi := ntp.NewService(c) + ntpReply, err := ntpApi.Create(ctx, *ntpLocation, ntpConfig) if err != nil { log.Printf("Failed to create NTP: %s", err) @@ -1063,7 +1130,7 @@ func checkNtp(c *pango.Client, ctx context.Context) { func checkDns(c *pango.Client, ctx context.Context) { // DNS - ADD - dnsConfig := dns.Config{ + dnsConfig := &dns.Config{ DnsSetting: &dns.DnsSetting{ Servers: &dns.DnsSettingServers{ Primary: util.String("8.8.8.8"), @@ -1082,6 +1149,7 @@ func checkDns(c *pango.Client, ctx context.Context) { } dnsApi := dns.NewService(c) + dnsReply, err := dnsApi.Create(ctx, *dnsLocation, dnsConfig) if err != nil { log.Printf("Failed to create DNS: %s", err) diff --git a/filtering/parse_test.go b/filtering/parse_test.go index 0e388648..426bd5bf 100644 --- a/filtering/parse_test.go +++ b/filtering/parse_test.go @@ -932,7 +932,6 @@ func TestParseReturnsError(t *testing.T) { "foobar", "(", ")", - "", } for _, s := range checks { @@ -942,6 +941,15 @@ func TestParseReturnsError(t *testing.T) { } } +func TestParseEmptyString(t *testing.T) { + resp, err := Parse("", `"`) + if err != nil { + t.Fatalf("parse empty string error: %s", err) + } else if resp != nil { + t.Fatalf("parse empty string has non-nil group") + } +} + func TestParseWithInvalidQuoteReturnsError(t *testing.T) { quotes := []string{ "|", diff --git a/go.sum b/go.sum index b4208ee7..1564c9b1 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,3 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= @@ -12,10 +10,6 @@ github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= @@ -24,9 +18,6 @@ golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/logging.go b/logging.go index 897ca86e..da69024e 100644 --- a/logging.go +++ b/logging.go @@ -33,7 +33,7 @@ const ( LogCategoryCurl LogCategoryAll = LogCategoryPango | LogCategoryOp | LogCategorySend | LogCategoryReceive | LogCategoryCurl - // Make sure that LogCategorySensitive is always last, explicitly set to 1 << 32 + // Make sure that LogCategorySensitive is always last, explicitly set to 1 << 16 LogCategorySensitive LogCategory = 1 << 16 ) @@ -80,7 +80,6 @@ func LogCategoryFromStrings(symbols []string) (LogCategory, error) { } logCategoriesMask |= category - slog.Info("logCategoriesMask", "equal", logCategoriesMask) } return logCategoriesMask, nil } diff --git a/network/interface/aggregate/entry.go b/network/interface/aggregate/entry.go new file mode 100644 index 00000000..2cb1a0ad --- /dev/null +++ b/network/interface/aggregate/entry.go @@ -0,0 +1,4850 @@ +package aggregate + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"network", "interface", "aggregate-ethernet"} +) + +type Entry struct { + Name string + Comment *string + DecryptMirror *DecryptMirror + Ha *Ha + Layer2 *Layer2 + Layer3 *Layer3 + VirtualWire *VirtualWire + + Misc map[string][]generic.Xml +} + +type DecryptMirror struct { +} +type Ha struct { + Lacp *HaLacp +} +type HaLacp struct { + Enable *bool + FastFailover *bool + MaxPorts *int64 + Mode *string + SystemPriority *int64 + TransmissionRate *string +} +type Layer2 struct { + Lacp *Layer2Lacp + Lldp *Layer2Lldp + NetflowProfile *string +} +type Layer2Lacp struct { + Enable *bool + FastFailover *bool + HighAvailability *Layer2LacpHighAvailability + MaxPorts *int64 + Mode *string + SystemPriority *int64 + TransmissionRate *string +} +type Layer2LacpHighAvailability struct { + PassivePreNegotiation *bool +} +type Layer2Lldp struct { + Enable *bool + HighAvailability *Layer2LldpHighAvailability + Profile *string +} +type Layer2LldpHighAvailability struct { + PassivePreNegotiation *bool +} +type Layer3 struct { + AdjustTcpMss *Layer3AdjustTcpMss + Arp []Layer3Arp + Bonjour *Layer3Bonjour + DdnsConfig *Layer3DdnsConfig + DecryptForward *bool + DfIgnore *bool + DhcpClient *Layer3DhcpClient + InterfaceManagementProfile *string + Ip []Layer3Ip + Ipv6 *Layer3Ipv6 + Lacp *Layer3Lacp + Lldp *Layer3Lldp + Mtu *int64 + NdpProxy *Layer3NdpProxy + NetflowProfile *string + SdwanLinkSettings *Layer3SdwanLinkSettings + UntaggedSubInterface *bool +} +type Layer3AdjustTcpMss struct { + Enable *bool + Ipv4MssAdjustment *int64 + Ipv6MssAdjustment *int64 +} +type Layer3Arp struct { + HwAddress *string + Name string +} +type Layer3Bonjour struct { + Enable *bool + GroupId *int64 + TtlCheck *bool +} +type Layer3DdnsConfig struct { + DdnsCertProfile *string + DdnsEnabled *bool + DdnsHostname *string + DdnsIp []string + DdnsIpv6 []string + DdnsUpdateInterval *int64 + DdnsVendor *string + DdnsVendorConfig []Layer3DdnsConfigDdnsVendorConfig +} +type Layer3DdnsConfigDdnsVendorConfig struct { + Name string + Value *string +} +type Layer3DhcpClient struct { + CreateDefaultRoute *bool + DefaultRouteMetric *int64 + Enable *bool + SendHostname *Layer3DhcpClientSendHostname +} +type Layer3DhcpClientSendHostname struct { + Enable *bool + Hostname *string +} +type Layer3Ip struct { + Name string + SdwanGateway *string +} +type Layer3Ipv6 struct { + Address []Layer3Ipv6Address + DhcpClient *Layer3Ipv6DhcpClient + Enabled *bool + Inherited *Layer3Ipv6Inherited + InterfaceId *string + NeighborDiscovery *Layer3Ipv6NeighborDiscovery +} +type Layer3Ipv6Address struct { + Advertise *Layer3Ipv6AddressAdvertise + Anycast *Layer3Ipv6AddressAnycast + EnableOnInterface *bool + Name string + Prefix *Layer3Ipv6AddressPrefix +} +type Layer3Ipv6AddressAdvertise struct { + AutoConfigFlag *bool + Enable *bool + OnlinkFlag *bool + PreferredLifetime *string + ValidLifetime *string +} +type Layer3Ipv6AddressAnycast struct { +} +type Layer3Ipv6AddressPrefix struct { +} +type Layer3Ipv6DhcpClient struct { + AcceptRaRoute *bool + DefaultRouteMetric *int64 + Enable *bool + NeighborDiscovery *Layer3Ipv6DhcpClientNeighborDiscovery + Preference *string + PrefixDelegation *Layer3Ipv6DhcpClientPrefixDelegation + V6Options *Layer3Ipv6DhcpClientV6Options +} +type Layer3Ipv6DhcpClientNeighborDiscovery struct { + DadAttempts *int64 + DnsServer *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer + DnsSuffix *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix + EnableDad *bool + EnableNdpMonitor *bool + Neighbor []Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor + NsInterval *int64 + ReachableTime *int64 +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer struct { + Enable *bool + Source *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource struct { + Dhcpv6 *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6 + Manual *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6 struct { +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual struct { + Server []Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer struct { + Lifetime *int64 + Name string +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix struct { + Enable *bool + Source *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource struct { + Dhcpv6 *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6 + Manual *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6 struct { +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual struct { + Suffix []Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix struct { + Lifetime *int64 + Name string +} +type Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor struct { + HwAddress *string + Name string +} +type Layer3Ipv6DhcpClientPrefixDelegation struct { + Enable *Layer3Ipv6DhcpClientPrefixDelegationEnable +} +type Layer3Ipv6DhcpClientPrefixDelegationEnable struct { + No *Layer3Ipv6DhcpClientPrefixDelegationEnableNo + Yes *Layer3Ipv6DhcpClientPrefixDelegationEnableYes +} +type Layer3Ipv6DhcpClientPrefixDelegationEnableNo struct { +} +type Layer3Ipv6DhcpClientPrefixDelegationEnableYes struct { + PfxPoolName *string + PrefixLen *int64 + PrefixLenHint *bool +} +type Layer3Ipv6DhcpClientV6Options struct { + DuidType *string + Enable *Layer3Ipv6DhcpClientV6OptionsEnable + RapidCommit *bool + SupportSrvrReconfig *bool +} +type Layer3Ipv6DhcpClientV6OptionsEnable struct { + No *Layer3Ipv6DhcpClientV6OptionsEnableNo + Yes *Layer3Ipv6DhcpClientV6OptionsEnableYes +} +type Layer3Ipv6DhcpClientV6OptionsEnableNo struct { +} +type Layer3Ipv6DhcpClientV6OptionsEnableYes struct { + NonTempAddr *bool + TempAddr *bool +} +type Layer3Ipv6Inherited struct { + AssignAddr []Layer3Ipv6InheritedAssignAddr + Enable *bool + NeighborDiscovery *Layer3Ipv6InheritedNeighborDiscovery +} +type Layer3Ipv6InheritedAssignAddr struct { + Name string + Type *Layer3Ipv6InheritedAssignAddrType +} +type Layer3Ipv6InheritedAssignAddrType struct { + Gua *Layer3Ipv6InheritedAssignAddrTypeGua + Ula *Layer3Ipv6InheritedAssignAddrTypeUla +} +type Layer3Ipv6InheritedAssignAddrTypeGua struct { + Advertise *Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise + EnableOnInterface *bool + PoolType *Layer3Ipv6InheritedAssignAddrTypeGuaPoolType + PrefixPool *string +} +type Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise struct { + AutoConfigFlag *bool + Enable *bool + OnlinkFlag *bool +} +type Layer3Ipv6InheritedAssignAddrTypeGuaPoolType struct { + Dynamic *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic + DynamicId *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId +} +type Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic struct { +} +type Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId struct { + Identifier *int64 +} +type Layer3Ipv6InheritedAssignAddrTypeUla struct { + Address *string + Advertise *Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise + Anycast *bool + EnableOnInterface *bool + Prefix *bool +} +type Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise struct { + AutoConfigFlag *bool + Enable *bool + OnlinkFlag *bool + PreferredLifetime *string + ValidLifetime *string +} +type Layer3Ipv6InheritedNeighborDiscovery struct { + DadAttempts *int64 + DnsServer *Layer3Ipv6InheritedNeighborDiscoveryDnsServer + DnsSuffix *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix + EnableDad *bool + EnableNdpMonitor *bool + Neighbor []Layer3Ipv6InheritedNeighborDiscoveryNeighbor + NsInterval *int64 + ReachableTime *int64 + RouterAdvertisement *Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServer struct { + Enable *bool + Source *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource struct { + Dhcpv6 *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6 + Manual *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6 struct { + PrefixPool *string +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual struct { + Server []Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer struct { + Lifetime *int64 + Name string +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix struct { + Enable *bool + Source *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource struct { + Dhcpv6 *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6 + Manual *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6 struct { + PrefixPool *string +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual struct { + Suffix []Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix struct { + Lifetime *int64 + Name string +} +type Layer3Ipv6InheritedNeighborDiscoveryNeighbor struct { + HwAddress *string + Name string +} +type Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement struct { + Enable *bool + EnableConsistencyCheck *bool + HopLimit *string + Lifetime *int64 + LinkMtu *string + ManagedFlag *bool + MaxInterval *int64 + MinInterval *int64 + OtherFlag *bool + ReachableTime *string + RetransmissionTimer *string + RouterPreference *string +} +type Layer3Ipv6NeighborDiscovery struct { + DadAttempts *int64 + EnableDad *bool + EnableNdpMonitor *bool + Neighbor []Layer3Ipv6NeighborDiscoveryNeighbor + NsInterval *int64 + ReachableTime *int64 + RouterAdvertisement *Layer3Ipv6NeighborDiscoveryRouterAdvertisement +} +type Layer3Ipv6NeighborDiscoveryNeighbor struct { + HwAddress *string + Name string +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisement struct { + DnsSupport *Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport + Enable *bool + EnableConsistencyCheck *bool + HopLimit *string + Lifetime *int64 + LinkMtu *string + ManagedFlag *bool + MaxInterval *int64 + MinInterval *int64 + OtherFlag *bool + ReachableTime *string + RetransmissionTimer *string + RouterPreference *string +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport struct { + Enable *bool + Server []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer + Suffix []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer struct { + Lifetime *int64 + Name string +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix struct { + Lifetime *int64 + Name string +} +type Layer3Lacp struct { + Enable *bool + FastFailover *bool + HighAvailability *Layer3LacpHighAvailability + MaxPorts *int64 + Mode *string + SystemPriority *int64 + TransmissionRate *string +} +type Layer3LacpHighAvailability struct { + PassivePreNegotiation *bool +} +type Layer3Lldp struct { + Enable *bool + HighAvailability *Layer3LldpHighAvailability + Profile *string +} +type Layer3LldpHighAvailability struct { + PassivePreNegotiation *bool +} +type Layer3NdpProxy struct { + Address []Layer3NdpProxyAddress + Enabled *bool +} +type Layer3NdpProxyAddress struct { + Name string + Negate *bool +} +type Layer3SdwanLinkSettings struct { + Enable *bool + SdwanInterfaceProfile *string + UpstreamNat *Layer3SdwanLinkSettingsUpstreamNat +} +type Layer3SdwanLinkSettingsUpstreamNat struct { + Enable *bool + Ddns *Layer3SdwanLinkSettingsUpstreamNatDdns + StaticIp *Layer3SdwanLinkSettingsUpstreamNatStaticIp +} +type Layer3SdwanLinkSettingsUpstreamNatDdns struct { +} +type Layer3SdwanLinkSettingsUpstreamNatStaticIp struct { + Fqdn *string + IpAddress *string +} +type VirtualWire struct { + Lldp *VirtualWireLldp + NetflowProfile *string +} +type VirtualWireLldp struct { + Enable *bool + HighAvailability *VirtualWireLldpHighAvailability + Profile *string +} +type VirtualWireLldpHighAvailability struct { + PassivePreNegotiation *bool +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Comment *string `xml:"comment,omitempty"` + DecryptMirror *DecryptMirrorXml `xml:"decrypt-mirror,omitempty"` + Ha *HaXml `xml:"ha,omitempty"` + Layer2 *Layer2Xml `xml:"layer2,omitempty"` + Layer3 *Layer3Xml `xml:"layer3,omitempty"` + VirtualWire *VirtualWireXml `xml:"virtual-wire,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type DecryptMirrorXml struct { + Misc []generic.Xml `xml:",any"` +} +type HaXml struct { + Lacp *HaLacpXml `xml:"lacp,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type HaLacpXml struct { + Enable *string `xml:"enable,omitempty"` + FastFailover *string `xml:"fast-failover,omitempty"` + MaxPorts *int64 `xml:"max-ports,omitempty"` + Mode *string `xml:"mode,omitempty"` + SystemPriority *int64 `xml:"system-priority,omitempty"` + TransmissionRate *string `xml:"transmission-rate,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer2Xml struct { + Lacp *Layer2LacpXml `xml:"lacp,omitempty"` + Lldp *Layer2LldpXml `xml:"lldp,omitempty"` + NetflowProfile *string `xml:"netflow-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer2LacpXml struct { + Enable *string `xml:"enable,omitempty"` + FastFailover *string `xml:"fast-failover,omitempty"` + HighAvailability *Layer2LacpHighAvailabilityXml `xml:"high-availability,omitempty"` + MaxPorts *int64 `xml:"max-ports,omitempty"` + Mode *string `xml:"mode,omitempty"` + SystemPriority *int64 `xml:"system-priority,omitempty"` + TransmissionRate *string `xml:"transmission-rate,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer2LacpHighAvailabilityXml struct { + PassivePreNegotiation *string `xml:"passive-pre-negotiation,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer2LldpXml struct { + Enable *string `xml:"enable,omitempty"` + HighAvailability *Layer2LldpHighAvailabilityXml `xml:"high-availability,omitempty"` + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer2LldpHighAvailabilityXml struct { + PassivePreNegotiation *string `xml:"passive-pre-negotiation,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Xml struct { + AdjustTcpMss *Layer3AdjustTcpMssXml `xml:"adjust-tcp-mss,omitempty"` + Arp []Layer3ArpXml `xml:"arp>entry,omitempty"` + Bonjour *Layer3BonjourXml `xml:"bonjour,omitempty"` + DdnsConfig *Layer3DdnsConfigXml `xml:"ddns-config,omitempty"` + DecryptForward *string `xml:"decrypt-forward,omitempty"` + DfIgnore *string `xml:"df-ignore,omitempty"` + DhcpClient *Layer3DhcpClientXml `xml:"dhcp-client,omitempty"` + InterfaceManagementProfile *string `xml:"interface-management-profile,omitempty"` + Ip []Layer3IpXml `xml:"ip>entry,omitempty"` + Ipv6 *Layer3Ipv6Xml `xml:"ipv6,omitempty"` + Lacp *Layer3LacpXml `xml:"lacp,omitempty"` + Lldp *Layer3LldpXml `xml:"lldp,omitempty"` + Mtu *int64 `xml:"mtu,omitempty"` + NdpProxy *Layer3NdpProxyXml `xml:"ndp-proxy,omitempty"` + NetflowProfile *string `xml:"netflow-profile,omitempty"` + SdwanLinkSettings *Layer3SdwanLinkSettingsXml `xml:"sdwan-link-settings,omitempty"` + UntaggedSubInterface *string `xml:"untagged-sub-interface,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3AdjustTcpMssXml struct { + Enable *string `xml:"enable,omitempty"` + Ipv4MssAdjustment *int64 `xml:"ipv4-mss-adjustment,omitempty"` + Ipv6MssAdjustment *int64 `xml:"ipv6-mss-adjustment,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3ArpXml struct { + HwAddress *string `xml:"hw-address,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3BonjourXml struct { + Enable *string `xml:"enable,omitempty"` + GroupId *int64 `xml:"group-id,omitempty"` + TtlCheck *string `xml:"ttl-check,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3DdnsConfigXml struct { + DdnsCertProfile *string `xml:"ddns-cert-profile,omitempty"` + DdnsEnabled *string `xml:"ddns-enabled,omitempty"` + DdnsHostname *string `xml:"ddns-hostname,omitempty"` + DdnsIp *util.MemberType `xml:"ddns-ip,omitempty"` + DdnsIpv6 *util.MemberType `xml:"ddns-ipv6,omitempty"` + DdnsUpdateInterval *int64 `xml:"ddns-update-interval,omitempty"` + DdnsVendor *string `xml:"ddns-vendor,omitempty"` + DdnsVendorConfig []Layer3DdnsConfigDdnsVendorConfigXml `xml:"ddns-vendor-config>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3DdnsConfigDdnsVendorConfigXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Value *string `xml:"value,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3DhcpClientXml struct { + CreateDefaultRoute *string `xml:"create-default-route,omitempty"` + DefaultRouteMetric *int64 `xml:"default-route-metric,omitempty"` + Enable *string `xml:"enable,omitempty"` + SendHostname *Layer3DhcpClientSendHostnameXml `xml:"send-hostname,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3DhcpClientSendHostnameXml struct { + Enable *string `xml:"enable,omitempty"` + Hostname *string `xml:"hostname,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3IpXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + SdwanGateway *string `xml:"sdwan-gateway,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6Xml struct { + Address []Layer3Ipv6AddressXml `xml:"address>entry,omitempty"` + DhcpClient *Layer3Ipv6DhcpClientXml `xml:"dhcp-client,omitempty"` + Enabled *string `xml:"enabled,omitempty"` + Inherited *Layer3Ipv6InheritedXml `xml:"inherited,omitempty"` + InterfaceId *string `xml:"interface-id,omitempty"` + NeighborDiscovery *Layer3Ipv6NeighborDiscoveryXml `xml:"neighbor-discovery,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6AddressXml struct { + Advertise *Layer3Ipv6AddressAdvertiseXml `xml:"advertise,omitempty"` + Anycast *Layer3Ipv6AddressAnycastXml `xml:"anycast,omitempty"` + EnableOnInterface *string `xml:"enable-on-interface,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Prefix *Layer3Ipv6AddressPrefixXml `xml:"prefix,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6AddressAdvertiseXml struct { + AutoConfigFlag *string `xml:"auto-config-flag,omitempty"` + Enable *string `xml:"enable,omitempty"` + OnlinkFlag *string `xml:"onlink-flag,omitempty"` + PreferredLifetime *string `xml:"preferred-lifetime,omitempty"` + ValidLifetime *string `xml:"valid-lifetime,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6AddressAnycastXml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6AddressPrefixXml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientXml struct { + AcceptRaRoute *string `xml:"accept-ra-route,omitempty"` + DefaultRouteMetric *int64 `xml:"default-route-metric,omitempty"` + Enable *string `xml:"enable,omitempty"` + NeighborDiscovery *Layer3Ipv6DhcpClientNeighborDiscoveryXml `xml:"neighbor-discovery,omitempty"` + Preference *string `xml:"preference,omitempty"` + PrefixDelegation *Layer3Ipv6DhcpClientPrefixDelegationXml `xml:"prefix-delegation,omitempty"` + V6Options *Layer3Ipv6DhcpClientV6OptionsXml `xml:"v6-options,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryXml struct { + DadAttempts *int64 `xml:"dad-attempts,omitempty"` + DnsServer *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerXml `xml:"dns-server,omitempty"` + DnsSuffix *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixXml `xml:"dns-suffix,omitempty"` + EnableDad *string `xml:"enable-dad,omitempty"` + EnableNdpMonitor *string `xml:"enable-ndp-monitor,omitempty"` + Neighbor []Layer3Ipv6DhcpClientNeighborDiscoveryNeighborXml `xml:"neighbor>entry,omitempty"` + NsInterval *int64 `xml:"ns-interval,omitempty"` + ReachableTime *int64 `xml:"reachable-time,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerXml struct { + Enable *string `xml:"enable,omitempty"` + Source *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceXml `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceXml struct { + Dhcpv6 *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6Xml `xml:"dhcpv6,omitempty"` + Manual *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualXml `xml:"manual,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6Xml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualXml struct { + Server []Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml `xml:"server>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixXml struct { + Enable *string `xml:"enable,omitempty"` + Source *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceXml `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceXml struct { + Dhcpv6 *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6Xml `xml:"dhcpv6,omitempty"` + Manual *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualXml `xml:"manual,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6Xml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualXml struct { + Suffix []Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml `xml:"suffix>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryNeighborXml struct { + HwAddress *string `xml:"hw-address,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientPrefixDelegationXml struct { + Enable *Layer3Ipv6DhcpClientPrefixDelegationEnableXml `xml:"enable,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientPrefixDelegationEnableXml struct { + No *Layer3Ipv6DhcpClientPrefixDelegationEnableNoXml `xml:"no,omitempty"` + Yes *Layer3Ipv6DhcpClientPrefixDelegationEnableYesXml `xml:"yes,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientPrefixDelegationEnableNoXml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientPrefixDelegationEnableYesXml struct { + PfxPoolName *string `xml:"pfx-pool-name,omitempty"` + PrefixLen *int64 `xml:"prefix-len,omitempty"` + PrefixLenHint *string `xml:"prefix-len-hint,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientV6OptionsXml struct { + DuidType *string `xml:"duid-type,omitempty"` + Enable *Layer3Ipv6DhcpClientV6OptionsEnableXml `xml:"enable,omitempty"` + RapidCommit *string `xml:"rapid-commit,omitempty"` + SupportSrvrReconfig *string `xml:"support-srvr-reconfig,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientV6OptionsEnableXml struct { + No *Layer3Ipv6DhcpClientV6OptionsEnableNoXml `xml:"no,omitempty"` + Yes *Layer3Ipv6DhcpClientV6OptionsEnableYesXml `xml:"yes,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientV6OptionsEnableNoXml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientV6OptionsEnableYesXml struct { + NonTempAddr *string `xml:"non-temp-addr,omitempty"` + TempAddr *string `xml:"temp-addr,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedXml struct { + AssignAddr []Layer3Ipv6InheritedAssignAddrXml `xml:"assign-addr>entry,omitempty"` + Enable *string `xml:"enable,omitempty"` + NeighborDiscovery *Layer3Ipv6InheritedNeighborDiscoveryXml `xml:"neighbor-discovery,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Type *Layer3Ipv6InheritedAssignAddrTypeXml `xml:"type,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeXml struct { + Gua *Layer3Ipv6InheritedAssignAddrTypeGuaXml `xml:"gua,omitempty"` + Ula *Layer3Ipv6InheritedAssignAddrTypeUlaXml `xml:"ula,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeGuaXml struct { + Advertise *Layer3Ipv6InheritedAssignAddrTypeGuaAdvertiseXml `xml:"advertise,omitempty"` + EnableOnInterface *string `xml:"enable-on-interface,omitempty"` + PoolType *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeXml `xml:"pool-type,omitempty"` + PrefixPool *string `xml:"prefix-pool,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeGuaAdvertiseXml struct { + AutoConfigFlag *string `xml:"auto-config-flag,omitempty"` + Enable *string `xml:"enable,omitempty"` + OnlinkFlag *string `xml:"onlink-flag,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeXml struct { + Dynamic *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicXml `xml:"dynamic,omitempty"` + DynamicId *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicIdXml `xml:"dynamic-id,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicXml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicIdXml struct { + Identifier *int64 `xml:"identifier,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeUlaXml struct { + Address *string `xml:"address,omitempty"` + Advertise *Layer3Ipv6InheritedAssignAddrTypeUlaAdvertiseXml `xml:"advertise,omitempty"` + Anycast *string `xml:"anycast,omitempty"` + EnableOnInterface *string `xml:"enable-on-interface,omitempty"` + Prefix *string `xml:"prefix,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeUlaAdvertiseXml struct { + AutoConfigFlag *string `xml:"auto-config-flag,omitempty"` + Enable *string `xml:"enable,omitempty"` + OnlinkFlag *string `xml:"onlink-flag,omitempty"` + PreferredLifetime *string `xml:"preferred-lifetime,omitempty"` + ValidLifetime *string `xml:"valid-lifetime,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryXml struct { + DadAttempts *int64 `xml:"dad-attempts,omitempty"` + DnsServer *Layer3Ipv6InheritedNeighborDiscoveryDnsServerXml `xml:"dns-server,omitempty"` + DnsSuffix *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixXml `xml:"dns-suffix,omitempty"` + EnableDad *string `xml:"enable-dad,omitempty"` + EnableNdpMonitor *string `xml:"enable-ndp-monitor,omitempty"` + Neighbor []Layer3Ipv6InheritedNeighborDiscoveryNeighborXml `xml:"neighbor>entry,omitempty"` + NsInterval *int64 `xml:"ns-interval,omitempty"` + ReachableTime *int64 `xml:"reachable-time,omitempty"` + RouterAdvertisement *Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisementXml `xml:"router-advertisement,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerXml struct { + Enable *string `xml:"enable,omitempty"` + Source *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceXml `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceXml struct { + Dhcpv6 *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6Xml `xml:"dhcpv6,omitempty"` + Manual *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualXml `xml:"manual,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6Xml struct { + PrefixPool *string `xml:"prefix-pool,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualXml struct { + Server []Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml `xml:"server>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixXml struct { + Enable *string `xml:"enable,omitempty"` + Source *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceXml `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceXml struct { + Dhcpv6 *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6Xml `xml:"dhcpv6,omitempty"` + Manual *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualXml `xml:"manual,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6Xml struct { + PrefixPool *string `xml:"prefix-pool,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualXml struct { + Suffix []Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml `xml:"suffix>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryNeighborXml struct { + HwAddress *string `xml:"hw-address,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisementXml struct { + Enable *string `xml:"enable,omitempty"` + EnableConsistencyCheck *string `xml:"enable-consistency-check,omitempty"` + HopLimit *string `xml:"hop-limit,omitempty"` + Lifetime *int64 `xml:"lifetime,omitempty"` + LinkMtu *string `xml:"link-mtu,omitempty"` + ManagedFlag *string `xml:"managed-flag,omitempty"` + MaxInterval *int64 `xml:"max-interval,omitempty"` + MinInterval *int64 `xml:"min-interval,omitempty"` + OtherFlag *string `xml:"other-flag,omitempty"` + ReachableTime *string `xml:"reachable-time,omitempty"` + RetransmissionTimer *string `xml:"retransmission-timer,omitempty"` + RouterPreference *string `xml:"router-preference,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryXml struct { + DadAttempts *int64 `xml:"dad-attempts,omitempty"` + EnableDad *string `xml:"enable-dad,omitempty"` + EnableNdpMonitor *string `xml:"enable-ndp-monitor,omitempty"` + Neighbor []Layer3Ipv6NeighborDiscoveryNeighborXml `xml:"neighbor>entry,omitempty"` + NsInterval *int64 `xml:"ns-interval,omitempty"` + ReachableTime *int64 `xml:"reachable-time,omitempty"` + RouterAdvertisement *Layer3Ipv6NeighborDiscoveryRouterAdvertisementXml `xml:"router-advertisement,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryNeighborXml struct { + HwAddress *string `xml:"hw-address,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementXml struct { + DnsSupport *Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportXml `xml:"dns-support,omitempty"` + Enable *string `xml:"enable,omitempty"` + EnableConsistencyCheck *string `xml:"enable-consistency-check,omitempty"` + HopLimit *string `xml:"hop-limit,omitempty"` + Lifetime *int64 `xml:"lifetime,omitempty"` + LinkMtu *string `xml:"link-mtu,omitempty"` + ManagedFlag *string `xml:"managed-flag,omitempty"` + MaxInterval *int64 `xml:"max-interval,omitempty"` + MinInterval *int64 `xml:"min-interval,omitempty"` + OtherFlag *string `xml:"other-flag,omitempty"` + ReachableTime *string `xml:"reachable-time,omitempty"` + RetransmissionTimer *string `xml:"retransmission-timer,omitempty"` + RouterPreference *string `xml:"router-preference,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportXml struct { + Enable *string `xml:"enable,omitempty"` + Server []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml `xml:"server>entry,omitempty"` + Suffix []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml `xml:"suffix>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3LacpXml struct { + Enable *string `xml:"enable,omitempty"` + FastFailover *string `xml:"fast-failover,omitempty"` + HighAvailability *Layer3LacpHighAvailabilityXml `xml:"high-availability,omitempty"` + MaxPorts *int64 `xml:"max-ports,omitempty"` + Mode *string `xml:"mode,omitempty"` + SystemPriority *int64 `xml:"system-priority,omitempty"` + TransmissionRate *string `xml:"transmission-rate,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3LacpHighAvailabilityXml struct { + PassivePreNegotiation *string `xml:"passive-pre-negotiation,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3LldpXml struct { + Enable *string `xml:"enable,omitempty"` + HighAvailability *Layer3LldpHighAvailabilityXml `xml:"high-availability,omitempty"` + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3LldpHighAvailabilityXml struct { + PassivePreNegotiation *string `xml:"passive-pre-negotiation,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3NdpProxyXml struct { + Address []Layer3NdpProxyAddressXml `xml:"address>entry,omitempty"` + Enabled *string `xml:"enabled,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3NdpProxyAddressXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Negate *string `xml:"negate,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3SdwanLinkSettingsXml struct { + Enable *string `xml:"enable,omitempty"` + SdwanInterfaceProfile *string `xml:"sdwan-interface-profile,omitempty"` + UpstreamNat *Layer3SdwanLinkSettingsUpstreamNatXml `xml:"upstream-nat,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3SdwanLinkSettingsUpstreamNatXml struct { + Enable *string `xml:"enable,omitempty"` + Ddns *Layer3SdwanLinkSettingsUpstreamNatDdnsXml `xml:"ddns,omitempty"` + StaticIp *Layer3SdwanLinkSettingsUpstreamNatStaticIpXml `xml:"static-ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3SdwanLinkSettingsUpstreamNatDdnsXml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3SdwanLinkSettingsUpstreamNatStaticIpXml struct { + Fqdn *string `xml:"fqdn,omitempty"` + IpAddress *string `xml:"ip-address,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type VirtualWireXml struct { + Lldp *VirtualWireLldpXml `xml:"lldp,omitempty"` + NetflowProfile *string `xml:"netflow-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type VirtualWireLldpXml struct { + Enable *string `xml:"enable,omitempty"` + HighAvailability *VirtualWireLldpHighAvailabilityXml `xml:"high-availability,omitempty"` + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type VirtualWireLldpHighAvailabilityXml struct { + PassivePreNegotiation *string `xml:"passive-pre-negotiation,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "comment" || v == "Comment" { + return e.Comment, nil + } + if v == "decrypt_mirror" || v == "DecryptMirror" { + return e.DecryptMirror, nil + } + if v == "ha" || v == "Ha" { + return e.Ha, nil + } + if v == "layer2" || v == "Layer2" { + return e.Layer2, nil + } + if v == "layer3" || v == "Layer3" { + return e.Layer3, nil + } + if v == "virtual_wire" || v == "VirtualWire" { + return e.VirtualWire, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.Comment = o.Comment + var nestedDecryptMirror *DecryptMirrorXml + if o.DecryptMirror != nil { + nestedDecryptMirror = &DecryptMirrorXml{} + if _, ok := o.Misc["DecryptMirror"]; ok { + nestedDecryptMirror.Misc = o.Misc["DecryptMirror"] + } + } + entry.DecryptMirror = nestedDecryptMirror + + var nestedHa *HaXml + if o.Ha != nil { + nestedHa = &HaXml{} + if _, ok := o.Misc["Ha"]; ok { + nestedHa.Misc = o.Misc["Ha"] + } + if o.Ha.Lacp != nil { + nestedHa.Lacp = &HaLacpXml{} + if _, ok := o.Misc["HaLacp"]; ok { + nestedHa.Lacp.Misc = o.Misc["HaLacp"] + } + if o.Ha.Lacp.Enable != nil { + nestedHa.Lacp.Enable = util.YesNo(o.Ha.Lacp.Enable, nil) + } + if o.Ha.Lacp.FastFailover != nil { + nestedHa.Lacp.FastFailover = util.YesNo(o.Ha.Lacp.FastFailover, nil) + } + if o.Ha.Lacp.MaxPorts != nil { + nestedHa.Lacp.MaxPorts = o.Ha.Lacp.MaxPorts + } + if o.Ha.Lacp.Mode != nil { + nestedHa.Lacp.Mode = o.Ha.Lacp.Mode + } + if o.Ha.Lacp.SystemPriority != nil { + nestedHa.Lacp.SystemPriority = o.Ha.Lacp.SystemPriority + } + if o.Ha.Lacp.TransmissionRate != nil { + nestedHa.Lacp.TransmissionRate = o.Ha.Lacp.TransmissionRate + } + } + } + entry.Ha = nestedHa + + var nestedLayer2 *Layer2Xml + if o.Layer2 != nil { + nestedLayer2 = &Layer2Xml{} + if _, ok := o.Misc["Layer2"]; ok { + nestedLayer2.Misc = o.Misc["Layer2"] + } + if o.Layer2.Lacp != nil { + nestedLayer2.Lacp = &Layer2LacpXml{} + if _, ok := o.Misc["Layer2Lacp"]; ok { + nestedLayer2.Lacp.Misc = o.Misc["Layer2Lacp"] + } + if o.Layer2.Lacp.HighAvailability != nil { + nestedLayer2.Lacp.HighAvailability = &Layer2LacpHighAvailabilityXml{} + if _, ok := o.Misc["Layer2LacpHighAvailability"]; ok { + nestedLayer2.Lacp.HighAvailability.Misc = o.Misc["Layer2LacpHighAvailability"] + } + if o.Layer2.Lacp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer2.Lacp.HighAvailability.PassivePreNegotiation = util.YesNo(o.Layer2.Lacp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.Layer2.Lacp.MaxPorts != nil { + nestedLayer2.Lacp.MaxPorts = o.Layer2.Lacp.MaxPorts + } + if o.Layer2.Lacp.Mode != nil { + nestedLayer2.Lacp.Mode = o.Layer2.Lacp.Mode + } + if o.Layer2.Lacp.SystemPriority != nil { + nestedLayer2.Lacp.SystemPriority = o.Layer2.Lacp.SystemPriority + } + if o.Layer2.Lacp.TransmissionRate != nil { + nestedLayer2.Lacp.TransmissionRate = o.Layer2.Lacp.TransmissionRate + } + if o.Layer2.Lacp.Enable != nil { + nestedLayer2.Lacp.Enable = util.YesNo(o.Layer2.Lacp.Enable, nil) + } + if o.Layer2.Lacp.FastFailover != nil { + nestedLayer2.Lacp.FastFailover = util.YesNo(o.Layer2.Lacp.FastFailover, nil) + } + } + if o.Layer2.Lldp != nil { + nestedLayer2.Lldp = &Layer2LldpXml{} + if _, ok := o.Misc["Layer2Lldp"]; ok { + nestedLayer2.Lldp.Misc = o.Misc["Layer2Lldp"] + } + if o.Layer2.Lldp.Enable != nil { + nestedLayer2.Lldp.Enable = util.YesNo(o.Layer2.Lldp.Enable, nil) + } + if o.Layer2.Lldp.HighAvailability != nil { + nestedLayer2.Lldp.HighAvailability = &Layer2LldpHighAvailabilityXml{} + if _, ok := o.Misc["Layer2LldpHighAvailability"]; ok { + nestedLayer2.Lldp.HighAvailability.Misc = o.Misc["Layer2LldpHighAvailability"] + } + if o.Layer2.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer2.Lldp.HighAvailability.PassivePreNegotiation = util.YesNo(o.Layer2.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.Layer2.Lldp.Profile != nil { + nestedLayer2.Lldp.Profile = o.Layer2.Lldp.Profile + } + } + if o.Layer2.NetflowProfile != nil { + nestedLayer2.NetflowProfile = o.Layer2.NetflowProfile + } + } + entry.Layer2 = nestedLayer2 + + var nestedLayer3 *Layer3Xml + if o.Layer3 != nil { + nestedLayer3 = &Layer3Xml{} + if _, ok := o.Misc["Layer3"]; ok { + nestedLayer3.Misc = o.Misc["Layer3"] + } + if o.Layer3.DhcpClient != nil { + nestedLayer3.DhcpClient = &Layer3DhcpClientXml{} + if _, ok := o.Misc["Layer3DhcpClient"]; ok { + nestedLayer3.DhcpClient.Misc = o.Misc["Layer3DhcpClient"] + } + if o.Layer3.DhcpClient.DefaultRouteMetric != nil { + nestedLayer3.DhcpClient.DefaultRouteMetric = o.Layer3.DhcpClient.DefaultRouteMetric + } + if o.Layer3.DhcpClient.Enable != nil { + nestedLayer3.DhcpClient.Enable = util.YesNo(o.Layer3.DhcpClient.Enable, nil) + } + if o.Layer3.DhcpClient.SendHostname != nil { + nestedLayer3.DhcpClient.SendHostname = &Layer3DhcpClientSendHostnameXml{} + if _, ok := o.Misc["Layer3DhcpClientSendHostname"]; ok { + nestedLayer3.DhcpClient.SendHostname.Misc = o.Misc["Layer3DhcpClientSendHostname"] + } + if o.Layer3.DhcpClient.SendHostname.Enable != nil { + nestedLayer3.DhcpClient.SendHostname.Enable = util.YesNo(o.Layer3.DhcpClient.SendHostname.Enable, nil) + } + if o.Layer3.DhcpClient.SendHostname.Hostname != nil { + nestedLayer3.DhcpClient.SendHostname.Hostname = o.Layer3.DhcpClient.SendHostname.Hostname + } + } + if o.Layer3.DhcpClient.CreateDefaultRoute != nil { + nestedLayer3.DhcpClient.CreateDefaultRoute = util.YesNo(o.Layer3.DhcpClient.CreateDefaultRoute, nil) + } + } + if o.Layer3.InterfaceManagementProfile != nil { + nestedLayer3.InterfaceManagementProfile = o.Layer3.InterfaceManagementProfile + } + if o.Layer3.SdwanLinkSettings != nil { + nestedLayer3.SdwanLinkSettings = &Layer3SdwanLinkSettingsXml{} + if _, ok := o.Misc["Layer3SdwanLinkSettings"]; ok { + nestedLayer3.SdwanLinkSettings.Misc = o.Misc["Layer3SdwanLinkSettings"] + } + if o.Layer3.SdwanLinkSettings.Enable != nil { + nestedLayer3.SdwanLinkSettings.Enable = util.YesNo(o.Layer3.SdwanLinkSettings.Enable, nil) + } + if o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile != nil { + nestedLayer3.SdwanLinkSettings.SdwanInterfaceProfile = o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile + } + if o.Layer3.SdwanLinkSettings.UpstreamNat != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat = &Layer3SdwanLinkSettingsUpstreamNatXml{} + if _, ok := o.Misc["Layer3SdwanLinkSettingsUpstreamNat"]; ok { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Misc = o.Misc["Layer3SdwanLinkSettingsUpstreamNat"] + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.Enable != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Enable = util.YesNo(o.Layer3.SdwanLinkSettings.UpstreamNat.Enable, nil) + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.Ddns != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Ddns = &Layer3SdwanLinkSettingsUpstreamNatDdnsXml{} + if _, ok := o.Misc["Layer3SdwanLinkSettingsUpstreamNatDdns"]; ok { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Ddns.Misc = o.Misc["Layer3SdwanLinkSettingsUpstreamNatDdns"] + } + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp = &Layer3SdwanLinkSettingsUpstreamNatStaticIpXml{} + if _, ok := o.Misc["Layer3SdwanLinkSettingsUpstreamNatStaticIp"]; ok { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp.Misc = o.Misc["Layer3SdwanLinkSettingsUpstreamNatStaticIp"] + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress + } + } + } + } + if o.Layer3.UntaggedSubInterface != nil { + nestedLayer3.UntaggedSubInterface = util.YesNo(o.Layer3.UntaggedSubInterface, nil) + } + if o.Layer3.DfIgnore != nil { + nestedLayer3.DfIgnore = util.YesNo(o.Layer3.DfIgnore, nil) + } + if o.Layer3.Ip != nil { + nestedLayer3.Ip = []Layer3IpXml{} + for _, oLayer3Ip := range o.Layer3.Ip { + nestedLayer3Ip := Layer3IpXml{} + if _, ok := o.Misc["Layer3Ip"]; ok { + nestedLayer3Ip.Misc = o.Misc["Layer3Ip"] + } + if oLayer3Ip.Name != "" { + nestedLayer3Ip.Name = oLayer3Ip.Name + } + if oLayer3Ip.SdwanGateway != nil { + nestedLayer3Ip.SdwanGateway = oLayer3Ip.SdwanGateway + } + nestedLayer3.Ip = append(nestedLayer3.Ip, nestedLayer3Ip) + } + } + if o.Layer3.Lacp != nil { + nestedLayer3.Lacp = &Layer3LacpXml{} + if _, ok := o.Misc["Layer3Lacp"]; ok { + nestedLayer3.Lacp.Misc = o.Misc["Layer3Lacp"] + } + if o.Layer3.Lacp.TransmissionRate != nil { + nestedLayer3.Lacp.TransmissionRate = o.Layer3.Lacp.TransmissionRate + } + if o.Layer3.Lacp.Enable != nil { + nestedLayer3.Lacp.Enable = util.YesNo(o.Layer3.Lacp.Enable, nil) + } + if o.Layer3.Lacp.FastFailover != nil { + nestedLayer3.Lacp.FastFailover = util.YesNo(o.Layer3.Lacp.FastFailover, nil) + } + if o.Layer3.Lacp.HighAvailability != nil { + nestedLayer3.Lacp.HighAvailability = &Layer3LacpHighAvailabilityXml{} + if _, ok := o.Misc["Layer3LacpHighAvailability"]; ok { + nestedLayer3.Lacp.HighAvailability.Misc = o.Misc["Layer3LacpHighAvailability"] + } + if o.Layer3.Lacp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer3.Lacp.HighAvailability.PassivePreNegotiation = util.YesNo(o.Layer3.Lacp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.Layer3.Lacp.MaxPorts != nil { + nestedLayer3.Lacp.MaxPorts = o.Layer3.Lacp.MaxPorts + } + if o.Layer3.Lacp.Mode != nil { + nestedLayer3.Lacp.Mode = o.Layer3.Lacp.Mode + } + if o.Layer3.Lacp.SystemPriority != nil { + nestedLayer3.Lacp.SystemPriority = o.Layer3.Lacp.SystemPriority + } + } + if o.Layer3.AdjustTcpMss != nil { + nestedLayer3.AdjustTcpMss = &Layer3AdjustTcpMssXml{} + if _, ok := o.Misc["Layer3AdjustTcpMss"]; ok { + nestedLayer3.AdjustTcpMss.Misc = o.Misc["Layer3AdjustTcpMss"] + } + if o.Layer3.AdjustTcpMss.Ipv6MssAdjustment != nil { + nestedLayer3.AdjustTcpMss.Ipv6MssAdjustment = o.Layer3.AdjustTcpMss.Ipv6MssAdjustment + } + if o.Layer3.AdjustTcpMss.Enable != nil { + nestedLayer3.AdjustTcpMss.Enable = util.YesNo(o.Layer3.AdjustTcpMss.Enable, nil) + } + if o.Layer3.AdjustTcpMss.Ipv4MssAdjustment != nil { + nestedLayer3.AdjustTcpMss.Ipv4MssAdjustment = o.Layer3.AdjustTcpMss.Ipv4MssAdjustment + } + } + if o.Layer3.Bonjour != nil { + nestedLayer3.Bonjour = &Layer3BonjourXml{} + if _, ok := o.Misc["Layer3Bonjour"]; ok { + nestedLayer3.Bonjour.Misc = o.Misc["Layer3Bonjour"] + } + if o.Layer3.Bonjour.Enable != nil { + nestedLayer3.Bonjour.Enable = util.YesNo(o.Layer3.Bonjour.Enable, nil) + } + if o.Layer3.Bonjour.GroupId != nil { + nestedLayer3.Bonjour.GroupId = o.Layer3.Bonjour.GroupId + } + if o.Layer3.Bonjour.TtlCheck != nil { + nestedLayer3.Bonjour.TtlCheck = util.YesNo(o.Layer3.Bonjour.TtlCheck, nil) + } + } + if o.Layer3.DdnsConfig != nil { + nestedLayer3.DdnsConfig = &Layer3DdnsConfigXml{} + if _, ok := o.Misc["Layer3DdnsConfig"]; ok { + nestedLayer3.DdnsConfig.Misc = o.Misc["Layer3DdnsConfig"] + } + if o.Layer3.DdnsConfig.DdnsIpv6 != nil { + nestedLayer3.DdnsConfig.DdnsIpv6 = util.StrToMem(o.Layer3.DdnsConfig.DdnsIpv6) + } + if o.Layer3.DdnsConfig.DdnsUpdateInterval != nil { + nestedLayer3.DdnsConfig.DdnsUpdateInterval = o.Layer3.DdnsConfig.DdnsUpdateInterval + } + if o.Layer3.DdnsConfig.DdnsVendor != nil { + nestedLayer3.DdnsConfig.DdnsVendor = o.Layer3.DdnsConfig.DdnsVendor + } + if o.Layer3.DdnsConfig.DdnsVendorConfig != nil { + nestedLayer3.DdnsConfig.DdnsVendorConfig = []Layer3DdnsConfigDdnsVendorConfigXml{} + for _, oLayer3DdnsConfigDdnsVendorConfig := range o.Layer3.DdnsConfig.DdnsVendorConfig { + nestedLayer3DdnsConfigDdnsVendorConfig := Layer3DdnsConfigDdnsVendorConfigXml{} + if _, ok := o.Misc["Layer3DdnsConfigDdnsVendorConfig"]; ok { + nestedLayer3DdnsConfigDdnsVendorConfig.Misc = o.Misc["Layer3DdnsConfigDdnsVendorConfig"] + } + if oLayer3DdnsConfigDdnsVendorConfig.Value != nil { + nestedLayer3DdnsConfigDdnsVendorConfig.Value = oLayer3DdnsConfigDdnsVendorConfig.Value + } + if oLayer3DdnsConfigDdnsVendorConfig.Name != "" { + nestedLayer3DdnsConfigDdnsVendorConfig.Name = oLayer3DdnsConfigDdnsVendorConfig.Name + } + nestedLayer3.DdnsConfig.DdnsVendorConfig = append(nestedLayer3.DdnsConfig.DdnsVendorConfig, nestedLayer3DdnsConfigDdnsVendorConfig) + } + } + if o.Layer3.DdnsConfig.DdnsCertProfile != nil { + nestedLayer3.DdnsConfig.DdnsCertProfile = o.Layer3.DdnsConfig.DdnsCertProfile + } + if o.Layer3.DdnsConfig.DdnsEnabled != nil { + nestedLayer3.DdnsConfig.DdnsEnabled = util.YesNo(o.Layer3.DdnsConfig.DdnsEnabled, nil) + } + if o.Layer3.DdnsConfig.DdnsHostname != nil { + nestedLayer3.DdnsConfig.DdnsHostname = o.Layer3.DdnsConfig.DdnsHostname + } + if o.Layer3.DdnsConfig.DdnsIp != nil { + nestedLayer3.DdnsConfig.DdnsIp = util.StrToMem(o.Layer3.DdnsConfig.DdnsIp) + } + } + if o.Layer3.Ipv6 != nil { + nestedLayer3.Ipv6 = &Layer3Ipv6Xml{} + if _, ok := o.Misc["Layer3Ipv6"]; ok { + nestedLayer3.Ipv6.Misc = o.Misc["Layer3Ipv6"] + } + if o.Layer3.Ipv6.Address != nil { + nestedLayer3.Ipv6.Address = []Layer3Ipv6AddressXml{} + for _, oLayer3Ipv6Address := range o.Layer3.Ipv6.Address { + nestedLayer3Ipv6Address := Layer3Ipv6AddressXml{} + if _, ok := o.Misc["Layer3Ipv6Address"]; ok { + nestedLayer3Ipv6Address.Misc = o.Misc["Layer3Ipv6Address"] + } + if oLayer3Ipv6Address.Anycast != nil { + nestedLayer3Ipv6Address.Anycast = &Layer3Ipv6AddressAnycastXml{} + if _, ok := o.Misc["Layer3Ipv6AddressAnycast"]; ok { + nestedLayer3Ipv6Address.Anycast.Misc = o.Misc["Layer3Ipv6AddressAnycast"] + } + } + if oLayer3Ipv6Address.Advertise != nil { + nestedLayer3Ipv6Address.Advertise = &Layer3Ipv6AddressAdvertiseXml{} + if _, ok := o.Misc["Layer3Ipv6AddressAdvertise"]; ok { + nestedLayer3Ipv6Address.Advertise.Misc = o.Misc["Layer3Ipv6AddressAdvertise"] + } + if oLayer3Ipv6Address.Advertise.ValidLifetime != nil { + nestedLayer3Ipv6Address.Advertise.ValidLifetime = oLayer3Ipv6Address.Advertise.ValidLifetime + } + if oLayer3Ipv6Address.Advertise.PreferredLifetime != nil { + nestedLayer3Ipv6Address.Advertise.PreferredLifetime = oLayer3Ipv6Address.Advertise.PreferredLifetime + } + if oLayer3Ipv6Address.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6Address.Advertise.OnlinkFlag = util.YesNo(oLayer3Ipv6Address.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6Address.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6Address.Advertise.AutoConfigFlag = util.YesNo(oLayer3Ipv6Address.Advertise.AutoConfigFlag, nil) + } + if oLayer3Ipv6Address.Advertise.Enable != nil { + nestedLayer3Ipv6Address.Advertise.Enable = util.YesNo(oLayer3Ipv6Address.Advertise.Enable, nil) + } + } + if oLayer3Ipv6Address.Name != "" { + nestedLayer3Ipv6Address.Name = oLayer3Ipv6Address.Name + } + if oLayer3Ipv6Address.EnableOnInterface != nil { + nestedLayer3Ipv6Address.EnableOnInterface = util.YesNo(oLayer3Ipv6Address.EnableOnInterface, nil) + } + if oLayer3Ipv6Address.Prefix != nil { + nestedLayer3Ipv6Address.Prefix = &Layer3Ipv6AddressPrefixXml{} + if _, ok := o.Misc["Layer3Ipv6AddressPrefix"]; ok { + nestedLayer3Ipv6Address.Prefix.Misc = o.Misc["Layer3Ipv6AddressPrefix"] + } + } + nestedLayer3.Ipv6.Address = append(nestedLayer3.Ipv6.Address, nestedLayer3Ipv6Address) + } + } + if o.Layer3.Ipv6.Enabled != nil { + nestedLayer3.Ipv6.Enabled = util.YesNo(o.Layer3.Ipv6.Enabled, nil) + } + if o.Layer3.Ipv6.InterfaceId != nil { + nestedLayer3.Ipv6.InterfaceId = o.Layer3.Ipv6.InterfaceId + } + if o.Layer3.Ipv6.NeighborDiscovery != nil { + nestedLayer3.Ipv6.NeighborDiscovery = &Layer3Ipv6NeighborDiscoveryXml{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscovery"]; ok { + nestedLayer3.Ipv6.NeighborDiscovery.Misc = o.Misc["Layer3Ipv6NeighborDiscovery"] + } + if o.Layer3.Ipv6.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.ReachableTime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement = &Layer3Ipv6NeighborDiscoveryRouterAdvertisementXml{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisement"]; ok { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisement"] + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport = &Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportXml{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport"]; ok { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport"] + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml{} + for _, oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := range o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer"]; ok { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer"] + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime != nil { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = append(nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server, nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer) + } + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml{} + for _, oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := range o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix"]; ok { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix"] + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime != nil { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = append(nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix, nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix) + } + } + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval + } + } + if o.Layer3.Ipv6.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.NeighborDiscovery.EnableDad = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.NeighborDiscovery.EnableNdpMonitor = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = []Layer3Ipv6NeighborDiscoveryNeighborXml{} + for _, oLayer3Ipv6NeighborDiscoveryNeighbor := range o.Layer3.Ipv6.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6NeighborDiscoveryNeighbor := Layer3Ipv6NeighborDiscoveryNeighborXml{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryNeighbor"]; ok { + nestedLayer3Ipv6NeighborDiscoveryNeighbor.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryNeighbor"] + } + if oLayer3Ipv6NeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryNeighbor.Name = oLayer3Ipv6NeighborDiscoveryNeighbor.Name + } + if oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress + } + nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.NeighborDiscovery.Neighbor, nestedLayer3Ipv6NeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.NeighborDiscovery.NsInterval + } + } + if o.Layer3.Ipv6.DhcpClient != nil { + nestedLayer3.Ipv6.DhcpClient = &Layer3Ipv6DhcpClientXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClient"]; ok { + nestedLayer3.Ipv6.DhcpClient.Misc = o.Misc["Layer3Ipv6DhcpClient"] + } + if o.Layer3.Ipv6.DhcpClient.DefaultRouteMetric != nil { + nestedLayer3.Ipv6.DhcpClient.DefaultRouteMetric = o.Layer3.Ipv6.DhcpClient.DefaultRouteMetric + } + if o.Layer3.Ipv6.DhcpClient.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.Enable = util.YesNo(o.Layer3.Ipv6.DhcpClient.Enable, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery = &Layer3Ipv6DhcpClientNeighborDiscoveryXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscovery"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscovery"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable = util.YesNo(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6Xml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6"] + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = []Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer"]; ok { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer"] + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable = util.YesNo(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6Xml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6"] + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix"]; ok { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix"] + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad = util.YesNo(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor = util.YesNo(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor = []Layer3Ipv6DhcpClientNeighborDiscoveryNeighborXml{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor := Layer3Ipv6DhcpClientNeighborDiscoveryNeighborXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor"]; ok { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor"] + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor, nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval + } + } + if o.Layer3.Ipv6.DhcpClient.Preference != nil { + nestedLayer3.Ipv6.DhcpClient.Preference = o.Layer3.Ipv6.DhcpClient.Preference + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation = &Layer3Ipv6DhcpClientPrefixDelegationXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientPrefixDelegation"]; ok { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Misc = o.Misc["Layer3Ipv6DhcpClientPrefixDelegation"] + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable = &Layer3Ipv6DhcpClientPrefixDelegationEnableXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnable"]; ok { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Misc = o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnable"] + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No = &Layer3Ipv6DhcpClientPrefixDelegationEnableNoXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableNo"]; ok { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No.Misc = o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableNo"] + } + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes = &Layer3Ipv6DhcpClientPrefixDelegationEnableYesXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableYes"]; ok { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.Misc = o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableYes"] + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint = util.YesNo(o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint, nil) + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options = &Layer3Ipv6DhcpClientV6OptionsXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientV6Options"]; ok { + nestedLayer3.Ipv6.DhcpClient.V6Options.Misc = o.Misc["Layer3Ipv6DhcpClientV6Options"] + } + if o.Layer3.Ipv6.DhcpClient.V6Options.DuidType != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.DuidType = o.Layer3.Ipv6.DhcpClient.V6Options.DuidType + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable = &Layer3Ipv6DhcpClientV6OptionsEnableXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientV6OptionsEnable"]; ok { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Misc = o.Misc["Layer3Ipv6DhcpClientV6OptionsEnable"] + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.No != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.No = &Layer3Ipv6DhcpClientV6OptionsEnableNoXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientV6OptionsEnableNo"]; ok { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.No.Misc = o.Misc["Layer3Ipv6DhcpClientV6OptionsEnableNo"] + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes = &Layer3Ipv6DhcpClientV6OptionsEnableYesXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientV6OptionsEnableYes"]; ok { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes.Misc = o.Misc["Layer3Ipv6DhcpClientV6OptionsEnableYes"] + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr = util.YesNo(o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr, nil) + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr = util.YesNo(o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr, nil) + } + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options.RapidCommit != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.RapidCommit = util.YesNo(o.Layer3.Ipv6.DhcpClient.V6Options.RapidCommit, nil) + } + if o.Layer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig = util.YesNo(o.Layer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig, nil) + } + } + if o.Layer3.Ipv6.DhcpClient.AcceptRaRoute != nil { + nestedLayer3.Ipv6.DhcpClient.AcceptRaRoute = util.YesNo(o.Layer3.Ipv6.DhcpClient.AcceptRaRoute, nil) + } + } + if o.Layer3.Ipv6.Inherited != nil { + nestedLayer3.Ipv6.Inherited = &Layer3Ipv6InheritedXml{} + if _, ok := o.Misc["Layer3Ipv6Inherited"]; ok { + nestedLayer3.Ipv6.Inherited.Misc = o.Misc["Layer3Ipv6Inherited"] + } + if o.Layer3.Ipv6.Inherited.AssignAddr != nil { + nestedLayer3.Ipv6.Inherited.AssignAddr = []Layer3Ipv6InheritedAssignAddrXml{} + for _, oLayer3Ipv6InheritedAssignAddr := range o.Layer3.Ipv6.Inherited.AssignAddr { + nestedLayer3Ipv6InheritedAssignAddr := Layer3Ipv6InheritedAssignAddrXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddr"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Misc = o.Misc["Layer3Ipv6InheritedAssignAddr"] + } + if oLayer3Ipv6InheritedAssignAddr.Type != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type = &Layer3Ipv6InheritedAssignAddrTypeXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrType"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrType"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula = &Layer3Ipv6InheritedAssignAddrTypeUlaXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeUla"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeUla"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise = &Layer3Ipv6InheritedAssignAddrTypeUlaAdvertiseXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag, nil) + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Address != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Address = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Address + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix, nil) + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua = &Layer3Ipv6InheritedAssignAddrTypeGuaXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeGua"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeGua"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolType"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolType"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic"] + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicIdXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier + } + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise = &Layer3Ipv6InheritedAssignAddrTypeGuaAdvertiseXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag, nil) + } + } + } + } + if oLayer3Ipv6InheritedAssignAddr.Name != "" { + nestedLayer3Ipv6InheritedAssignAddr.Name = oLayer3Ipv6InheritedAssignAddr.Name + } + nestedLayer3.Ipv6.Inherited.AssignAddr = append(nestedLayer3.Ipv6.Inherited.AssignAddr, nestedLayer3Ipv6InheritedAssignAddr) + } + } + if o.Layer3.Ipv6.Inherited.Enable != nil { + nestedLayer3.Ipv6.Inherited.Enable = util.YesNo(o.Layer3.Ipv6.Inherited.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery = &Layer3Ipv6InheritedNeighborDiscoveryXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscovery"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscovery"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServer"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServer"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6Xml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = []Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer := Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer"]; ok { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer"] + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name = oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6Xml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix"]; ok { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix"] + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor = []Layer3Ipv6InheritedNeighborDiscoveryNeighborXml{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryNeighbor := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor := Layer3Ipv6InheritedNeighborDiscoveryNeighborXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryNeighbor"]; ok { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryNeighbor"] + } + if oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress + } + if oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name = oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor, nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.NsInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement = &Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisementXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.EnableDad = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime + } + } + } + } + if o.Layer3.Lldp != nil { + nestedLayer3.Lldp = &Layer3LldpXml{} + if _, ok := o.Misc["Layer3Lldp"]; ok { + nestedLayer3.Lldp.Misc = o.Misc["Layer3Lldp"] + } + if o.Layer3.Lldp.Enable != nil { + nestedLayer3.Lldp.Enable = util.YesNo(o.Layer3.Lldp.Enable, nil) + } + if o.Layer3.Lldp.HighAvailability != nil { + nestedLayer3.Lldp.HighAvailability = &Layer3LldpHighAvailabilityXml{} + if _, ok := o.Misc["Layer3LldpHighAvailability"]; ok { + nestedLayer3.Lldp.HighAvailability.Misc = o.Misc["Layer3LldpHighAvailability"] + } + if o.Layer3.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer3.Lldp.HighAvailability.PassivePreNegotiation = util.YesNo(o.Layer3.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.Layer3.Lldp.Profile != nil { + nestedLayer3.Lldp.Profile = o.Layer3.Lldp.Profile + } + } + if o.Layer3.NdpProxy != nil { + nestedLayer3.NdpProxy = &Layer3NdpProxyXml{} + if _, ok := o.Misc["Layer3NdpProxy"]; ok { + nestedLayer3.NdpProxy.Misc = o.Misc["Layer3NdpProxy"] + } + if o.Layer3.NdpProxy.Enabled != nil { + nestedLayer3.NdpProxy.Enabled = util.YesNo(o.Layer3.NdpProxy.Enabled, nil) + } + if o.Layer3.NdpProxy.Address != nil { + nestedLayer3.NdpProxy.Address = []Layer3NdpProxyAddressXml{} + for _, oLayer3NdpProxyAddress := range o.Layer3.NdpProxy.Address { + nestedLayer3NdpProxyAddress := Layer3NdpProxyAddressXml{} + if _, ok := o.Misc["Layer3NdpProxyAddress"]; ok { + nestedLayer3NdpProxyAddress.Misc = o.Misc["Layer3NdpProxyAddress"] + } + if oLayer3NdpProxyAddress.Name != "" { + nestedLayer3NdpProxyAddress.Name = oLayer3NdpProxyAddress.Name + } + if oLayer3NdpProxyAddress.Negate != nil { + nestedLayer3NdpProxyAddress.Negate = util.YesNo(oLayer3NdpProxyAddress.Negate, nil) + } + nestedLayer3.NdpProxy.Address = append(nestedLayer3.NdpProxy.Address, nestedLayer3NdpProxyAddress) + } + } + } + if o.Layer3.Arp != nil { + nestedLayer3.Arp = []Layer3ArpXml{} + for _, oLayer3Arp := range o.Layer3.Arp { + nestedLayer3Arp := Layer3ArpXml{} + if _, ok := o.Misc["Layer3Arp"]; ok { + nestedLayer3Arp.Misc = o.Misc["Layer3Arp"] + } + if oLayer3Arp.HwAddress != nil { + nestedLayer3Arp.HwAddress = oLayer3Arp.HwAddress + } + if oLayer3Arp.Name != "" { + nestedLayer3Arp.Name = oLayer3Arp.Name + } + nestedLayer3.Arp = append(nestedLayer3.Arp, nestedLayer3Arp) + } + } + if o.Layer3.DecryptForward != nil { + nestedLayer3.DecryptForward = util.YesNo(o.Layer3.DecryptForward, nil) + } + if o.Layer3.Mtu != nil { + nestedLayer3.Mtu = o.Layer3.Mtu + } + if o.Layer3.NetflowProfile != nil { + nestedLayer3.NetflowProfile = o.Layer3.NetflowProfile + } + } + entry.Layer3 = nestedLayer3 + + var nestedVirtualWire *VirtualWireXml + if o.VirtualWire != nil { + nestedVirtualWire = &VirtualWireXml{} + if _, ok := o.Misc["VirtualWire"]; ok { + nestedVirtualWire.Misc = o.Misc["VirtualWire"] + } + if o.VirtualWire.Lldp != nil { + nestedVirtualWire.Lldp = &VirtualWireLldpXml{} + if _, ok := o.Misc["VirtualWireLldp"]; ok { + nestedVirtualWire.Lldp.Misc = o.Misc["VirtualWireLldp"] + } + if o.VirtualWire.Lldp.Enable != nil { + nestedVirtualWire.Lldp.Enable = util.YesNo(o.VirtualWire.Lldp.Enable, nil) + } + if o.VirtualWire.Lldp.HighAvailability != nil { + nestedVirtualWire.Lldp.HighAvailability = &VirtualWireLldpHighAvailabilityXml{} + if _, ok := o.Misc["VirtualWireLldpHighAvailability"]; ok { + nestedVirtualWire.Lldp.HighAvailability.Misc = o.Misc["VirtualWireLldpHighAvailability"] + } + if o.VirtualWire.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedVirtualWire.Lldp.HighAvailability.PassivePreNegotiation = util.YesNo(o.VirtualWire.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.VirtualWire.Lldp.Profile != nil { + nestedVirtualWire.Lldp.Profile = o.VirtualWire.Lldp.Profile + } + } + if o.VirtualWire.NetflowProfile != nil { + nestedVirtualWire.NetflowProfile = o.VirtualWire.NetflowProfile + } + } + entry.VirtualWire = nestedVirtualWire + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.Comment = o.Comment + var nestedDecryptMirror *DecryptMirror + if o.DecryptMirror != nil { + nestedDecryptMirror = &DecryptMirror{} + if o.DecryptMirror.Misc != nil { + entry.Misc["DecryptMirror"] = o.DecryptMirror.Misc + } + } + entry.DecryptMirror = nestedDecryptMirror + + var nestedHa *Ha + if o.Ha != nil { + nestedHa = &Ha{} + if o.Ha.Misc != nil { + entry.Misc["Ha"] = o.Ha.Misc + } + if o.Ha.Lacp != nil { + nestedHa.Lacp = &HaLacp{} + if o.Ha.Lacp.Misc != nil { + entry.Misc["HaLacp"] = o.Ha.Lacp.Misc + } + if o.Ha.Lacp.TransmissionRate != nil { + nestedHa.Lacp.TransmissionRate = o.Ha.Lacp.TransmissionRate + } + if o.Ha.Lacp.Enable != nil { + nestedHa.Lacp.Enable = util.AsBool(o.Ha.Lacp.Enable, nil) + } + if o.Ha.Lacp.FastFailover != nil { + nestedHa.Lacp.FastFailover = util.AsBool(o.Ha.Lacp.FastFailover, nil) + } + if o.Ha.Lacp.MaxPorts != nil { + nestedHa.Lacp.MaxPorts = o.Ha.Lacp.MaxPorts + } + if o.Ha.Lacp.Mode != nil { + nestedHa.Lacp.Mode = o.Ha.Lacp.Mode + } + if o.Ha.Lacp.SystemPriority != nil { + nestedHa.Lacp.SystemPriority = o.Ha.Lacp.SystemPriority + } + } + } + entry.Ha = nestedHa + + var nestedLayer2 *Layer2 + if o.Layer2 != nil { + nestedLayer2 = &Layer2{} + if o.Layer2.Misc != nil { + entry.Misc["Layer2"] = o.Layer2.Misc + } + if o.Layer2.Lacp != nil { + nestedLayer2.Lacp = &Layer2Lacp{} + if o.Layer2.Lacp.Misc != nil { + entry.Misc["Layer2Lacp"] = o.Layer2.Lacp.Misc + } + if o.Layer2.Lacp.FastFailover != nil { + nestedLayer2.Lacp.FastFailover = util.AsBool(o.Layer2.Lacp.FastFailover, nil) + } + if o.Layer2.Lacp.HighAvailability != nil { + nestedLayer2.Lacp.HighAvailability = &Layer2LacpHighAvailability{} + if o.Layer2.Lacp.HighAvailability.Misc != nil { + entry.Misc["Layer2LacpHighAvailability"] = o.Layer2.Lacp.HighAvailability.Misc + } + if o.Layer2.Lacp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer2.Lacp.HighAvailability.PassivePreNegotiation = util.AsBool(o.Layer2.Lacp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.Layer2.Lacp.MaxPorts != nil { + nestedLayer2.Lacp.MaxPorts = o.Layer2.Lacp.MaxPorts + } + if o.Layer2.Lacp.Mode != nil { + nestedLayer2.Lacp.Mode = o.Layer2.Lacp.Mode + } + if o.Layer2.Lacp.SystemPriority != nil { + nestedLayer2.Lacp.SystemPriority = o.Layer2.Lacp.SystemPriority + } + if o.Layer2.Lacp.TransmissionRate != nil { + nestedLayer2.Lacp.TransmissionRate = o.Layer2.Lacp.TransmissionRate + } + if o.Layer2.Lacp.Enable != nil { + nestedLayer2.Lacp.Enable = util.AsBool(o.Layer2.Lacp.Enable, nil) + } + } + if o.Layer2.Lldp != nil { + nestedLayer2.Lldp = &Layer2Lldp{} + if o.Layer2.Lldp.Misc != nil { + entry.Misc["Layer2Lldp"] = o.Layer2.Lldp.Misc + } + if o.Layer2.Lldp.Enable != nil { + nestedLayer2.Lldp.Enable = util.AsBool(o.Layer2.Lldp.Enable, nil) + } + if o.Layer2.Lldp.HighAvailability != nil { + nestedLayer2.Lldp.HighAvailability = &Layer2LldpHighAvailability{} + if o.Layer2.Lldp.HighAvailability.Misc != nil { + entry.Misc["Layer2LldpHighAvailability"] = o.Layer2.Lldp.HighAvailability.Misc + } + if o.Layer2.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer2.Lldp.HighAvailability.PassivePreNegotiation = util.AsBool(o.Layer2.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.Layer2.Lldp.Profile != nil { + nestedLayer2.Lldp.Profile = o.Layer2.Lldp.Profile + } + } + if o.Layer2.NetflowProfile != nil { + nestedLayer2.NetflowProfile = o.Layer2.NetflowProfile + } + } + entry.Layer2 = nestedLayer2 + + var nestedLayer3 *Layer3 + if o.Layer3 != nil { + nestedLayer3 = &Layer3{} + if o.Layer3.Misc != nil { + entry.Misc["Layer3"] = o.Layer3.Misc + } + if o.Layer3.NdpProxy != nil { + nestedLayer3.NdpProxy = &Layer3NdpProxy{} + if o.Layer3.NdpProxy.Misc != nil { + entry.Misc["Layer3NdpProxy"] = o.Layer3.NdpProxy.Misc + } + if o.Layer3.NdpProxy.Address != nil { + nestedLayer3.NdpProxy.Address = []Layer3NdpProxyAddress{} + for _, oLayer3NdpProxyAddress := range o.Layer3.NdpProxy.Address { + nestedLayer3NdpProxyAddress := Layer3NdpProxyAddress{} + if oLayer3NdpProxyAddress.Misc != nil { + entry.Misc["Layer3NdpProxyAddress"] = oLayer3NdpProxyAddress.Misc + } + if oLayer3NdpProxyAddress.Negate != nil { + nestedLayer3NdpProxyAddress.Negate = util.AsBool(oLayer3NdpProxyAddress.Negate, nil) + } + if oLayer3NdpProxyAddress.Name != "" { + nestedLayer3NdpProxyAddress.Name = oLayer3NdpProxyAddress.Name + } + nestedLayer3.NdpProxy.Address = append(nestedLayer3.NdpProxy.Address, nestedLayer3NdpProxyAddress) + } + } + if o.Layer3.NdpProxy.Enabled != nil { + nestedLayer3.NdpProxy.Enabled = util.AsBool(o.Layer3.NdpProxy.Enabled, nil) + } + } + if o.Layer3.AdjustTcpMss != nil { + nestedLayer3.AdjustTcpMss = &Layer3AdjustTcpMss{} + if o.Layer3.AdjustTcpMss.Misc != nil { + entry.Misc["Layer3AdjustTcpMss"] = o.Layer3.AdjustTcpMss.Misc + } + if o.Layer3.AdjustTcpMss.Enable != nil { + nestedLayer3.AdjustTcpMss.Enable = util.AsBool(o.Layer3.AdjustTcpMss.Enable, nil) + } + if o.Layer3.AdjustTcpMss.Ipv4MssAdjustment != nil { + nestedLayer3.AdjustTcpMss.Ipv4MssAdjustment = o.Layer3.AdjustTcpMss.Ipv4MssAdjustment + } + if o.Layer3.AdjustTcpMss.Ipv6MssAdjustment != nil { + nestedLayer3.AdjustTcpMss.Ipv6MssAdjustment = o.Layer3.AdjustTcpMss.Ipv6MssAdjustment + } + } + if o.Layer3.Bonjour != nil { + nestedLayer3.Bonjour = &Layer3Bonjour{} + if o.Layer3.Bonjour.Misc != nil { + entry.Misc["Layer3Bonjour"] = o.Layer3.Bonjour.Misc + } + if o.Layer3.Bonjour.TtlCheck != nil { + nestedLayer3.Bonjour.TtlCheck = util.AsBool(o.Layer3.Bonjour.TtlCheck, nil) + } + if o.Layer3.Bonjour.Enable != nil { + nestedLayer3.Bonjour.Enable = util.AsBool(o.Layer3.Bonjour.Enable, nil) + } + if o.Layer3.Bonjour.GroupId != nil { + nestedLayer3.Bonjour.GroupId = o.Layer3.Bonjour.GroupId + } + } + if o.Layer3.DdnsConfig != nil { + nestedLayer3.DdnsConfig = &Layer3DdnsConfig{} + if o.Layer3.DdnsConfig.Misc != nil { + entry.Misc["Layer3DdnsConfig"] = o.Layer3.DdnsConfig.Misc + } + if o.Layer3.DdnsConfig.DdnsCertProfile != nil { + nestedLayer3.DdnsConfig.DdnsCertProfile = o.Layer3.DdnsConfig.DdnsCertProfile + } + if o.Layer3.DdnsConfig.DdnsEnabled != nil { + nestedLayer3.DdnsConfig.DdnsEnabled = util.AsBool(o.Layer3.DdnsConfig.DdnsEnabled, nil) + } + if o.Layer3.DdnsConfig.DdnsHostname != nil { + nestedLayer3.DdnsConfig.DdnsHostname = o.Layer3.DdnsConfig.DdnsHostname + } + if o.Layer3.DdnsConfig.DdnsIp != nil { + nestedLayer3.DdnsConfig.DdnsIp = util.MemToStr(o.Layer3.DdnsConfig.DdnsIp) + } + if o.Layer3.DdnsConfig.DdnsIpv6 != nil { + nestedLayer3.DdnsConfig.DdnsIpv6 = util.MemToStr(o.Layer3.DdnsConfig.DdnsIpv6) + } + if o.Layer3.DdnsConfig.DdnsUpdateInterval != nil { + nestedLayer3.DdnsConfig.DdnsUpdateInterval = o.Layer3.DdnsConfig.DdnsUpdateInterval + } + if o.Layer3.DdnsConfig.DdnsVendor != nil { + nestedLayer3.DdnsConfig.DdnsVendor = o.Layer3.DdnsConfig.DdnsVendor + } + if o.Layer3.DdnsConfig.DdnsVendorConfig != nil { + nestedLayer3.DdnsConfig.DdnsVendorConfig = []Layer3DdnsConfigDdnsVendorConfig{} + for _, oLayer3DdnsConfigDdnsVendorConfig := range o.Layer3.DdnsConfig.DdnsVendorConfig { + nestedLayer3DdnsConfigDdnsVendorConfig := Layer3DdnsConfigDdnsVendorConfig{} + if oLayer3DdnsConfigDdnsVendorConfig.Misc != nil { + entry.Misc["Layer3DdnsConfigDdnsVendorConfig"] = oLayer3DdnsConfigDdnsVendorConfig.Misc + } + if oLayer3DdnsConfigDdnsVendorConfig.Value != nil { + nestedLayer3DdnsConfigDdnsVendorConfig.Value = oLayer3DdnsConfigDdnsVendorConfig.Value + } + if oLayer3DdnsConfigDdnsVendorConfig.Name != "" { + nestedLayer3DdnsConfigDdnsVendorConfig.Name = oLayer3DdnsConfigDdnsVendorConfig.Name + } + nestedLayer3.DdnsConfig.DdnsVendorConfig = append(nestedLayer3.DdnsConfig.DdnsVendorConfig, nestedLayer3DdnsConfigDdnsVendorConfig) + } + } + } + if o.Layer3.Ipv6 != nil { + nestedLayer3.Ipv6 = &Layer3Ipv6{} + if o.Layer3.Ipv6.Misc != nil { + entry.Misc["Layer3Ipv6"] = o.Layer3.Ipv6.Misc + } + if o.Layer3.Ipv6.NeighborDiscovery != nil { + nestedLayer3.Ipv6.NeighborDiscovery = &Layer3Ipv6NeighborDiscovery{} + if o.Layer3.Ipv6.NeighborDiscovery.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscovery"] = o.Layer3.Ipv6.NeighborDiscovery.Misc + } + if o.Layer3.Ipv6.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.NeighborDiscovery.EnableDad = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.NeighborDiscovery.EnableNdpMonitor = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = []Layer3Ipv6NeighborDiscoveryNeighbor{} + for _, oLayer3Ipv6NeighborDiscoveryNeighbor := range o.Layer3.Ipv6.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6NeighborDiscoveryNeighbor := Layer3Ipv6NeighborDiscoveryNeighbor{} + if oLayer3Ipv6NeighborDiscoveryNeighbor.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscoveryNeighbor"] = oLayer3Ipv6NeighborDiscoveryNeighbor.Misc + } + if oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress + } + if oLayer3Ipv6NeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryNeighbor.Name = oLayer3Ipv6NeighborDiscoveryNeighbor.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.NeighborDiscovery.Neighbor, nestedLayer3Ipv6NeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.NeighborDiscovery.NsInterval + } + if o.Layer3.Ipv6.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.ReachableTime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement = &Layer3Ipv6NeighborDiscoveryRouterAdvertisement{} + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisement"] = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Misc + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport = &Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport{} + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport"] = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Misc + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer{} + for _, oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := range o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer{} + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer"] = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Misc + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime != nil { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = append(nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server, nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer) + } + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix{} + for _, oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := range o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix{} + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix"] = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Misc + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime != nil { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = append(nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix, nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix) + } + } + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval + } + } + } + if o.Layer3.Ipv6.DhcpClient != nil { + nestedLayer3.Ipv6.DhcpClient = &Layer3Ipv6DhcpClient{} + if o.Layer3.Ipv6.DhcpClient.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClient"] = o.Layer3.Ipv6.DhcpClient.Misc + } + if o.Layer3.Ipv6.DhcpClient.AcceptRaRoute != nil { + nestedLayer3.Ipv6.DhcpClient.AcceptRaRoute = util.AsBool(o.Layer3.Ipv6.DhcpClient.AcceptRaRoute, nil) + } + if o.Layer3.Ipv6.DhcpClient.DefaultRouteMetric != nil { + nestedLayer3.Ipv6.DhcpClient.DefaultRouteMetric = o.Layer3.Ipv6.DhcpClient.DefaultRouteMetric + } + if o.Layer3.Ipv6.DhcpClient.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.Enable = util.AsBool(o.Layer3.Ipv6.DhcpClient.Enable, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery = &Layer3Ipv6DhcpClientNeighborDiscovery{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscovery"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = []Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer{} + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer"] = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Misc + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable = util.AsBool(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable, nil) + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix{} + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix"] = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable = util.AsBool(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable, nil) + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad = util.AsBool(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor = util.AsBool(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor = []Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor := Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor{} + if oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor"] = oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Misc + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor, nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime + } + } + if o.Layer3.Ipv6.DhcpClient.Preference != nil { + nestedLayer3.Ipv6.DhcpClient.Preference = o.Layer3.Ipv6.DhcpClient.Preference + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation = &Layer3Ipv6DhcpClientPrefixDelegation{} + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientPrefixDelegation"] = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Misc + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable = &Layer3Ipv6DhcpClientPrefixDelegationEnable{} + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnable"] = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Misc + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No = &Layer3Ipv6DhcpClientPrefixDelegationEnableNo{} + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableNo"] = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No.Misc + } + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes = &Layer3Ipv6DhcpClientPrefixDelegationEnableYes{} + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableYes"] = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.Misc + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint = util.AsBool(o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint, nil) + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options = &Layer3Ipv6DhcpClientV6Options{} + if o.Layer3.Ipv6.DhcpClient.V6Options.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientV6Options"] = o.Layer3.Ipv6.DhcpClient.V6Options.Misc + } + if o.Layer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig = util.AsBool(o.Layer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig, nil) + } + if o.Layer3.Ipv6.DhcpClient.V6Options.DuidType != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.DuidType = o.Layer3.Ipv6.DhcpClient.V6Options.DuidType + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable = &Layer3Ipv6DhcpClientV6OptionsEnable{} + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientV6OptionsEnable"] = o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Misc + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes = &Layer3Ipv6DhcpClientV6OptionsEnableYes{} + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientV6OptionsEnableYes"] = o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.Misc + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr = util.AsBool(o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr, nil) + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr = util.AsBool(o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr, nil) + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.No != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.No = &Layer3Ipv6DhcpClientV6OptionsEnableNo{} + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.No.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientV6OptionsEnableNo"] = o.Layer3.Ipv6.DhcpClient.V6Options.Enable.No.Misc + } + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options.RapidCommit != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.RapidCommit = util.AsBool(o.Layer3.Ipv6.DhcpClient.V6Options.RapidCommit, nil) + } + } + } + if o.Layer3.Ipv6.Inherited != nil { + nestedLayer3.Ipv6.Inherited = &Layer3Ipv6Inherited{} + if o.Layer3.Ipv6.Inherited.Misc != nil { + entry.Misc["Layer3Ipv6Inherited"] = o.Layer3.Ipv6.Inherited.Misc + } + if o.Layer3.Ipv6.Inherited.AssignAddr != nil { + nestedLayer3.Ipv6.Inherited.AssignAddr = []Layer3Ipv6InheritedAssignAddr{} + for _, oLayer3Ipv6InheritedAssignAddr := range o.Layer3.Ipv6.Inherited.AssignAddr { + nestedLayer3Ipv6InheritedAssignAddr := Layer3Ipv6InheritedAssignAddr{} + if oLayer3Ipv6InheritedAssignAddr.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddr"] = oLayer3Ipv6InheritedAssignAddr.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type = &Layer3Ipv6InheritedAssignAddrType{} + if oLayer3Ipv6InheritedAssignAddr.Type.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrType"] = oLayer3Ipv6InheritedAssignAddr.Type.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua = &Layer3Ipv6InheritedAssignAddrTypeGua{} + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeGua"] = oLayer3Ipv6InheritedAssignAddr.Type.Gua.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolType{} + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolType"] = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic{} + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic"] = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic.Misc + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId{} + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId"] = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier + } + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise = &Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise{} + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise"] = oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag, nil) + } + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula = &Layer3Ipv6InheritedAssignAddrTypeUla{} + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeUla"] = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise = &Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise{} + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise"] = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag, nil) + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Address != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Address = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Address + } + } + } + if oLayer3Ipv6InheritedAssignAddr.Name != "" { + nestedLayer3Ipv6InheritedAssignAddr.Name = oLayer3Ipv6InheritedAssignAddr.Name + } + nestedLayer3.Ipv6.Inherited.AssignAddr = append(nestedLayer3.Ipv6.Inherited.AssignAddr, nestedLayer3Ipv6InheritedAssignAddr) + } + } + if o.Layer3.Ipv6.Inherited.Enable != nil { + nestedLayer3.Ipv6.Inherited.Enable = util.AsBool(o.Layer3.Ipv6.Inherited.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery = &Layer3Ipv6InheritedNeighborDiscovery{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscovery"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.EnableDad = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer = &Layer3Ipv6InheritedNeighborDiscoveryDnsServer{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServer"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = []Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer := Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer{} + if oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer"] = oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Misc + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name = oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix{} + if oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix"] = oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor = []Layer3Ipv6InheritedNeighborDiscoveryNeighbor{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryNeighbor := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor := Layer3Ipv6InheritedNeighborDiscoveryNeighbor{} + if oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryNeighbor"] = oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Misc + } + if oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress + } + if oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name = oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor, nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.NsInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement = &Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + } + } + } + if o.Layer3.Ipv6.Address != nil { + nestedLayer3.Ipv6.Address = []Layer3Ipv6Address{} + for _, oLayer3Ipv6Address := range o.Layer3.Ipv6.Address { + nestedLayer3Ipv6Address := Layer3Ipv6Address{} + if oLayer3Ipv6Address.Misc != nil { + entry.Misc["Layer3Ipv6Address"] = oLayer3Ipv6Address.Misc + } + if oLayer3Ipv6Address.EnableOnInterface != nil { + nestedLayer3Ipv6Address.EnableOnInterface = util.AsBool(oLayer3Ipv6Address.EnableOnInterface, nil) + } + if oLayer3Ipv6Address.Prefix != nil { + nestedLayer3Ipv6Address.Prefix = &Layer3Ipv6AddressPrefix{} + if oLayer3Ipv6Address.Prefix.Misc != nil { + entry.Misc["Layer3Ipv6AddressPrefix"] = oLayer3Ipv6Address.Prefix.Misc + } + } + if oLayer3Ipv6Address.Anycast != nil { + nestedLayer3Ipv6Address.Anycast = &Layer3Ipv6AddressAnycast{} + if oLayer3Ipv6Address.Anycast.Misc != nil { + entry.Misc["Layer3Ipv6AddressAnycast"] = oLayer3Ipv6Address.Anycast.Misc + } + } + if oLayer3Ipv6Address.Advertise != nil { + nestedLayer3Ipv6Address.Advertise = &Layer3Ipv6AddressAdvertise{} + if oLayer3Ipv6Address.Advertise.Misc != nil { + entry.Misc["Layer3Ipv6AddressAdvertise"] = oLayer3Ipv6Address.Advertise.Misc + } + if oLayer3Ipv6Address.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6Address.Advertise.AutoConfigFlag = util.AsBool(oLayer3Ipv6Address.Advertise.AutoConfigFlag, nil) + } + if oLayer3Ipv6Address.Advertise.Enable != nil { + nestedLayer3Ipv6Address.Advertise.Enable = util.AsBool(oLayer3Ipv6Address.Advertise.Enable, nil) + } + if oLayer3Ipv6Address.Advertise.ValidLifetime != nil { + nestedLayer3Ipv6Address.Advertise.ValidLifetime = oLayer3Ipv6Address.Advertise.ValidLifetime + } + if oLayer3Ipv6Address.Advertise.PreferredLifetime != nil { + nestedLayer3Ipv6Address.Advertise.PreferredLifetime = oLayer3Ipv6Address.Advertise.PreferredLifetime + } + if oLayer3Ipv6Address.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6Address.Advertise.OnlinkFlag = util.AsBool(oLayer3Ipv6Address.Advertise.OnlinkFlag, nil) + } + } + if oLayer3Ipv6Address.Name != "" { + nestedLayer3Ipv6Address.Name = oLayer3Ipv6Address.Name + } + nestedLayer3.Ipv6.Address = append(nestedLayer3.Ipv6.Address, nestedLayer3Ipv6Address) + } + } + if o.Layer3.Ipv6.Enabled != nil { + nestedLayer3.Ipv6.Enabled = util.AsBool(o.Layer3.Ipv6.Enabled, nil) + } + if o.Layer3.Ipv6.InterfaceId != nil { + nestedLayer3.Ipv6.InterfaceId = o.Layer3.Ipv6.InterfaceId + } + } + if o.Layer3.Lldp != nil { + nestedLayer3.Lldp = &Layer3Lldp{} + if o.Layer3.Lldp.Misc != nil { + entry.Misc["Layer3Lldp"] = o.Layer3.Lldp.Misc + } + if o.Layer3.Lldp.HighAvailability != nil { + nestedLayer3.Lldp.HighAvailability = &Layer3LldpHighAvailability{} + if o.Layer3.Lldp.HighAvailability.Misc != nil { + entry.Misc["Layer3LldpHighAvailability"] = o.Layer3.Lldp.HighAvailability.Misc + } + if o.Layer3.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer3.Lldp.HighAvailability.PassivePreNegotiation = util.AsBool(o.Layer3.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.Layer3.Lldp.Profile != nil { + nestedLayer3.Lldp.Profile = o.Layer3.Lldp.Profile + } + if o.Layer3.Lldp.Enable != nil { + nestedLayer3.Lldp.Enable = util.AsBool(o.Layer3.Lldp.Enable, nil) + } + } + if o.Layer3.Arp != nil { + nestedLayer3.Arp = []Layer3Arp{} + for _, oLayer3Arp := range o.Layer3.Arp { + nestedLayer3Arp := Layer3Arp{} + if oLayer3Arp.Misc != nil { + entry.Misc["Layer3Arp"] = oLayer3Arp.Misc + } + if oLayer3Arp.HwAddress != nil { + nestedLayer3Arp.HwAddress = oLayer3Arp.HwAddress + } + if oLayer3Arp.Name != "" { + nestedLayer3Arp.Name = oLayer3Arp.Name + } + nestedLayer3.Arp = append(nestedLayer3.Arp, nestedLayer3Arp) + } + } + if o.Layer3.DecryptForward != nil { + nestedLayer3.DecryptForward = util.AsBool(o.Layer3.DecryptForward, nil) + } + if o.Layer3.Mtu != nil { + nestedLayer3.Mtu = o.Layer3.Mtu + } + if o.Layer3.NetflowProfile != nil { + nestedLayer3.NetflowProfile = o.Layer3.NetflowProfile + } + if o.Layer3.DhcpClient != nil { + nestedLayer3.DhcpClient = &Layer3DhcpClient{} + if o.Layer3.DhcpClient.Misc != nil { + entry.Misc["Layer3DhcpClient"] = o.Layer3.DhcpClient.Misc + } + if o.Layer3.DhcpClient.CreateDefaultRoute != nil { + nestedLayer3.DhcpClient.CreateDefaultRoute = util.AsBool(o.Layer3.DhcpClient.CreateDefaultRoute, nil) + } + if o.Layer3.DhcpClient.DefaultRouteMetric != nil { + nestedLayer3.DhcpClient.DefaultRouteMetric = o.Layer3.DhcpClient.DefaultRouteMetric + } + if o.Layer3.DhcpClient.Enable != nil { + nestedLayer3.DhcpClient.Enable = util.AsBool(o.Layer3.DhcpClient.Enable, nil) + } + if o.Layer3.DhcpClient.SendHostname != nil { + nestedLayer3.DhcpClient.SendHostname = &Layer3DhcpClientSendHostname{} + if o.Layer3.DhcpClient.SendHostname.Misc != nil { + entry.Misc["Layer3DhcpClientSendHostname"] = o.Layer3.DhcpClient.SendHostname.Misc + } + if o.Layer3.DhcpClient.SendHostname.Enable != nil { + nestedLayer3.DhcpClient.SendHostname.Enable = util.AsBool(o.Layer3.DhcpClient.SendHostname.Enable, nil) + } + if o.Layer3.DhcpClient.SendHostname.Hostname != nil { + nestedLayer3.DhcpClient.SendHostname.Hostname = o.Layer3.DhcpClient.SendHostname.Hostname + } + } + } + if o.Layer3.InterfaceManagementProfile != nil { + nestedLayer3.InterfaceManagementProfile = o.Layer3.InterfaceManagementProfile + } + if o.Layer3.SdwanLinkSettings != nil { + nestedLayer3.SdwanLinkSettings = &Layer3SdwanLinkSettings{} + if o.Layer3.SdwanLinkSettings.Misc != nil { + entry.Misc["Layer3SdwanLinkSettings"] = o.Layer3.SdwanLinkSettings.Misc + } + if o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile != nil { + nestedLayer3.SdwanLinkSettings.SdwanInterfaceProfile = o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile + } + if o.Layer3.SdwanLinkSettings.UpstreamNat != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat = &Layer3SdwanLinkSettingsUpstreamNat{} + if o.Layer3.SdwanLinkSettings.UpstreamNat.Misc != nil { + entry.Misc["Layer3SdwanLinkSettingsUpstreamNat"] = o.Layer3.SdwanLinkSettings.UpstreamNat.Misc + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.Enable != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Enable = util.AsBool(o.Layer3.SdwanLinkSettings.UpstreamNat.Enable, nil) + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.Ddns != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Ddns = &Layer3SdwanLinkSettingsUpstreamNatDdns{} + if o.Layer3.SdwanLinkSettings.UpstreamNat.Ddns.Misc != nil { + entry.Misc["Layer3SdwanLinkSettingsUpstreamNatDdns"] = o.Layer3.SdwanLinkSettings.UpstreamNat.Ddns.Misc + } + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp = &Layer3SdwanLinkSettingsUpstreamNatStaticIp{} + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Misc != nil { + entry.Misc["Layer3SdwanLinkSettingsUpstreamNatStaticIp"] = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Misc + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress + } + } + } + if o.Layer3.SdwanLinkSettings.Enable != nil { + nestedLayer3.SdwanLinkSettings.Enable = util.AsBool(o.Layer3.SdwanLinkSettings.Enable, nil) + } + } + if o.Layer3.UntaggedSubInterface != nil { + nestedLayer3.UntaggedSubInterface = util.AsBool(o.Layer3.UntaggedSubInterface, nil) + } + if o.Layer3.DfIgnore != nil { + nestedLayer3.DfIgnore = util.AsBool(o.Layer3.DfIgnore, nil) + } + if o.Layer3.Ip != nil { + nestedLayer3.Ip = []Layer3Ip{} + for _, oLayer3Ip := range o.Layer3.Ip { + nestedLayer3Ip := Layer3Ip{} + if oLayer3Ip.Misc != nil { + entry.Misc["Layer3Ip"] = oLayer3Ip.Misc + } + if oLayer3Ip.Name != "" { + nestedLayer3Ip.Name = oLayer3Ip.Name + } + if oLayer3Ip.SdwanGateway != nil { + nestedLayer3Ip.SdwanGateway = oLayer3Ip.SdwanGateway + } + nestedLayer3.Ip = append(nestedLayer3.Ip, nestedLayer3Ip) + } + } + if o.Layer3.Lacp != nil { + nestedLayer3.Lacp = &Layer3Lacp{} + if o.Layer3.Lacp.Misc != nil { + entry.Misc["Layer3Lacp"] = o.Layer3.Lacp.Misc + } + if o.Layer3.Lacp.FastFailover != nil { + nestedLayer3.Lacp.FastFailover = util.AsBool(o.Layer3.Lacp.FastFailover, nil) + } + if o.Layer3.Lacp.HighAvailability != nil { + nestedLayer3.Lacp.HighAvailability = &Layer3LacpHighAvailability{} + if o.Layer3.Lacp.HighAvailability.Misc != nil { + entry.Misc["Layer3LacpHighAvailability"] = o.Layer3.Lacp.HighAvailability.Misc + } + if o.Layer3.Lacp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer3.Lacp.HighAvailability.PassivePreNegotiation = util.AsBool(o.Layer3.Lacp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.Layer3.Lacp.MaxPorts != nil { + nestedLayer3.Lacp.MaxPorts = o.Layer3.Lacp.MaxPorts + } + if o.Layer3.Lacp.Mode != nil { + nestedLayer3.Lacp.Mode = o.Layer3.Lacp.Mode + } + if o.Layer3.Lacp.SystemPriority != nil { + nestedLayer3.Lacp.SystemPriority = o.Layer3.Lacp.SystemPriority + } + if o.Layer3.Lacp.TransmissionRate != nil { + nestedLayer3.Lacp.TransmissionRate = o.Layer3.Lacp.TransmissionRate + } + if o.Layer3.Lacp.Enable != nil { + nestedLayer3.Lacp.Enable = util.AsBool(o.Layer3.Lacp.Enable, nil) + } + } + } + entry.Layer3 = nestedLayer3 + + var nestedVirtualWire *VirtualWire + if o.VirtualWire != nil { + nestedVirtualWire = &VirtualWire{} + if o.VirtualWire.Misc != nil { + entry.Misc["VirtualWire"] = o.VirtualWire.Misc + } + if o.VirtualWire.Lldp != nil { + nestedVirtualWire.Lldp = &VirtualWireLldp{} + if o.VirtualWire.Lldp.Misc != nil { + entry.Misc["VirtualWireLldp"] = o.VirtualWire.Lldp.Misc + } + if o.VirtualWire.Lldp.Enable != nil { + nestedVirtualWire.Lldp.Enable = util.AsBool(o.VirtualWire.Lldp.Enable, nil) + } + if o.VirtualWire.Lldp.HighAvailability != nil { + nestedVirtualWire.Lldp.HighAvailability = &VirtualWireLldpHighAvailability{} + if o.VirtualWire.Lldp.HighAvailability.Misc != nil { + entry.Misc["VirtualWireLldpHighAvailability"] = o.VirtualWire.Lldp.HighAvailability.Misc + } + if o.VirtualWire.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedVirtualWire.Lldp.HighAvailability.PassivePreNegotiation = util.AsBool(o.VirtualWire.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.VirtualWire.Lldp.Profile != nil { + nestedVirtualWire.Lldp.Profile = o.VirtualWire.Lldp.Profile + } + } + if o.VirtualWire.NetflowProfile != nil { + nestedVirtualWire.NetflowProfile = o.VirtualWire.NetflowProfile + } + } + entry.VirtualWire = nestedVirtualWire + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.StringsMatch(a.Comment, b.Comment) { + return false + } + if !matchDecryptMirror(a.DecryptMirror, b.DecryptMirror) { + return false + } + if !matchHa(a.Ha, b.Ha) { + return false + } + if !matchLayer2(a.Layer2, b.Layer2) { + return false + } + if !matchLayer3(a.Layer3, b.Layer3) { + return false + } + if !matchVirtualWire(a.VirtualWire, b.VirtualWire) { + return false + } + + return true +} + +func matchDecryptMirror(a *DecryptMirror, b *DecryptMirror) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchHaLacp(a *HaLacp, b *HaLacp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.BoolsMatch(a.FastFailover, b.FastFailover) { + return false + } + if !util.Ints64Match(a.MaxPorts, b.MaxPorts) { + return false + } + if !util.StringsMatch(a.Mode, b.Mode) { + return false + } + if !util.Ints64Match(a.SystemPriority, b.SystemPriority) { + return false + } + if !util.StringsMatch(a.TransmissionRate, b.TransmissionRate) { + return false + } + return true +} +func matchHa(a *Ha, b *Ha) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchHaLacp(a.Lacp, b.Lacp) { + return false + } + return true +} +func matchLayer2LacpHighAvailability(a *Layer2LacpHighAvailability, b *Layer2LacpHighAvailability) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.PassivePreNegotiation, b.PassivePreNegotiation) { + return false + } + return true +} +func matchLayer2Lacp(a *Layer2Lacp, b *Layer2Lacp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.BoolsMatch(a.FastFailover, b.FastFailover) { + return false + } + if !matchLayer2LacpHighAvailability(a.HighAvailability, b.HighAvailability) { + return false + } + if !util.Ints64Match(a.MaxPorts, b.MaxPorts) { + return false + } + if !util.StringsMatch(a.Mode, b.Mode) { + return false + } + if !util.Ints64Match(a.SystemPriority, b.SystemPriority) { + return false + } + if !util.StringsMatch(a.TransmissionRate, b.TransmissionRate) { + return false + } + return true +} +func matchLayer2LldpHighAvailability(a *Layer2LldpHighAvailability, b *Layer2LldpHighAvailability) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.PassivePreNegotiation, b.PassivePreNegotiation) { + return false + } + return true +} +func matchLayer2Lldp(a *Layer2Lldp, b *Layer2Lldp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer2LldpHighAvailability(a.HighAvailability, b.HighAvailability) { + return false + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } + return true +} +func matchLayer2(a *Layer2, b *Layer2) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.NetflowProfile, b.NetflowProfile) { + return false + } + if !matchLayer2Lacp(a.Lacp, b.Lacp) { + return false + } + if !matchLayer2Lldp(a.Lldp, b.Lldp) { + return false + } + return true +} +func matchLayer3Arp(a []Layer3Arp, b []Layer3Arp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.HwAddress, b.HwAddress) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchLayer3DhcpClientSendHostname(a *Layer3DhcpClientSendHostname, b *Layer3DhcpClientSendHostname) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.StringsMatch(a.Hostname, b.Hostname) { + return false + } + return true +} +func matchLayer3DhcpClient(a *Layer3DhcpClient, b *Layer3DhcpClient) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.CreateDefaultRoute, b.CreateDefaultRoute) { + return false + } + if !util.Ints64Match(a.DefaultRouteMetric, b.DefaultRouteMetric) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3DhcpClientSendHostname(a.SendHostname, b.SendHostname) { + return false + } + return true +} +func matchLayer3SdwanLinkSettingsUpstreamNatDdns(a *Layer3SdwanLinkSettingsUpstreamNatDdns, b *Layer3SdwanLinkSettingsUpstreamNatDdns) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchLayer3SdwanLinkSettingsUpstreamNatStaticIp(a *Layer3SdwanLinkSettingsUpstreamNatStaticIp, b *Layer3SdwanLinkSettingsUpstreamNatStaticIp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Fqdn, b.Fqdn) { + return false + } + if !util.StringsMatch(a.IpAddress, b.IpAddress) { + return false + } + return true +} +func matchLayer3SdwanLinkSettingsUpstreamNat(a *Layer3SdwanLinkSettingsUpstreamNat, b *Layer3SdwanLinkSettingsUpstreamNat) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3SdwanLinkSettingsUpstreamNatDdns(a.Ddns, b.Ddns) { + return false + } + if !matchLayer3SdwanLinkSettingsUpstreamNatStaticIp(a.StaticIp, b.StaticIp) { + return false + } + return true +} +func matchLayer3SdwanLinkSettings(a *Layer3SdwanLinkSettings, b *Layer3SdwanLinkSettings) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.StringsMatch(a.SdwanInterfaceProfile, b.SdwanInterfaceProfile) { + return false + } + if !matchLayer3SdwanLinkSettingsUpstreamNat(a.UpstreamNat, b.UpstreamNat) { + return false + } + return true +} +func matchLayer3Ip(a []Layer3Ip, b []Layer3Ip) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.SdwanGateway, b.SdwanGateway) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchLayer3LacpHighAvailability(a *Layer3LacpHighAvailability, b *Layer3LacpHighAvailability) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.PassivePreNegotiation, b.PassivePreNegotiation) { + return false + } + return true +} +func matchLayer3Lacp(a *Layer3Lacp, b *Layer3Lacp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.BoolsMatch(a.FastFailover, b.FastFailover) { + return false + } + if !matchLayer3LacpHighAvailability(a.HighAvailability, b.HighAvailability) { + return false + } + if !util.Ints64Match(a.MaxPorts, b.MaxPorts) { + return false + } + if !util.StringsMatch(a.Mode, b.Mode) { + return false + } + if !util.Ints64Match(a.SystemPriority, b.SystemPriority) { + return false + } + if !util.StringsMatch(a.TransmissionRate, b.TransmissionRate) { + return false + } + return true +} +func matchLayer3AdjustTcpMss(a *Layer3AdjustTcpMss, b *Layer3AdjustTcpMss) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.Ipv4MssAdjustment, b.Ipv4MssAdjustment) { + return false + } + if !util.Ints64Match(a.Ipv6MssAdjustment, b.Ipv6MssAdjustment) { + return false + } + return true +} +func matchLayer3Bonjour(a *Layer3Bonjour, b *Layer3Bonjour) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.TtlCheck, b.TtlCheck) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.GroupId, b.GroupId) { + return false + } + return true +} +func matchLayer3DdnsConfigDdnsVendorConfig(a []Layer3DdnsConfigDdnsVendorConfig, b []Layer3DdnsConfigDdnsVendorConfig) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.Value, b.Value) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchLayer3DdnsConfig(a *Layer3DdnsConfig, b *Layer3DdnsConfig) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.DdnsHostname, b.DdnsHostname) { + return false + } + if !util.OrderedListsMatch(a.DdnsIp, b.DdnsIp) { + return false + } + if !util.OrderedListsMatch(a.DdnsIpv6, b.DdnsIpv6) { + return false + } + if !util.Ints64Match(a.DdnsUpdateInterval, b.DdnsUpdateInterval) { + return false + } + if !util.StringsMatch(a.DdnsVendor, b.DdnsVendor) { + return false + } + if !matchLayer3DdnsConfigDdnsVendorConfig(a.DdnsVendorConfig, b.DdnsVendorConfig) { + return false + } + if !util.StringsMatch(a.DdnsCertProfile, b.DdnsCertProfile) { + return false + } + if !util.BoolsMatch(a.DdnsEnabled, b.DdnsEnabled) { + return false + } + return true +} +func matchLayer3Ipv6NeighborDiscoveryNeighbor(a []Layer3Ipv6NeighborDiscoveryNeighbor, b []Layer3Ipv6NeighborDiscoveryNeighbor) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.HwAddress, b.HwAddress) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer(a []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer, b []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix(a []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix, b []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport(a *Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport, b *Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer(a.Server, b.Server) { + return false + } + if !matchLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix(a.Suffix, b.Suffix) { + return false + } + return true +} +func matchLayer3Ipv6NeighborDiscoveryRouterAdvertisement(a *Layer3Ipv6NeighborDiscoveryRouterAdvertisement, b *Layer3Ipv6NeighborDiscoveryRouterAdvertisement) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.ReachableTime, b.ReachableTime) { + return false + } + if !matchLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport(a.DnsSupport, b.DnsSupport) { + return false + } + if !util.BoolsMatch(a.EnableConsistencyCheck, b.EnableConsistencyCheck) { + return false + } + if !util.StringsMatch(a.HopLimit, b.HopLimit) { + return false + } + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.Ints64Match(a.MaxInterval, b.MaxInterval) { + return false + } + if !util.Ints64Match(a.MinInterval, b.MinInterval) { + return false + } + if !util.BoolsMatch(a.OtherFlag, b.OtherFlag) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.StringsMatch(a.LinkMtu, b.LinkMtu) { + return false + } + if !util.BoolsMatch(a.ManagedFlag, b.ManagedFlag) { + return false + } + if !util.StringsMatch(a.RetransmissionTimer, b.RetransmissionTimer) { + return false + } + if !util.StringsMatch(a.RouterPreference, b.RouterPreference) { + return false + } + return true +} +func matchLayer3Ipv6NeighborDiscovery(a *Layer3Ipv6NeighborDiscovery, b *Layer3Ipv6NeighborDiscovery) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.EnableNdpMonitor, b.EnableNdpMonitor) { + return false + } + if !matchLayer3Ipv6NeighborDiscoveryNeighbor(a.Neighbor, b.Neighbor) { + return false + } + if !util.Ints64Match(a.NsInterval, b.NsInterval) { + return false + } + if !util.Ints64Match(a.ReachableTime, b.ReachableTime) { + return false + } + if !matchLayer3Ipv6NeighborDiscoveryRouterAdvertisement(a.RouterAdvertisement, b.RouterAdvertisement) { + return false + } + if !util.Ints64Match(a.DadAttempts, b.DadAttempts) { + return false + } + if !util.BoolsMatch(a.EnableDad, b.EnableDad) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer(a []Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer, b []Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer(a.Server, b.Server) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6(a.Dhcpv6, b.Dhcpv6) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual(a.Manual, b.Manual) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServer(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource(a.Source, b.Source) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix(a []Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix, b []Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix(a.Suffix, b.Suffix) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6(a.Dhcpv6, b.Dhcpv6) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual(a.Manual, b.Manual) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource(a.Source, b.Source) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor(a []Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor, b []Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.HwAddress, b.HwAddress) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscovery(a *Layer3Ipv6DhcpClientNeighborDiscovery, b *Layer3Ipv6DhcpClientNeighborDiscovery) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.DadAttempts, b.DadAttempts) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServer(a.DnsServer, b.DnsServer) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix(a.DnsSuffix, b.DnsSuffix) { + return false + } + if !util.BoolsMatch(a.EnableDad, b.EnableDad) { + return false + } + if !util.BoolsMatch(a.EnableNdpMonitor, b.EnableNdpMonitor) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor(a.Neighbor, b.Neighbor) { + return false + } + if !util.Ints64Match(a.NsInterval, b.NsInterval) { + return false + } + if !util.Ints64Match(a.ReachableTime, b.ReachableTime) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientPrefixDelegationEnableNo(a *Layer3Ipv6DhcpClientPrefixDelegationEnableNo, b *Layer3Ipv6DhcpClientPrefixDelegationEnableNo) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchLayer3Ipv6DhcpClientPrefixDelegationEnableYes(a *Layer3Ipv6DhcpClientPrefixDelegationEnableYes, b *Layer3Ipv6DhcpClientPrefixDelegationEnableYes) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.PfxPoolName, b.PfxPoolName) { + return false + } + if !util.Ints64Match(a.PrefixLen, b.PrefixLen) { + return false + } + if !util.BoolsMatch(a.PrefixLenHint, b.PrefixLenHint) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientPrefixDelegationEnable(a *Layer3Ipv6DhcpClientPrefixDelegationEnable, b *Layer3Ipv6DhcpClientPrefixDelegationEnable) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6DhcpClientPrefixDelegationEnableYes(a.Yes, b.Yes) { + return false + } + if !matchLayer3Ipv6DhcpClientPrefixDelegationEnableNo(a.No, b.No) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientPrefixDelegation(a *Layer3Ipv6DhcpClientPrefixDelegation, b *Layer3Ipv6DhcpClientPrefixDelegation) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6DhcpClientPrefixDelegationEnable(a.Enable, b.Enable) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientV6OptionsEnableNo(a *Layer3Ipv6DhcpClientV6OptionsEnableNo, b *Layer3Ipv6DhcpClientV6OptionsEnableNo) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchLayer3Ipv6DhcpClientV6OptionsEnableYes(a *Layer3Ipv6DhcpClientV6OptionsEnableYes, b *Layer3Ipv6DhcpClientV6OptionsEnableYes) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.NonTempAddr, b.NonTempAddr) { + return false + } + if !util.BoolsMatch(a.TempAddr, b.TempAddr) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientV6OptionsEnable(a *Layer3Ipv6DhcpClientV6OptionsEnable, b *Layer3Ipv6DhcpClientV6OptionsEnable) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6DhcpClientV6OptionsEnableNo(a.No, b.No) { + return false + } + if !matchLayer3Ipv6DhcpClientV6OptionsEnableYes(a.Yes, b.Yes) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientV6Options(a *Layer3Ipv6DhcpClientV6Options, b *Layer3Ipv6DhcpClientV6Options) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.SupportSrvrReconfig, b.SupportSrvrReconfig) { + return false + } + if !util.StringsMatch(a.DuidType, b.DuidType) { + return false + } + if !matchLayer3Ipv6DhcpClientV6OptionsEnable(a.Enable, b.Enable) { + return false + } + if !util.BoolsMatch(a.RapidCommit, b.RapidCommit) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClient(a *Layer3Ipv6DhcpClient, b *Layer3Ipv6DhcpClient) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Preference, b.Preference) { + return false + } + if !matchLayer3Ipv6DhcpClientPrefixDelegation(a.PrefixDelegation, b.PrefixDelegation) { + return false + } + if !matchLayer3Ipv6DhcpClientV6Options(a.V6Options, b.V6Options) { + return false + } + if !util.BoolsMatch(a.AcceptRaRoute, b.AcceptRaRoute) { + return false + } + if !util.Ints64Match(a.DefaultRouteMetric, b.DefaultRouteMetric) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscovery(a.NeighborDiscovery, b.NeighborDiscovery) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6(a *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6, b *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.PrefixPool, b.PrefixPool) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer(a []Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer, b []Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual(a *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual, b *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer(a.Server, b.Server) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSource(a *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource, b *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6(a.Dhcpv6, b.Dhcpv6) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual(a.Manual, b.Manual) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsServer(a *Layer3Ipv6InheritedNeighborDiscoveryDnsServer, b *Layer3Ipv6InheritedNeighborDiscoveryDnsServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSource(a.Source, b.Source) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6(a *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6, b *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.PrefixPool, b.PrefixPool) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix(a []Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix, b []Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual(a *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual, b *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix(a.Suffix, b.Suffix) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource(a *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource, b *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6(a.Dhcpv6, b.Dhcpv6) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual(a.Manual, b.Manual) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffix(a *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix, b *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource(a.Source, b.Source) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryNeighbor(a []Layer3Ipv6InheritedNeighborDiscoveryNeighbor, b []Layer3Ipv6InheritedNeighborDiscoveryNeighbor) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.HwAddress, b.HwAddress) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement(a *Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement, b *Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.BoolsMatch(a.ManagedFlag, b.ManagedFlag) { + return false + } + if !util.BoolsMatch(a.OtherFlag, b.OtherFlag) { + return false + } + if !util.StringsMatch(a.RetransmissionTimer, b.RetransmissionTimer) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.BoolsMatch(a.EnableConsistencyCheck, b.EnableConsistencyCheck) { + return false + } + if !util.StringsMatch(a.HopLimit, b.HopLimit) { + return false + } + if !util.StringsMatch(a.ReachableTime, b.ReachableTime) { + return false + } + if !util.StringsMatch(a.RouterPreference, b.RouterPreference) { + return false + } + if !util.StringsMatch(a.LinkMtu, b.LinkMtu) { + return false + } + if !util.Ints64Match(a.MaxInterval, b.MaxInterval) { + return false + } + if !util.Ints64Match(a.MinInterval, b.MinInterval) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscovery(a *Layer3Ipv6InheritedNeighborDiscovery, b *Layer3Ipv6InheritedNeighborDiscovery) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.EnableDad, b.EnableDad) { + return false + } + if !util.BoolsMatch(a.EnableNdpMonitor, b.EnableNdpMonitor) { + return false + } + if !util.Ints64Match(a.ReachableTime, b.ReachableTime) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryNeighbor(a.Neighbor, b.Neighbor) { + return false + } + if !util.Ints64Match(a.NsInterval, b.NsInterval) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement(a.RouterAdvertisement, b.RouterAdvertisement) { + return false + } + if !util.Ints64Match(a.DadAttempts, b.DadAttempts) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsServer(a.DnsServer, b.DnsServer) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffix(a.DnsSuffix, b.DnsSuffix) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic(a *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic, b *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId(a *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId, b *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Identifier, b.Identifier) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrTypeGuaPoolType(a *Layer3Ipv6InheritedAssignAddrTypeGuaPoolType, b *Layer3Ipv6InheritedAssignAddrTypeGuaPoolType) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic(a.Dynamic, b.Dynamic) { + return false + } + if !matchLayer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId(a.DynamicId, b.DynamicId) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrTypeGuaAdvertise(a *Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise, b *Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.BoolsMatch(a.OnlinkFlag, b.OnlinkFlag) { + return false + } + if !util.BoolsMatch(a.AutoConfigFlag, b.AutoConfigFlag) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrTypeGua(a *Layer3Ipv6InheritedAssignAddrTypeGua, b *Layer3Ipv6InheritedAssignAddrTypeGua) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.EnableOnInterface, b.EnableOnInterface) { + return false + } + if !util.StringsMatch(a.PrefixPool, b.PrefixPool) { + return false + } + if !matchLayer3Ipv6InheritedAssignAddrTypeGuaPoolType(a.PoolType, b.PoolType) { + return false + } + if !matchLayer3Ipv6InheritedAssignAddrTypeGuaAdvertise(a.Advertise, b.Advertise) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrTypeUlaAdvertise(a *Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise, b *Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.PreferredLifetime, b.PreferredLifetime) { + return false + } + if !util.BoolsMatch(a.OnlinkFlag, b.OnlinkFlag) { + return false + } + if !util.BoolsMatch(a.AutoConfigFlag, b.AutoConfigFlag) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.StringsMatch(a.ValidLifetime, b.ValidLifetime) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrTypeUla(a *Layer3Ipv6InheritedAssignAddrTypeUla, b *Layer3Ipv6InheritedAssignAddrTypeUla) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Address, b.Address) { + return false + } + if !util.BoolsMatch(a.Prefix, b.Prefix) { + return false + } + if !util.BoolsMatch(a.Anycast, b.Anycast) { + return false + } + if !matchLayer3Ipv6InheritedAssignAddrTypeUlaAdvertise(a.Advertise, b.Advertise) { + return false + } + if !util.BoolsMatch(a.EnableOnInterface, b.EnableOnInterface) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrType(a *Layer3Ipv6InheritedAssignAddrType, b *Layer3Ipv6InheritedAssignAddrType) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6InheritedAssignAddrTypeGua(a.Gua, b.Gua) { + return false + } + if !matchLayer3Ipv6InheritedAssignAddrTypeUla(a.Ula, b.Ula) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddr(a []Layer3Ipv6InheritedAssignAddr, b []Layer3Ipv6InheritedAssignAddr) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !matchLayer3Ipv6InheritedAssignAddrType(a.Type, b.Type) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchLayer3Ipv6Inherited(a *Layer3Ipv6Inherited, b *Layer3Ipv6Inherited) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6InheritedAssignAddr(a.AssignAddr, b.AssignAddr) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscovery(a.NeighborDiscovery, b.NeighborDiscovery) { + return false + } + return true +} +func matchLayer3Ipv6AddressPrefix(a *Layer3Ipv6AddressPrefix, b *Layer3Ipv6AddressPrefix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchLayer3Ipv6AddressAnycast(a *Layer3Ipv6AddressAnycast, b *Layer3Ipv6AddressAnycast) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchLayer3Ipv6AddressAdvertise(a *Layer3Ipv6AddressAdvertise, b *Layer3Ipv6AddressAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.StringsMatch(a.ValidLifetime, b.ValidLifetime) { + return false + } + if !util.StringsMatch(a.PreferredLifetime, b.PreferredLifetime) { + return false + } + if !util.BoolsMatch(a.OnlinkFlag, b.OnlinkFlag) { + return false + } + if !util.BoolsMatch(a.AutoConfigFlag, b.AutoConfigFlag) { + return false + } + return true +} +func matchLayer3Ipv6Address(a []Layer3Ipv6Address, b []Layer3Ipv6Address) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.EnableOnInterface, b.EnableOnInterface) { + return false + } + if !matchLayer3Ipv6AddressPrefix(a.Prefix, b.Prefix) { + return false + } + if !matchLayer3Ipv6AddressAnycast(a.Anycast, b.Anycast) { + return false + } + if !matchLayer3Ipv6AddressAdvertise(a.Advertise, b.Advertise) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchLayer3Ipv6(a *Layer3Ipv6, b *Layer3Ipv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6NeighborDiscovery(a.NeighborDiscovery, b.NeighborDiscovery) { + return false + } + if !matchLayer3Ipv6DhcpClient(a.DhcpClient, b.DhcpClient) { + return false + } + if !matchLayer3Ipv6Inherited(a.Inherited, b.Inherited) { + return false + } + if !matchLayer3Ipv6Address(a.Address, b.Address) { + return false + } + if !util.BoolsMatch(a.Enabled, b.Enabled) { + return false + } + if !util.StringsMatch(a.InterfaceId, b.InterfaceId) { + return false + } + return true +} +func matchLayer3LldpHighAvailability(a *Layer3LldpHighAvailability, b *Layer3LldpHighAvailability) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.PassivePreNegotiation, b.PassivePreNegotiation) { + return false + } + return true +} +func matchLayer3Lldp(a *Layer3Lldp, b *Layer3Lldp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3LldpHighAvailability(a.HighAvailability, b.HighAvailability) { + return false + } + return true +} +func matchLayer3NdpProxyAddress(a []Layer3NdpProxyAddress, b []Layer3NdpProxyAddress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.BoolsMatch(a.Negate, b.Negate) { + return false + } + } + } + return true +} +func matchLayer3NdpProxy(a *Layer3NdpProxy, b *Layer3NdpProxy) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3NdpProxyAddress(a.Address, b.Address) { + return false + } + if !util.BoolsMatch(a.Enabled, b.Enabled) { + return false + } + return true +} +func matchLayer3(a *Layer3, b *Layer3) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3DhcpClient(a.DhcpClient, b.DhcpClient) { + return false + } + if !util.StringsMatch(a.InterfaceManagementProfile, b.InterfaceManagementProfile) { + return false + } + if !matchLayer3SdwanLinkSettings(a.SdwanLinkSettings, b.SdwanLinkSettings) { + return false + } + if !util.BoolsMatch(a.UntaggedSubInterface, b.UntaggedSubInterface) { + return false + } + if !util.BoolsMatch(a.DfIgnore, b.DfIgnore) { + return false + } + if !matchLayer3Ip(a.Ip, b.Ip) { + return false + } + if !matchLayer3Lacp(a.Lacp, b.Lacp) { + return false + } + if !matchLayer3AdjustTcpMss(a.AdjustTcpMss, b.AdjustTcpMss) { + return false + } + if !matchLayer3Bonjour(a.Bonjour, b.Bonjour) { + return false + } + if !matchLayer3DdnsConfig(a.DdnsConfig, b.DdnsConfig) { + return false + } + if !matchLayer3Ipv6(a.Ipv6, b.Ipv6) { + return false + } + if !matchLayer3Lldp(a.Lldp, b.Lldp) { + return false + } + if !matchLayer3NdpProxy(a.NdpProxy, b.NdpProxy) { + return false + } + if !matchLayer3Arp(a.Arp, b.Arp) { + return false + } + if !util.BoolsMatch(a.DecryptForward, b.DecryptForward) { + return false + } + if !util.Ints64Match(a.Mtu, b.Mtu) { + return false + } + if !util.StringsMatch(a.NetflowProfile, b.NetflowProfile) { + return false + } + return true +} +func matchVirtualWireLldpHighAvailability(a *VirtualWireLldpHighAvailability, b *VirtualWireLldpHighAvailability) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.PassivePreNegotiation, b.PassivePreNegotiation) { + return false + } + return true +} +func matchVirtualWireLldp(a *VirtualWireLldp, b *VirtualWireLldp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchVirtualWireLldpHighAvailability(a.HighAvailability, b.HighAvailability) { + return false + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } + return true +} +func matchVirtualWire(a *VirtualWire, b *VirtualWire) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchVirtualWireLldp(a.Lldp, b.Lldp) { + return false + } + if !util.StringsMatch(a.NetflowProfile, b.NetflowProfile) { + return false + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/network/interface/aggregate/interfaces.go b/network/interface/aggregate/interfaces.go new file mode 100644 index 00000000..5798235e --- /dev/null +++ b/network/interface/aggregate/interfaces.go @@ -0,0 +1,7 @@ +package aggregate + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/network/interface/aggregate/location.go b/network/interface/aggregate/location.go new file mode 100644 index 00000000..8a6ff1c5 --- /dev/null +++ b/network/interface/aggregate/location.go @@ -0,0 +1,200 @@ +package aggregate + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + Ngfw *NgfwLocation `json:"ngfw,omitempty"` + Shared bool `json:"shared"` + Template *TemplateLocation `json:"template,omitempty"` + TemplateStack *TemplateStackLocation `json:"template_stack,omitempty"` +} + +type NgfwLocation struct { + NgfwDevice string `json:"ngfw_device"` +} + +type TemplateLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + Template string `json:"template"` +} + +type TemplateStackLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + TemplateStack string `json:"template_stack"` +} + +func NewNgfwLocation() *Location { + return &Location{Ngfw: &NgfwLocation{ + NgfwDevice: "localhost.localdomain", + }, + } +} +func NewSharedLocation() *Location { + return &Location{ + Shared: true, + } +} +func NewTemplateLocation() *Location { + return &Location{Template: &TemplateLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + Template: "", + }, + } +} +func NewTemplateStackLocation() *Location { + return &Location{TemplateStack: &TemplateStackLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + TemplateStack: "", + }, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.Ngfw != nil: + if o.Ngfw.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + count++ + case o.Shared: + count++ + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return fmt.Errorf("Template is unspecified") + } + count++ + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return fmt.Errorf("TemplateStack is unspecified") + } + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.Ngfw != nil: + if o.Ngfw.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Ngfw.NgfwDevice}), + } + case o.Shared: + ans = []string{ + "config", + "shared", + } + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return nil, fmt.Errorf("Template is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Template.PanoramaDevice}), + "template", + util.AsEntryXpath([]string{o.Template.Template}), + "config", + "devices", + util.AsEntryXpath([]string{o.Template.NgfwDevice}), + } + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return nil, fmt.Errorf("TemplateStack is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.PanoramaDevice}), + "template-stack", + util.AsEntryXpath([]string{o.TemplateStack.TemplateStack}), + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.NgfwDevice}), + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/network/interface/aggregate/service.go b/network/interface/aggregate/service.go new file mode 100644 index 00000000..26342609 --- /dev/null +++ b/network/interface/aggregate/service.go @@ -0,0 +1,281 @@ +package aggregate + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/network/interface/ethernet/entry.go b/network/interface/ethernet/entry.go index 9d8dd903..d11c8b58 100644 --- a/network/interface/ethernet/entry.go +++ b/network/interface/ethernet/entry.go @@ -19,34 +19,63 @@ var ( ) type Entry struct { - Name string - Comment *string - LinkDuplex *string - LinkSpeed *string - LinkState *string - Poe *Poe - Ha *Ha - Layer3 *Layer3 - Tap *Tap + Name string + Comment *string + Lacp *Lacp + LinkDuplex *string + LinkSpeed *string + LinkState *string + Poe *Poe + AggregateGroup *string + DecryptMirror *DecryptMirror + Ha *Ha + Layer2 *Layer2 + Layer3 *Layer3 + LogCard *LogCard + Tap *Tap + VirtualWire *VirtualWire Misc map[string][]generic.Xml } +type DecryptMirror struct { +} type Ha struct { } +type Lacp struct { + PortPriority *int64 +} +type Layer2 struct { + Lldp *Layer2Lldp + NetflowProfile *string +} +type Layer2Lldp struct { + Enable *bool + HighAvailability *Layer2LldpHighAvailability + Profile *string +} +type Layer2LldpHighAvailability struct { + PassivePreNegotiation *bool +} type Layer3 struct { AdjustTcpMss *Layer3AdjustTcpMss Arp []Layer3Arp Bonjour *Layer3Bonjour + ClusterInterconnect *bool + DdnsConfig *Layer3DdnsConfig + DecryptForward *bool + DfIgnore *bool DhcpClient *Layer3DhcpClient InterfaceManagementProfile *string - Ips []Layer3Ips + Ip []Layer3Ip Ipv6 *Layer3Ipv6 Lldp *Layer3Lldp Mtu *int64 - NdpProxy *bool + NdpProxy *Layer3NdpProxy NetflowProfile *string + Pppoe *Layer3Pppoe SdwanLinkSettings *Layer3SdwanLinkSettings + TrafficInterconnect *bool UntaggedSubInterface *bool } type Layer3AdjustTcpMss struct { @@ -59,7 +88,23 @@ type Layer3Arp struct { Name string } type Layer3Bonjour struct { - Enable *bool + Enable *bool + GroupId *int64 + TtlCheck *bool +} +type Layer3DdnsConfig struct { + DdnsCertProfile *string + DdnsEnabled *bool + DdnsHostname *string + DdnsIp []string + DdnsIpv6 []string + DdnsUpdateInterval *int64 + DdnsVendor *string + DdnsVendorConfig []Layer3DdnsConfigDdnsVendorConfig +} +type Layer3DdnsConfigDdnsVendorConfig struct { + Name string + Value *string } type Layer3DhcpClient struct { CreateDefaultRoute *bool @@ -71,63 +116,235 @@ type Layer3DhcpClientSendHostname struct { Enable *bool Hostname *string } -type Layer3Ips struct { +type Layer3Ip struct { Name string SdwanGateway *string } type Layer3Ipv6 struct { - Addresses []Layer3Ipv6Addresses - DnsServer *Layer3Ipv6DnsServer + Address []Layer3Ipv6Address + DhcpClient *Layer3Ipv6DhcpClient Enabled *bool + Inherited *Layer3Ipv6Inherited InterfaceId *string NeighborDiscovery *Layer3Ipv6NeighborDiscovery } -type Layer3Ipv6Addresses struct { - Advertise *Layer3Ipv6AddressesAdvertise - Anycast *string +type Layer3Ipv6Address struct { + Advertise *Layer3Ipv6AddressAdvertise + Anycast *Layer3Ipv6AddressAnycast EnableOnInterface *bool Name string - Prefix *string + Prefix *Layer3Ipv6AddressPrefix } -type Layer3Ipv6AddressesAdvertise struct { +type Layer3Ipv6AddressAdvertise struct { AutoConfigFlag *bool Enable *bool OnlinkFlag *bool PreferredLifetime *string ValidLifetime *string } -type Layer3Ipv6DnsServer struct { - DnsSupport *Layer3Ipv6DnsServerDnsSupport - Enable *bool - Source *Layer3Ipv6DnsServerSource +type Layer3Ipv6AddressAnycast struct { +} +type Layer3Ipv6AddressPrefix struct { +} +type Layer3Ipv6DhcpClient struct { + AcceptRaRoute *bool + DefaultRouteMetric *int64 + Enable *bool + NeighborDiscovery *Layer3Ipv6DhcpClientNeighborDiscovery + Preference *string + PrefixDelegation *Layer3Ipv6DhcpClientPrefixDelegation + V6Options *Layer3Ipv6DhcpClientV6Options +} +type Layer3Ipv6DhcpClientNeighborDiscovery struct { + DadAttempts *int64 + DnsServer *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer + DnsSuffix *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix + EnableDad *bool + EnableNdpMonitor *bool + Neighbor []Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor + NsInterval *int64 + ReachableTime *int64 +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer struct { + Enable *bool + Source *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource struct { + Dhcpv6 *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6 + Manual *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6 struct { +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual struct { + Server []Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer } -type Layer3Ipv6DnsServerDnsSupport struct { +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer struct { + Lifetime *int64 + Name string +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix struct { Enable *bool - Server []Layer3Ipv6DnsServerDnsSupportServer - Suffix []Layer3Ipv6DnsServerDnsSupportSuffix + Source *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource struct { + Dhcpv6 *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6 + Manual *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual } -type Layer3Ipv6DnsServerDnsSupportServer struct { +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6 struct { +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual struct { + Suffix []Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix struct { Lifetime *int64 Name string } -type Layer3Ipv6DnsServerDnsSupportSuffix struct { +type Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor struct { + HwAddress *string + Name string +} +type Layer3Ipv6DhcpClientPrefixDelegation struct { + Enable *Layer3Ipv6DhcpClientPrefixDelegationEnable +} +type Layer3Ipv6DhcpClientPrefixDelegationEnable struct { + No *Layer3Ipv6DhcpClientPrefixDelegationEnableNo + Yes *Layer3Ipv6DhcpClientPrefixDelegationEnableYes +} +type Layer3Ipv6DhcpClientPrefixDelegationEnableNo struct { +} +type Layer3Ipv6DhcpClientPrefixDelegationEnableYes struct { + PfxPoolName *string + PrefixLen *int64 + PrefixLenHint *bool +} +type Layer3Ipv6DhcpClientV6Options struct { + DuidType *string + Enable *Layer3Ipv6DhcpClientV6OptionsEnable + RapidCommit *bool + SupportSrvrReconfig *bool +} +type Layer3Ipv6DhcpClientV6OptionsEnable struct { + No *Layer3Ipv6DhcpClientV6OptionsEnableNo + Yes *Layer3Ipv6DhcpClientV6OptionsEnableYes +} +type Layer3Ipv6DhcpClientV6OptionsEnableNo struct { +} +type Layer3Ipv6DhcpClientV6OptionsEnableYes struct { + NonTempAddr *bool + TempAddr *bool +} +type Layer3Ipv6Inherited struct { + AssignAddr []Layer3Ipv6InheritedAssignAddr + Enable *bool + NeighborDiscovery *Layer3Ipv6InheritedNeighborDiscovery +} +type Layer3Ipv6InheritedAssignAddr struct { + Name string + Type *Layer3Ipv6InheritedAssignAddrType +} +type Layer3Ipv6InheritedAssignAddrType struct { + Gua *Layer3Ipv6InheritedAssignAddrTypeGua + Ula *Layer3Ipv6InheritedAssignAddrTypeUla +} +type Layer3Ipv6InheritedAssignAddrTypeGua struct { + Advertise *Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise + EnableOnInterface *bool + PoolType *Layer3Ipv6InheritedAssignAddrTypeGuaPoolType + PrefixPool *string +} +type Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise struct { + AutoConfigFlag *bool + Enable *bool + OnlinkFlag *bool +} +type Layer3Ipv6InheritedAssignAddrTypeGuaPoolType struct { + Dynamic *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic + DynamicId *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId +} +type Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic struct { +} +type Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId struct { + Identifier *int64 +} +type Layer3Ipv6InheritedAssignAddrTypeUla struct { + Address *string + Advertise *Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise + Anycast *bool + EnableOnInterface *bool + Prefix *bool +} +type Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise struct { + AutoConfigFlag *bool + Enable *bool + OnlinkFlag *bool + PreferredLifetime *string + ValidLifetime *string +} +type Layer3Ipv6InheritedNeighborDiscovery struct { + DadAttempts *int64 + DnsServer *Layer3Ipv6InheritedNeighborDiscoveryDnsServer + DnsSuffix *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix + EnableDad *bool + EnableNdpMonitor *bool + Neighbor []Layer3Ipv6InheritedNeighborDiscoveryNeighbor + NsInterval *int64 + ReachableTime *int64 + RouterAdvertisement *Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServer struct { + Enable *bool + Source *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource struct { + Dhcpv6 *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6 + Manual *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6 struct { + PrefixPool *string +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual struct { + Server []Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer struct { Lifetime *int64 Name string } -type Layer3Ipv6DnsServerSource struct { - Dhcpv6 *Layer3Ipv6DnsServerSourceDhcpv6 - Manual *Layer3Ipv6DnsServerSourceManual +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix struct { + Enable *bool + Source *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource struct { + Dhcpv6 *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6 + Manual *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual } -type Layer3Ipv6DnsServerSourceDhcpv6 struct { +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6 struct { PrefixPool *string } -type Layer3Ipv6DnsServerSourceManual struct { - Suffix []Layer3Ipv6DnsServerSourceManualSuffix +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual struct { + Suffix []Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix } -type Layer3Ipv6DnsServerSourceManualSuffix struct { +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix struct { Lifetime *int64 Name string } +type Layer3Ipv6InheritedNeighborDiscoveryNeighbor struct { + HwAddress *string + Name string +} +type Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement struct { + Enable *bool + EnableConsistencyCheck *bool + HopLimit *string + Lifetime *int64 + LinkMtu *string + ManagedFlag *bool + MaxInterval *int64 + MinInterval *int64 + OtherFlag *bool + ReachableTime *string + RetransmissionTimer *string + RouterPreference *string +} type Layer3Ipv6NeighborDiscovery struct { DadAttempts *int64 EnableDad *bool @@ -142,6 +359,7 @@ type Layer3Ipv6NeighborDiscoveryNeighbor struct { Name string } type Layer3Ipv6NeighborDiscoveryRouterAdvertisement struct { + DnsSupport *Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport Enable *bool EnableConsistencyCheck *bool HopLimit *string @@ -155,9 +373,52 @@ type Layer3Ipv6NeighborDiscoveryRouterAdvertisement struct { RetransmissionTimer *string RouterPreference *string } +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport struct { + Enable *bool + Server []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer + Suffix []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer struct { + Lifetime *int64 + Name string +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix struct { + Lifetime *int64 + Name string +} type Layer3Lldp struct { - Enable *bool - Profile *string + Enable *bool + HighAvailability *Layer3LldpHighAvailability + Profile *string +} +type Layer3LldpHighAvailability struct { + PassivePreNegotiation *bool +} +type Layer3NdpProxy struct { + Address []Layer3NdpProxyAddress + Enabled *bool +} +type Layer3NdpProxyAddress struct { + Name string + Negate *bool +} +type Layer3Pppoe struct { + AccessConcentrator *string + Authentication *string + CreateDefaultRoute *bool + DefaultRouteMetric *int64 + Enable *bool + Passive *Layer3PppoePassive + Password *string + Service *string + StaticAddress *Layer3PppoeStaticAddress + Username *string +} +type Layer3PppoePassive struct { + Enable *bool +} +type Layer3PppoeStaticAddress struct { + Ip *string } type Layer3SdwanLinkSettings struct { Enable *bool @@ -166,51 +427,144 @@ type Layer3SdwanLinkSettings struct { } type Layer3SdwanLinkSettingsUpstreamNat struct { Enable *bool - StaticIp *string + Ddns *Layer3SdwanLinkSettingsUpstreamNatDdns + StaticIp *Layer3SdwanLinkSettingsUpstreamNatStaticIp +} +type Layer3SdwanLinkSettingsUpstreamNatDdns struct { +} +type Layer3SdwanLinkSettingsUpstreamNatStaticIp struct { + Fqdn *string + IpAddress *string +} +type LogCard struct { + DefaultGateway *string + IpAddress *string + Ipv6Address *string + Ipv6DefaultGateway *string + Netmask *string } type Poe struct { - Enabled *bool - ReservedPower *int64 + PoeEnabled *bool + PoeRsvdPwr *int64 } type Tap struct { NetflowProfile *string } +type VirtualWire struct { + Lacp *VirtualWireLacp + Lldp *VirtualWireLldp + NetflowProfile *string +} +type VirtualWireLacp struct { + HighAvailability *VirtualWireLacpHighAvailability +} +type VirtualWireLacpHighAvailability struct { + PassivePreNegotiation *bool +} +type VirtualWireLldp struct { + Enable *bool + HighAvailability *VirtualWireLldpHighAvailability + Profile *string +} +type VirtualWireLldpHighAvailability struct { + PassivePreNegotiation *bool +} type entryXmlContainer struct { Answer []entryXml `xml:"entry"` } +type entryXmlContainer_11_0_2 struct { + Answer []entryXml_11_0_2 `xml:"entry"` +} type entryXml struct { - XMLName xml.Name `xml:"entry"` - Name string `xml:"name,attr"` - Comment *string `xml:"comment,omitempty"` - LinkDuplex *string `xml:"link-duplex,omitempty"` - LinkSpeed *string `xml:"link-speed,omitempty"` - LinkState *string `xml:"link-state,omitempty"` - Poe *PoeXml - Ha *HaXml `xml:"ha,omitempty"` - Layer3 *Layer3Xml `xml:"layer3,omitempty"` - Tap *TapXml `xml:"tap,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Comment *string `xml:"comment,omitempty"` + Lacp *LacpXml `xml:"lacp,omitempty"` + LinkDuplex *string `xml:"link-duplex,omitempty"` + LinkSpeed *string `xml:"link-speed,omitempty"` + LinkState *string `xml:"link-state,omitempty"` + Poe *PoeXml `xml:"poe,omitempty"` + AggregateGroup *string `xml:"aggregate-group,omitempty"` + DecryptMirror *DecryptMirrorXml `xml:"decrypt-mirror,omitempty"` + Ha *HaXml `xml:"ha,omitempty"` + Layer2 *Layer2Xml `xml:"layer2,omitempty"` + Layer3 *Layer3Xml `xml:"layer3,omitempty"` + LogCard *LogCardXml `xml:"log-card,omitempty"` + Tap *TapXml `xml:"tap,omitempty"` + VirtualWire *VirtualWireXml `xml:"virtual-wire,omitempty"` Misc []generic.Xml `xml:",any"` } +type entryXml_11_0_2 struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Comment *string `xml:"comment,omitempty"` + Lacp *LacpXml_11_0_2 `xml:"lacp,omitempty"` + LinkDuplex *string `xml:"link-duplex,omitempty"` + LinkSpeed *string `xml:"link-speed,omitempty"` + LinkState *string `xml:"link-state,omitempty"` + Poe *PoeXml_11_0_2 `xml:"poe,omitempty"` + AggregateGroup *string `xml:"aggregate-group,omitempty"` + DecryptMirror *DecryptMirrorXml_11_0_2 `xml:"decrypt-mirror,omitempty"` + Ha *HaXml_11_0_2 `xml:"ha,omitempty"` + Layer2 *Layer2Xml_11_0_2 `xml:"layer2,omitempty"` + Layer3 *Layer3Xml_11_0_2 `xml:"layer3,omitempty"` + LogCard *LogCardXml_11_0_2 `xml:"log-card,omitempty"` + Tap *TapXml_11_0_2 `xml:"tap,omitempty"` + VirtualWire *VirtualWireXml_11_0_2 `xml:"virtual-wire,omitempty"` + Misc []generic.Xml `xml:",any"` +} +type DecryptMirrorXml struct { + Misc []generic.Xml `xml:",any"` +} type HaXml struct { Misc []generic.Xml `xml:",any"` } +type LacpXml struct { + PortPriority *int64 `xml:"port-priority,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer2Xml struct { + Lldp *Layer2LldpXml `xml:"lldp,omitempty"` + NetflowProfile *string `xml:"netflow-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer2LldpXml struct { + Enable *string `xml:"enable,omitempty"` + HighAvailability *Layer2LldpHighAvailabilityXml `xml:"high-availability,omitempty"` + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer2LldpHighAvailabilityXml struct { + PassivePreNegotiation *string `xml:"passive-pre-negotiation,omitempty"` + + Misc []generic.Xml `xml:",any"` +} type Layer3Xml struct { AdjustTcpMss *Layer3AdjustTcpMssXml `xml:"adjust-tcp-mss,omitempty"` Arp []Layer3ArpXml `xml:"arp>entry,omitempty"` Bonjour *Layer3BonjourXml `xml:"bonjour,omitempty"` + ClusterInterconnect *string `xml:"cluster-interconnect,omitempty"` + DdnsConfig *Layer3DdnsConfigXml `xml:"ddns-config,omitempty"` + DecryptForward *string `xml:"decrypt-forward,omitempty"` + DfIgnore *string `xml:"df-ignore,omitempty"` DhcpClient *Layer3DhcpClientXml `xml:"dhcp-client,omitempty"` InterfaceManagementProfile *string `xml:"interface-management-profile,omitempty"` - Ips []Layer3IpsXml `xml:"ip>entry,omitempty"` + Ip []Layer3IpXml `xml:"ip>entry,omitempty"` Ipv6 *Layer3Ipv6Xml `xml:"ipv6,omitempty"` Lldp *Layer3LldpXml `xml:"lldp,omitempty"` Mtu *int64 `xml:"mtu,omitempty"` - NdpProxy *string `xml:"ndp-proxy>enabled,omitempty"` + NdpProxy *Layer3NdpProxyXml `xml:"ndp-proxy,omitempty"` NetflowProfile *string `xml:"netflow-profile,omitempty"` + Pppoe *Layer3PppoeXml `xml:"pppoe,omitempty"` SdwanLinkSettings *Layer3SdwanLinkSettingsXml `xml:"sdwan-link-settings,omitempty"` + TrafficInterconnect *string `xml:"traffic-interconnect,omitempty"` UntaggedSubInterface *string `xml:"untagged-sub-interface,omitempty"` Misc []generic.Xml `xml:",any"` @@ -230,7 +584,28 @@ type Layer3ArpXml struct { Misc []generic.Xml `xml:",any"` } type Layer3BonjourXml struct { - Enable *string + Enable *string `xml:"enable,omitempty"` + GroupId *int64 `xml:"group-id,omitempty"` + TtlCheck *string `xml:"ttl-check,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3DdnsConfigXml struct { + DdnsCertProfile *string `xml:"ddns-cert-profile,omitempty"` + DdnsEnabled *string `xml:"ddns-enabled,omitempty"` + DdnsHostname *string `xml:"ddns-hostname,omitempty"` + DdnsIp *util.MemberType `xml:"ddns-ip,omitempty"` + DdnsIpv6 *util.MemberType `xml:"ddns-ipv6,omitempty"` + DdnsUpdateInterval *int64 `xml:"ddns-update-interval,omitempty"` + DdnsVendor *string `xml:"ddns-vendor,omitempty"` + DdnsVendorConfig []Layer3DdnsConfigDdnsVendorConfigXml `xml:"ddns-vendor-config>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3DdnsConfigDdnsVendorConfigXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Value *string `xml:"value,omitempty"` Misc []generic.Xml `xml:",any"` } @@ -248,7 +623,7 @@ type Layer3DhcpClientSendHostnameXml struct { Misc []generic.Xml `xml:",any"` } -type Layer3IpsXml struct { +type Layer3IpXml struct { XMLName xml.Name `xml:"entry"` Name string `xml:"name,attr"` SdwanGateway *string `xml:"sdwan-gateway,omitempty"` @@ -256,25 +631,26 @@ type Layer3IpsXml struct { Misc []generic.Xml `xml:",any"` } type Layer3Ipv6Xml struct { - Addresses []Layer3Ipv6AddressesXml `xml:"address>entry,omitempty"` - DnsServer *Layer3Ipv6DnsServerXml `xml:"dns-server,omitempty"` + Address []Layer3Ipv6AddressXml `xml:"address>entry,omitempty"` + DhcpClient *Layer3Ipv6DhcpClientXml `xml:"dhcp-client,omitempty"` Enabled *string `xml:"enabled,omitempty"` + Inherited *Layer3Ipv6InheritedXml `xml:"inherited,omitempty"` InterfaceId *string `xml:"interface-id,omitempty"` NeighborDiscovery *Layer3Ipv6NeighborDiscoveryXml `xml:"neighbor-discovery,omitempty"` Misc []generic.Xml `xml:",any"` } -type Layer3Ipv6AddressesXml struct { - Advertise *Layer3Ipv6AddressesAdvertiseXml `xml:"advertise,omitempty"` - Anycast *string `xml:"anycast,omitempty"` - EnableOnInterface *string `xml:"enable-on-interface,omitempty"` - XMLName xml.Name `xml:"entry"` - Name string `xml:"name,attr"` - Prefix *string `xml:"prefix,omitempty"` +type Layer3Ipv6AddressXml struct { + Advertise *Layer3Ipv6AddressAdvertiseXml `xml:"advertise,omitempty"` + Anycast *Layer3Ipv6AddressAnycastXml `xml:"anycast,omitempty"` + EnableOnInterface *string `xml:"enable-on-interface,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Prefix *Layer3Ipv6AddressPrefixXml `xml:"prefix,omitempty"` Misc []generic.Xml `xml:",any"` } -type Layer3Ipv6AddressesAdvertiseXml struct { +type Layer3Ipv6AddressAdvertiseXml struct { AutoConfigFlag *string `xml:"auto-config-flag,omitempty"` Enable *string `xml:"enable,omitempty"` OnlinkFlag *string `xml:"onlink-flag,omitempty"` @@ -283,1091 +659,6925 @@ type Layer3Ipv6AddressesAdvertiseXml struct { Misc []generic.Xml `xml:",any"` } -type Layer3Ipv6DnsServerXml struct { - DnsSupport *Layer3Ipv6DnsServerDnsSupportXml `xml:"dns-support,omitempty"` - Enable *string `xml:"enable,omitempty"` - Source *Layer3Ipv6DnsServerSourceXml `xml:"source,omitempty"` +type Layer3Ipv6AddressAnycastXml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6AddressPrefixXml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientXml struct { + AcceptRaRoute *string `xml:"accept-ra-route,omitempty"` + DefaultRouteMetric *int64 `xml:"default-route-metric,omitempty"` + Enable *string `xml:"enable,omitempty"` + NeighborDiscovery *Layer3Ipv6DhcpClientNeighborDiscoveryXml `xml:"neighbor-discovery,omitempty"` + Preference *string `xml:"preference,omitempty"` + PrefixDelegation *Layer3Ipv6DhcpClientPrefixDelegationXml `xml:"prefix-delegation,omitempty"` + V6Options *Layer3Ipv6DhcpClientV6OptionsXml `xml:"v6-options,omitempty"` Misc []generic.Xml `xml:",any"` } -type Layer3Ipv6DnsServerDnsSupportXml struct { - Enable *string - Server []Layer3Ipv6DnsServerDnsSupportServerXml `xml:"server>entry,omitempty"` - Suffix []Layer3Ipv6DnsServerDnsSupportSuffixXml `xml:"suffix>entry,omitempty"` +type Layer3Ipv6DhcpClientNeighborDiscoveryXml struct { + DadAttempts *int64 `xml:"dad-attempts,omitempty"` + DnsServer *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerXml `xml:"dns-server,omitempty"` + DnsSuffix *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixXml `xml:"dns-suffix,omitempty"` + EnableDad *string `xml:"enable-dad,omitempty"` + EnableNdpMonitor *string `xml:"enable-ndp-monitor,omitempty"` + Neighbor []Layer3Ipv6DhcpClientNeighborDiscoveryNeighborXml `xml:"neighbor>entry,omitempty"` + NsInterval *int64 `xml:"ns-interval,omitempty"` + ReachableTime *int64 `xml:"reachable-time,omitempty"` Misc []generic.Xml `xml:",any"` } -type Layer3Ipv6DnsServerDnsSupportServerXml struct { - Lifetime *int64 - XMLName xml.Name `xml:"entry"` - Name string `xml:"name,attr"` +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerXml struct { + Enable *string `xml:"enable,omitempty"` + Source *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceXml `xml:"source,omitempty"` Misc []generic.Xml `xml:",any"` } -type Layer3Ipv6DnsServerDnsSupportSuffixXml struct { - Lifetime *int64 +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceXml struct { + Dhcpv6 *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6Xml `xml:"dhcpv6,omitempty"` + Manual *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualXml `xml:"manual,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6Xml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualXml struct { + Server []Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml `xml:"server>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` XMLName xml.Name `xml:"entry"` Name string `xml:"name,attr"` Misc []generic.Xml `xml:",any"` } -type Layer3Ipv6DnsServerSourceXml struct { - Dhcpv6 *Layer3Ipv6DnsServerSourceDhcpv6Xml `xml:"dhcpv6,omitempty"` - Manual *Layer3Ipv6DnsServerSourceManualXml `xml:"manual,omitempty"` +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixXml struct { + Enable *string `xml:"enable,omitempty"` + Source *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceXml `xml:"source,omitempty"` Misc []generic.Xml `xml:",any"` } -type Layer3Ipv6DnsServerSourceDhcpv6Xml struct { - PrefixPool *string `xml:"prefix-pool,omitempty"` +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceXml struct { + Dhcpv6 *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6Xml `xml:"dhcpv6,omitempty"` + Manual *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualXml `xml:"manual,omitempty"` Misc []generic.Xml `xml:",any"` } -type Layer3Ipv6DnsServerSourceManualXml struct { - Suffix []Layer3Ipv6DnsServerSourceManualSuffixXml `xml:"suffix>entry,omitempty"` +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6Xml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualXml struct { + Suffix []Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml `xml:"suffix>entry,omitempty"` Misc []generic.Xml `xml:",any"` } -type Layer3Ipv6DnsServerSourceManualSuffixXml struct { +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml struct { Lifetime *int64 `xml:"lifetime,omitempty"` XMLName xml.Name `xml:"entry"` Name string `xml:"name,attr"` Misc []generic.Xml `xml:",any"` } -type Layer3Ipv6NeighborDiscoveryXml struct { - DadAttempts *int64 `xml:"dad-attempts,omitempty"` - EnableDad *string `xml:"enable-dad,omitempty"` - EnableNdpMonitor *string `xml:"enable-ndp-monitor,omitempty"` - Neighbor []Layer3Ipv6NeighborDiscoveryNeighborXml `xml:"neighbor>entry,omitempty"` - NsInterval *int64 `xml:"ns-interval,omitempty"` - ReachableTime *int64 `xml:"reachable-time,omitempty"` - RouterAdvertisement *Layer3Ipv6NeighborDiscoveryRouterAdvertisementXml `xml:"router-advertisement,omitempty"` - - Misc []generic.Xml `xml:",any"` -} -type Layer3Ipv6NeighborDiscoveryNeighborXml struct { +type Layer3Ipv6DhcpClientNeighborDiscoveryNeighborXml struct { HwAddress *string `xml:"hw-address,omitempty"` XMLName xml.Name `xml:"entry"` Name string `xml:"name,attr"` Misc []generic.Xml `xml:",any"` } -type Layer3Ipv6NeighborDiscoveryRouterAdvertisementXml struct { - Enable *string `xml:"enable,omitempty"` - EnableConsistencyCheck *string `xml:"enable-consistency-check,omitempty"` - HopLimit *string `xml:"hop-limit,omitempty"` - Lifetime *int64 `xml:"lifetime,omitempty"` - LinkMtu *string `xml:"link-mtu,omitempty"` - ManagedFlag *string `xml:"managed-flag,omitempty"` - MaxInterval *int64 `xml:"max-interval,omitempty"` - MinInterval *int64 `xml:"min-interval,omitempty"` - OtherFlag *string `xml:"other-flag,omitempty"` - ReachableTime *string `xml:"reachable-time,omitempty"` - RetransmissionTimer *string `xml:"retransmission-timer,omitempty"` - RouterPreference *string `xml:"router-preference,omitempty"` +type Layer3Ipv6DhcpClientPrefixDelegationXml struct { + Enable *Layer3Ipv6DhcpClientPrefixDelegationEnableXml `xml:"enable,omitempty"` Misc []generic.Xml `xml:",any"` } -type Layer3LldpXml struct { - Enable *string `xml:"enable,omitempty"` - Profile *string `xml:"profile,omitempty"` +type Layer3Ipv6DhcpClientPrefixDelegationEnableXml struct { + No *Layer3Ipv6DhcpClientPrefixDelegationEnableNoXml `xml:"no,omitempty"` + Yes *Layer3Ipv6DhcpClientPrefixDelegationEnableYesXml `xml:"yes,omitempty"` Misc []generic.Xml `xml:",any"` } -type Layer3SdwanLinkSettingsXml struct { - Enable *string `xml:"enable,omitempty"` - SdwanInterfaceProfile *string `xml:"sdwan-interface-profile,omitempty"` - UpstreamNat *Layer3SdwanLinkSettingsUpstreamNatXml `xml:"upstream-nat,omitempty"` +type Layer3Ipv6DhcpClientPrefixDelegationEnableNoXml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientPrefixDelegationEnableYesXml struct { + PfxPoolName *string `xml:"pfx-pool-name,omitempty"` + PrefixLen *int64 `xml:"prefix-len,omitempty"` + PrefixLenHint *string `xml:"prefix-len-hint,omitempty"` Misc []generic.Xml `xml:",any"` } -type Layer3SdwanLinkSettingsUpstreamNatXml struct { - Enable *string `xml:"enable,omitempty"` - StaticIp *string `xml:"static-ip>ip-address,omitempty"` +type Layer3Ipv6DhcpClientV6OptionsXml struct { + DuidType *string `xml:"duid-type,omitempty"` + Enable *Layer3Ipv6DhcpClientV6OptionsEnableXml `xml:"enable,omitempty"` + RapidCommit *string `xml:"rapid-commit,omitempty"` + SupportSrvrReconfig *string `xml:"support-srvr-reconfig,omitempty"` Misc []generic.Xml `xml:",any"` } -type PoeXml struct { - Enabled *string `xml:"poe-enabled,omitempty"` - ReservedPower *int64 `xml:"poe-rsvd-pwr,omitempty"` +type Layer3Ipv6DhcpClientV6OptionsEnableXml struct { + No *Layer3Ipv6DhcpClientV6OptionsEnableNoXml `xml:"no,omitempty"` + Yes *Layer3Ipv6DhcpClientV6OptionsEnableYesXml `xml:"yes,omitempty"` Misc []generic.Xml `xml:",any"` } -type TapXml struct { - NetflowProfile *string `xml:"netflow-profile,omitempty"` +type Layer3Ipv6DhcpClientV6OptionsEnableNoXml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientV6OptionsEnableYesXml struct { + NonTempAddr *string `xml:"non-temp-addr,omitempty"` + TempAddr *string `xml:"temp-addr,omitempty"` Misc []generic.Xml `xml:",any"` } +type Layer3Ipv6InheritedXml struct { + AssignAddr []Layer3Ipv6InheritedAssignAddrXml `xml:"assign-addr>entry,omitempty"` + Enable *string `xml:"enable,omitempty"` + NeighborDiscovery *Layer3Ipv6InheritedNeighborDiscoveryXml `xml:"neighbor-discovery,omitempty"` -func (e *Entry) Field(v string) (any, error) { - if v == "name" || v == "Name" { - return e.Name, nil - } - if v == "comment" || v == "Comment" { - return e.Comment, nil - } - if v == "link_duplex" || v == "LinkDuplex" { - return e.LinkDuplex, nil - } - if v == "link_speed" || v == "LinkSpeed" { - return e.LinkSpeed, nil - } - if v == "link_state" || v == "LinkState" { - return e.LinkState, nil - } - if v == "poe" || v == "Poe" { - return e.Poe, nil - } - if v == "ha" || v == "Ha" { - return e.Ha, nil - } - if v == "layer3" || v == "Layer3" { - return e.Layer3, nil - } - if v == "tap" || v == "Tap" { - return e.Tap, nil - } + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Type *Layer3Ipv6InheritedAssignAddrTypeXml `xml:"type,omitempty"` - return nil, fmt.Errorf("unknown field") + Misc []generic.Xml `xml:",any"` } +type Layer3Ipv6InheritedAssignAddrTypeXml struct { + Gua *Layer3Ipv6InheritedAssignAddrTypeGuaXml `xml:"gua,omitempty"` + Ula *Layer3Ipv6InheritedAssignAddrTypeUlaXml `xml:"ula,omitempty"` -func Versioning(vn version.Number) (Specifier, Normalizer, error) { - return specifyEntry, &entryXmlContainer{}, nil + Misc []generic.Xml `xml:",any"` } +type Layer3Ipv6InheritedAssignAddrTypeGuaXml struct { + Advertise *Layer3Ipv6InheritedAssignAddrTypeGuaAdvertiseXml `xml:"advertise,omitempty"` + EnableOnInterface *string `xml:"enable-on-interface,omitempty"` + PoolType *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeXml `xml:"pool-type,omitempty"` + PrefixPool *string `xml:"prefix-pool,omitempty"` -func specifyEntry(o *Entry) (any, error) { - entry := entryXml{} + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeGuaAdvertiseXml struct { + AutoConfigFlag *string `xml:"auto-config-flag,omitempty"` + Enable *string `xml:"enable,omitempty"` + OnlinkFlag *string `xml:"onlink-flag,omitempty"` - entry.Name = o.Name - entry.Comment = o.Comment - entry.LinkDuplex = o.LinkDuplex - entry.LinkSpeed = o.LinkSpeed - entry.LinkState = o.LinkState - var nestedPoe *PoeXml - if o.Poe != nil { - nestedPoe = &PoeXml{} - if _, ok := o.Misc["Poe"]; ok { - nestedPoe.Misc = o.Misc["Poe"] - } - if o.Poe.ReservedPower != nil { - nestedPoe.ReservedPower = o.Poe.ReservedPower - } - if o.Poe.Enabled != nil { - nestedPoe.Enabled = util.YesNo(o.Poe.Enabled, nil) - } - } - entry.Poe = nestedPoe + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeXml struct { + Dynamic *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicXml `xml:"dynamic,omitempty"` + DynamicId *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicIdXml `xml:"dynamic-id,omitempty"` - var nestedHa *HaXml - if o.Ha != nil { - nestedHa = &HaXml{} - if _, ok := o.Misc["Ha"]; ok { - nestedHa.Misc = o.Misc["Ha"] + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicXml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicIdXml struct { + Identifier *int64 `xml:"identifier,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeUlaXml struct { + Address *string `xml:"address,omitempty"` + Advertise *Layer3Ipv6InheritedAssignAddrTypeUlaAdvertiseXml `xml:"advertise,omitempty"` + Anycast *string `xml:"anycast,omitempty"` + EnableOnInterface *string `xml:"enable-on-interface,omitempty"` + Prefix *string `xml:"prefix,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeUlaAdvertiseXml struct { + AutoConfigFlag *string `xml:"auto-config-flag,omitempty"` + Enable *string `xml:"enable,omitempty"` + OnlinkFlag *string `xml:"onlink-flag,omitempty"` + PreferredLifetime *string `xml:"preferred-lifetime,omitempty"` + ValidLifetime *string `xml:"valid-lifetime,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryXml struct { + DadAttempts *int64 `xml:"dad-attempts,omitempty"` + DnsServer *Layer3Ipv6InheritedNeighborDiscoveryDnsServerXml `xml:"dns-server,omitempty"` + DnsSuffix *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixXml `xml:"dns-suffix,omitempty"` + EnableDad *string `xml:"enable-dad,omitempty"` + EnableNdpMonitor *string `xml:"enable-ndp-monitor,omitempty"` + Neighbor []Layer3Ipv6InheritedNeighborDiscoveryNeighborXml `xml:"neighbor>entry,omitempty"` + NsInterval *int64 `xml:"ns-interval,omitempty"` + ReachableTime *int64 `xml:"reachable-time,omitempty"` + RouterAdvertisement *Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisementXml `xml:"router-advertisement,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerXml struct { + Enable *string `xml:"enable,omitempty"` + Source *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceXml `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceXml struct { + Dhcpv6 *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6Xml `xml:"dhcpv6,omitempty"` + Manual *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualXml `xml:"manual,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6Xml struct { + PrefixPool *string `xml:"prefix-pool,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualXml struct { + Server []Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml `xml:"server>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixXml struct { + Enable *string `xml:"enable,omitempty"` + Source *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceXml `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceXml struct { + Dhcpv6 *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6Xml `xml:"dhcpv6,omitempty"` + Manual *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualXml `xml:"manual,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6Xml struct { + PrefixPool *string `xml:"prefix-pool,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualXml struct { + Suffix []Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml `xml:"suffix>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryNeighborXml struct { + HwAddress *string `xml:"hw-address,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisementXml struct { + Enable *string `xml:"enable,omitempty"` + EnableConsistencyCheck *string `xml:"enable-consistency-check,omitempty"` + HopLimit *string `xml:"hop-limit,omitempty"` + Lifetime *int64 `xml:"lifetime,omitempty"` + LinkMtu *string `xml:"link-mtu,omitempty"` + ManagedFlag *string `xml:"managed-flag,omitempty"` + MaxInterval *int64 `xml:"max-interval,omitempty"` + MinInterval *int64 `xml:"min-interval,omitempty"` + OtherFlag *string `xml:"other-flag,omitempty"` + ReachableTime *string `xml:"reachable-time,omitempty"` + RetransmissionTimer *string `xml:"retransmission-timer,omitempty"` + RouterPreference *string `xml:"router-preference,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryXml struct { + DadAttempts *int64 `xml:"dad-attempts,omitempty"` + EnableDad *string `xml:"enable-dad,omitempty"` + EnableNdpMonitor *string `xml:"enable-ndp-monitor,omitempty"` + Neighbor []Layer3Ipv6NeighborDiscoveryNeighborXml `xml:"neighbor>entry,omitempty"` + NsInterval *int64 `xml:"ns-interval,omitempty"` + ReachableTime *int64 `xml:"reachable-time,omitempty"` + RouterAdvertisement *Layer3Ipv6NeighborDiscoveryRouterAdvertisementXml `xml:"router-advertisement,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryNeighborXml struct { + HwAddress *string `xml:"hw-address,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementXml struct { + DnsSupport *Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportXml `xml:"dns-support,omitempty"` + Enable *string `xml:"enable,omitempty"` + EnableConsistencyCheck *string `xml:"enable-consistency-check,omitempty"` + HopLimit *string `xml:"hop-limit,omitempty"` + Lifetime *int64 `xml:"lifetime,omitempty"` + LinkMtu *string `xml:"link-mtu,omitempty"` + ManagedFlag *string `xml:"managed-flag,omitempty"` + MaxInterval *int64 `xml:"max-interval,omitempty"` + MinInterval *int64 `xml:"min-interval,omitempty"` + OtherFlag *string `xml:"other-flag,omitempty"` + ReachableTime *string `xml:"reachable-time,omitempty"` + RetransmissionTimer *string `xml:"retransmission-timer,omitempty"` + RouterPreference *string `xml:"router-preference,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportXml struct { + Enable *string `xml:"enable,omitempty"` + Server []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml `xml:"server>entry,omitempty"` + Suffix []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml `xml:"suffix>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3LldpXml struct { + Enable *string `xml:"enable,omitempty"` + HighAvailability *Layer3LldpHighAvailabilityXml `xml:"high-availability,omitempty"` + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3LldpHighAvailabilityXml struct { + PassivePreNegotiation *string `xml:"passive-pre-negotiation,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3NdpProxyXml struct { + Address []Layer3NdpProxyAddressXml `xml:"address>entry,omitempty"` + Enabled *string `xml:"enabled,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3NdpProxyAddressXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Negate *string `xml:"negate,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3PppoeXml struct { + AccessConcentrator *string `xml:"access-concentrator,omitempty"` + Authentication *string `xml:"authentication,omitempty"` + CreateDefaultRoute *string `xml:"create-default-route,omitempty"` + DefaultRouteMetric *int64 `xml:"default-route-metric,omitempty"` + Enable *string `xml:"enable,omitempty"` + Passive *Layer3PppoePassiveXml `xml:"passive,omitempty"` + Password *string `xml:"password,omitempty"` + Service *string `xml:"service,omitempty"` + StaticAddress *Layer3PppoeStaticAddressXml `xml:"static-address,omitempty"` + Username *string `xml:"username,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3PppoePassiveXml struct { + Enable *string `xml:"enable,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3PppoeStaticAddressXml struct { + Ip *string `xml:"ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3SdwanLinkSettingsXml struct { + Enable *string `xml:"enable,omitempty"` + SdwanInterfaceProfile *string `xml:"sdwan-interface-profile,omitempty"` + UpstreamNat *Layer3SdwanLinkSettingsUpstreamNatXml `xml:"upstream-nat,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3SdwanLinkSettingsUpstreamNatXml struct { + Enable *string `xml:"enable,omitempty"` + Ddns *Layer3SdwanLinkSettingsUpstreamNatDdnsXml `xml:"ddns,omitempty"` + StaticIp *Layer3SdwanLinkSettingsUpstreamNatStaticIpXml `xml:"static-ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3SdwanLinkSettingsUpstreamNatDdnsXml struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3SdwanLinkSettingsUpstreamNatStaticIpXml struct { + Fqdn *string `xml:"fqdn,omitempty"` + IpAddress *string `xml:"ip-address,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type LogCardXml struct { + DefaultGateway *string `xml:"default-gateway,omitempty"` + IpAddress *string `xml:"ip-address,omitempty"` + Ipv6Address *string `xml:"ipv6-address,omitempty"` + Ipv6DefaultGateway *string `xml:"ipv6-default-gateway,omitempty"` + Netmask *string `xml:"netmask,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type PoeXml struct { + PoeEnabled *string `xml:"poe-enabled,omitempty"` + PoeRsvdPwr *int64 `xml:"poe-rsvd-pwr,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TapXml struct { + NetflowProfile *string `xml:"netflow-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type VirtualWireXml struct { + Lacp *VirtualWireLacpXml `xml:"lacp,omitempty"` + Lldp *VirtualWireLldpXml `xml:"lldp,omitempty"` + NetflowProfile *string `xml:"netflow-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type VirtualWireLacpXml struct { + HighAvailability *VirtualWireLacpHighAvailabilityXml `xml:"high-availability,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type VirtualWireLacpHighAvailabilityXml struct { + PassivePreNegotiation *string `xml:"passive-pre-negotiation,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type VirtualWireLldpXml struct { + Enable *string `xml:"enable,omitempty"` + HighAvailability *VirtualWireLldpHighAvailabilityXml `xml:"high-availability,omitempty"` + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type VirtualWireLldpHighAvailabilityXml struct { + PassivePreNegotiation *string `xml:"passive-pre-negotiation,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type DecryptMirrorXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type HaXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type LacpXml_11_0_2 struct { + PortPriority *int64 `xml:"port-priority,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer2Xml_11_0_2 struct { + Lldp *Layer2LldpXml_11_0_2 `xml:"lldp,omitempty"` + NetflowProfile *string `xml:"netflow-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer2LldpXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + HighAvailability *Layer2LldpHighAvailabilityXml_11_0_2 `xml:"high-availability,omitempty"` + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer2LldpHighAvailabilityXml_11_0_2 struct { + PassivePreNegotiation *string `xml:"passive-pre-negotiation,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Xml_11_0_2 struct { + AdjustTcpMss *Layer3AdjustTcpMssXml_11_0_2 `xml:"adjust-tcp-mss,omitempty"` + Arp []Layer3ArpXml_11_0_2 `xml:"arp>entry,omitempty"` + Bonjour *Layer3BonjourXml_11_0_2 `xml:"bonjour,omitempty"` + ClusterInterconnect *string `xml:"cluster-interconnect,omitempty"` + DdnsConfig *Layer3DdnsConfigXml_11_0_2 `xml:"ddns-config,omitempty"` + DecryptForward *string `xml:"decrypt-forward,omitempty"` + DfIgnore *string `xml:"df-ignore,omitempty"` + DhcpClient *Layer3DhcpClientXml_11_0_2 `xml:"dhcp-client,omitempty"` + InterfaceManagementProfile *string `xml:"interface-management-profile,omitempty"` + Ip []Layer3IpXml_11_0_2 `xml:"ip>entry,omitempty"` + Ipv6 *Layer3Ipv6Xml_11_0_2 `xml:"ipv6,omitempty"` + Lldp *Layer3LldpXml_11_0_2 `xml:"lldp,omitempty"` + Mtu *int64 `xml:"mtu,omitempty"` + NdpProxy *Layer3NdpProxyXml_11_0_2 `xml:"ndp-proxy,omitempty"` + NetflowProfile *string `xml:"netflow-profile,omitempty"` + Pppoe *Layer3PppoeXml_11_0_2 `xml:"pppoe,omitempty"` + SdwanLinkSettings *Layer3SdwanLinkSettingsXml_11_0_2 `xml:"sdwan-link-settings,omitempty"` + TrafficInterconnect *string `xml:"traffic-interconnect,omitempty"` + UntaggedSubInterface *string `xml:"untagged-sub-interface,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3AdjustTcpMssXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + Ipv4MssAdjustment *int64 `xml:"ipv4-mss-adjustment,omitempty"` + Ipv6MssAdjustment *int64 `xml:"ipv6-mss-adjustment,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3ArpXml_11_0_2 struct { + HwAddress *string `xml:"hw-address,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3BonjourXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + GroupId *int64 `xml:"group-id,omitempty"` + TtlCheck *string `xml:"ttl-check,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3DdnsConfigXml_11_0_2 struct { + DdnsCertProfile *string `xml:"ddns-cert-profile,omitempty"` + DdnsEnabled *string `xml:"ddns-enabled,omitempty"` + DdnsHostname *string `xml:"ddns-hostname,omitempty"` + DdnsIp *util.MemberType `xml:"ddns-ip,omitempty"` + DdnsIpv6 *util.MemberType `xml:"ddns-ipv6,omitempty"` + DdnsUpdateInterval *int64 `xml:"ddns-update-interval,omitempty"` + DdnsVendor *string `xml:"ddns-vendor,omitempty"` + DdnsVendorConfig []Layer3DdnsConfigDdnsVendorConfigXml_11_0_2 `xml:"ddns-vendor-config>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3DdnsConfigDdnsVendorConfigXml_11_0_2 struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Value *string `xml:"value,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3DhcpClientXml_11_0_2 struct { + CreateDefaultRoute *string `xml:"create-default-route,omitempty"` + DefaultRouteMetric *int64 `xml:"default-route-metric,omitempty"` + Enable *string `xml:"enable,omitempty"` + SendHostname *Layer3DhcpClientSendHostnameXml_11_0_2 `xml:"send-hostname,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3DhcpClientSendHostnameXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + Hostname *string `xml:"hostname,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3IpXml_11_0_2 struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + SdwanGateway *string `xml:"sdwan-gateway,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6Xml_11_0_2 struct { + Address []Layer3Ipv6AddressXml_11_0_2 `xml:"address>entry,omitempty"` + DhcpClient *Layer3Ipv6DhcpClientXml_11_0_2 `xml:"dhcp-client,omitempty"` + Enabled *string `xml:"enabled,omitempty"` + Inherited *Layer3Ipv6InheritedXml_11_0_2 `xml:"inherited,omitempty"` + InterfaceId *string `xml:"interface-id,omitempty"` + NeighborDiscovery *Layer3Ipv6NeighborDiscoveryXml_11_0_2 `xml:"neighbor-discovery,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6AddressXml_11_0_2 struct { + Advertise *Layer3Ipv6AddressAdvertiseXml_11_0_2 `xml:"advertise,omitempty"` + Anycast *Layer3Ipv6AddressAnycastXml_11_0_2 `xml:"anycast,omitempty"` + EnableOnInterface *string `xml:"enable-on-interface,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Prefix *Layer3Ipv6AddressPrefixXml_11_0_2 `xml:"prefix,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6AddressAdvertiseXml_11_0_2 struct { + AutoConfigFlag *string `xml:"auto-config-flag,omitempty"` + Enable *string `xml:"enable,omitempty"` + OnlinkFlag *string `xml:"onlink-flag,omitempty"` + PreferredLifetime *string `xml:"preferred-lifetime,omitempty"` + ValidLifetime *string `xml:"valid-lifetime,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6AddressAnycastXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6AddressPrefixXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientXml_11_0_2 struct { + AcceptRaRoute *string `xml:"accept-ra-route,omitempty"` + DefaultRouteMetric *int64 `xml:"default-route-metric,omitempty"` + Enable *string `xml:"enable,omitempty"` + NeighborDiscovery *Layer3Ipv6DhcpClientNeighborDiscoveryXml_11_0_2 `xml:"neighbor-discovery,omitempty"` + Preference *string `xml:"preference,omitempty"` + PrefixDelegation *Layer3Ipv6DhcpClientPrefixDelegationXml_11_0_2 `xml:"prefix-delegation,omitempty"` + V6Options *Layer3Ipv6DhcpClientV6OptionsXml_11_0_2 `xml:"v6-options,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryXml_11_0_2 struct { + DadAttempts *int64 `xml:"dad-attempts,omitempty"` + DnsServer *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerXml_11_0_2 `xml:"dns-server,omitempty"` + DnsSuffix *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixXml_11_0_2 `xml:"dns-suffix,omitempty"` + EnableDad *string `xml:"enable-dad,omitempty"` + EnableNdpMonitor *string `xml:"enable-ndp-monitor,omitempty"` + Neighbor []Layer3Ipv6DhcpClientNeighborDiscoveryNeighborXml_11_0_2 `xml:"neighbor>entry,omitempty"` + NsInterval *int64 `xml:"ns-interval,omitempty"` + ReachableTime *int64 `xml:"reachable-time,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + Source *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceXml_11_0_2 `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceXml_11_0_2 struct { + Dhcpv6 *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6Xml_11_0_2 `xml:"dhcpv6,omitempty"` + Manual *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualXml_11_0_2 `xml:"manual,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6Xml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualXml_11_0_2 struct { + Server []Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml_11_0_2 `xml:"server>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml_11_0_2 struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + Source *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceXml_11_0_2 `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceXml_11_0_2 struct { + Dhcpv6 *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6Xml_11_0_2 `xml:"dhcpv6,omitempty"` + Manual *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualXml_11_0_2 `xml:"manual,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6Xml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualXml_11_0_2 struct { + Suffix []Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml_11_0_2 `xml:"suffix>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml_11_0_2 struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientNeighborDiscoveryNeighborXml_11_0_2 struct { + HwAddress *string `xml:"hw-address,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientPrefixDelegationXml_11_0_2 struct { + Enable *Layer3Ipv6DhcpClientPrefixDelegationEnableXml_11_0_2 `xml:"enable,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientPrefixDelegationEnableXml_11_0_2 struct { + No *Layer3Ipv6DhcpClientPrefixDelegationEnableNoXml_11_0_2 `xml:"no,omitempty"` + Yes *Layer3Ipv6DhcpClientPrefixDelegationEnableYesXml_11_0_2 `xml:"yes,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientPrefixDelegationEnableNoXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientPrefixDelegationEnableYesXml_11_0_2 struct { + PfxPoolName *string `xml:"pfx-pool-name,omitempty"` + PrefixLen *int64 `xml:"prefix-len,omitempty"` + PrefixLenHint *string `xml:"prefix-len-hint,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientV6OptionsXml_11_0_2 struct { + DuidType *string `xml:"duid-type,omitempty"` + Enable *Layer3Ipv6DhcpClientV6OptionsEnableXml_11_0_2 `xml:"enable,omitempty"` + RapidCommit *string `xml:"rapid-commit,omitempty"` + SupportSrvrReconfig *string `xml:"support-srvr-reconfig,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientV6OptionsEnableXml_11_0_2 struct { + No *Layer3Ipv6DhcpClientV6OptionsEnableNoXml_11_0_2 `xml:"no,omitempty"` + Yes *Layer3Ipv6DhcpClientV6OptionsEnableYesXml_11_0_2 `xml:"yes,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientV6OptionsEnableNoXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6DhcpClientV6OptionsEnableYesXml_11_0_2 struct { + NonTempAddr *string `xml:"non-temp-addr,omitempty"` + TempAddr *string `xml:"temp-addr,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedXml_11_0_2 struct { + AssignAddr []Layer3Ipv6InheritedAssignAddrXml_11_0_2 `xml:"assign-addr>entry,omitempty"` + Enable *string `xml:"enable,omitempty"` + NeighborDiscovery *Layer3Ipv6InheritedNeighborDiscoveryXml_11_0_2 `xml:"neighbor-discovery,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrXml_11_0_2 struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Type *Layer3Ipv6InheritedAssignAddrTypeXml_11_0_2 `xml:"type,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeXml_11_0_2 struct { + Gua *Layer3Ipv6InheritedAssignAddrTypeGuaXml_11_0_2 `xml:"gua,omitempty"` + Ula *Layer3Ipv6InheritedAssignAddrTypeUlaXml_11_0_2 `xml:"ula,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeGuaXml_11_0_2 struct { + Advertise *Layer3Ipv6InheritedAssignAddrTypeGuaAdvertiseXml_11_0_2 `xml:"advertise,omitempty"` + EnableOnInterface *string `xml:"enable-on-interface,omitempty"` + PoolType *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeXml_11_0_2 `xml:"pool-type,omitempty"` + PrefixPool *string `xml:"prefix-pool,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeGuaAdvertiseXml_11_0_2 struct { + AutoConfigFlag *string `xml:"auto-config-flag,omitempty"` + Enable *string `xml:"enable,omitempty"` + OnlinkFlag *string `xml:"onlink-flag,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeXml_11_0_2 struct { + Dynamic *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicXml_11_0_2 `xml:"dynamic,omitempty"` + DynamicId *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicIdXml_11_0_2 `xml:"dynamic-id,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicIdXml_11_0_2 struct { + Identifier *int64 `xml:"identifier,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeUlaXml_11_0_2 struct { + Address *string `xml:"address,omitempty"` + Advertise *Layer3Ipv6InheritedAssignAddrTypeUlaAdvertiseXml_11_0_2 `xml:"advertise,omitempty"` + Anycast *string `xml:"anycast,omitempty"` + EnableOnInterface *string `xml:"enable-on-interface,omitempty"` + Prefix *string `xml:"prefix,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedAssignAddrTypeUlaAdvertiseXml_11_0_2 struct { + AutoConfigFlag *string `xml:"auto-config-flag,omitempty"` + Enable *string `xml:"enable,omitempty"` + OnlinkFlag *string `xml:"onlink-flag,omitempty"` + PreferredLifetime *string `xml:"preferred-lifetime,omitempty"` + ValidLifetime *string `xml:"valid-lifetime,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryXml_11_0_2 struct { + DadAttempts *int64 `xml:"dad-attempts,omitempty"` + DnsServer *Layer3Ipv6InheritedNeighborDiscoveryDnsServerXml_11_0_2 `xml:"dns-server,omitempty"` + DnsSuffix *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixXml_11_0_2 `xml:"dns-suffix,omitempty"` + EnableDad *string `xml:"enable-dad,omitempty"` + EnableNdpMonitor *string `xml:"enable-ndp-monitor,omitempty"` + Neighbor []Layer3Ipv6InheritedNeighborDiscoveryNeighborXml_11_0_2 `xml:"neighbor>entry,omitempty"` + NsInterval *int64 `xml:"ns-interval,omitempty"` + ReachableTime *int64 `xml:"reachable-time,omitempty"` + RouterAdvertisement *Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisementXml_11_0_2 `xml:"router-advertisement,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + Source *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceXml_11_0_2 `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceXml_11_0_2 struct { + Dhcpv6 *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6Xml_11_0_2 `xml:"dhcpv6,omitempty"` + Manual *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualXml_11_0_2 `xml:"manual,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6Xml_11_0_2 struct { + PrefixPool *string `xml:"prefix-pool,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualXml_11_0_2 struct { + Server []Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml_11_0_2 `xml:"server>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml_11_0_2 struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + Source *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceXml_11_0_2 `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceXml_11_0_2 struct { + Dhcpv6 *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6Xml_11_0_2 `xml:"dhcpv6,omitempty"` + Manual *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualXml_11_0_2 `xml:"manual,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6Xml_11_0_2 struct { + PrefixPool *string `xml:"prefix-pool,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualXml_11_0_2 struct { + Suffix []Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml_11_0_2 `xml:"suffix>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml_11_0_2 struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryNeighborXml_11_0_2 struct { + HwAddress *string `xml:"hw-address,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisementXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + EnableConsistencyCheck *string `xml:"enable-consistency-check,omitempty"` + HopLimit *string `xml:"hop-limit,omitempty"` + Lifetime *int64 `xml:"lifetime,omitempty"` + LinkMtu *string `xml:"link-mtu,omitempty"` + ManagedFlag *string `xml:"managed-flag,omitempty"` + MaxInterval *int64 `xml:"max-interval,omitempty"` + MinInterval *int64 `xml:"min-interval,omitempty"` + OtherFlag *string `xml:"other-flag,omitempty"` + ReachableTime *string `xml:"reachable-time,omitempty"` + RetransmissionTimer *string `xml:"retransmission-timer,omitempty"` + RouterPreference *string `xml:"router-preference,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryXml_11_0_2 struct { + DadAttempts *int64 `xml:"dad-attempts,omitempty"` + EnableDad *string `xml:"enable-dad,omitempty"` + EnableNdpMonitor *string `xml:"enable-ndp-monitor,omitempty"` + Neighbor []Layer3Ipv6NeighborDiscoveryNeighborXml_11_0_2 `xml:"neighbor>entry,omitempty"` + NsInterval *int64 `xml:"ns-interval,omitempty"` + ReachableTime *int64 `xml:"reachable-time,omitempty"` + RouterAdvertisement *Layer3Ipv6NeighborDiscoveryRouterAdvertisementXml_11_0_2 `xml:"router-advertisement,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryNeighborXml_11_0_2 struct { + HwAddress *string `xml:"hw-address,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementXml_11_0_2 struct { + DnsSupport *Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportXml_11_0_2 `xml:"dns-support,omitempty"` + Enable *string `xml:"enable,omitempty"` + EnableConsistencyCheck *string `xml:"enable-consistency-check,omitempty"` + HopLimit *string `xml:"hop-limit,omitempty"` + Lifetime *int64 `xml:"lifetime,omitempty"` + LinkMtu *string `xml:"link-mtu,omitempty"` + ManagedFlag *string `xml:"managed-flag,omitempty"` + MaxInterval *int64 `xml:"max-interval,omitempty"` + MinInterval *int64 `xml:"min-interval,omitempty"` + OtherFlag *string `xml:"other-flag,omitempty"` + ReachableTime *string `xml:"reachable-time,omitempty"` + RetransmissionTimer *string `xml:"retransmission-timer,omitempty"` + RouterPreference *string `xml:"router-preference,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + Server []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml_11_0_2 `xml:"server>entry,omitempty"` + Suffix []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml_11_0_2 `xml:"suffix>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml_11_0_2 struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml_11_0_2 struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3LldpXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + HighAvailability *Layer3LldpHighAvailabilityXml_11_0_2 `xml:"high-availability,omitempty"` + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3LldpHighAvailabilityXml_11_0_2 struct { + PassivePreNegotiation *string `xml:"passive-pre-negotiation,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3NdpProxyXml_11_0_2 struct { + Address []Layer3NdpProxyAddressXml_11_0_2 `xml:"address>entry,omitempty"` + Enabled *string `xml:"enabled,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3NdpProxyAddressXml_11_0_2 struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Negate *string `xml:"negate,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3PppoeXml_11_0_2 struct { + AccessConcentrator *string `xml:"access-concentrator,omitempty"` + Authentication *string `xml:"authentication,omitempty"` + CreateDefaultRoute *string `xml:"create-default-route,omitempty"` + DefaultRouteMetric *int64 `xml:"default-route-metric,omitempty"` + Enable *string `xml:"enable,omitempty"` + Passive *Layer3PppoePassiveXml_11_0_2 `xml:"passive,omitempty"` + Password *string `xml:"password,omitempty"` + Service *string `xml:"service,omitempty"` + StaticAddress *Layer3PppoeStaticAddressXml_11_0_2 `xml:"static-address,omitempty"` + Username *string `xml:"username,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3PppoePassiveXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3PppoeStaticAddressXml_11_0_2 struct { + Ip *string `xml:"ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3SdwanLinkSettingsXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + SdwanInterfaceProfile *string `xml:"sdwan-interface-profile,omitempty"` + UpstreamNat *Layer3SdwanLinkSettingsUpstreamNatXml_11_0_2 `xml:"upstream-nat,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3SdwanLinkSettingsUpstreamNatXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + Ddns *Layer3SdwanLinkSettingsUpstreamNatDdnsXml_11_0_2 `xml:"ddns,omitempty"` + StaticIp *Layer3SdwanLinkSettingsUpstreamNatStaticIpXml_11_0_2 `xml:"static-ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Layer3SdwanLinkSettingsUpstreamNatDdnsXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type Layer3SdwanLinkSettingsUpstreamNatStaticIpXml_11_0_2 struct { + Fqdn *string `xml:"fqdn,omitempty"` + IpAddress *string `xml:"ip-address,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type LogCardXml_11_0_2 struct { + DefaultGateway *string `xml:"default-gateway,omitempty"` + IpAddress *string `xml:"ip-address,omitempty"` + Ipv6Address *string `xml:"ipv6-address,omitempty"` + Ipv6DefaultGateway *string `xml:"ipv6-default-gateway,omitempty"` + Netmask *string `xml:"netmask,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type PoeXml_11_0_2 struct { + PoeEnabled *string `xml:"poe-enabled,omitempty"` + PoeRsvdPwr *int64 `xml:"poe-rsvd-pwr,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TapXml_11_0_2 struct { + NetflowProfile *string `xml:"netflow-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type VirtualWireXml_11_0_2 struct { + Lacp *VirtualWireLacpXml_11_0_2 `xml:"lacp,omitempty"` + Lldp *VirtualWireLldpXml_11_0_2 `xml:"lldp,omitempty"` + NetflowProfile *string `xml:"netflow-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type VirtualWireLacpXml_11_0_2 struct { + HighAvailability *VirtualWireLacpHighAvailabilityXml_11_0_2 `xml:"high-availability,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type VirtualWireLacpHighAvailabilityXml_11_0_2 struct { + PassivePreNegotiation *string `xml:"passive-pre-negotiation,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type VirtualWireLldpXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + HighAvailability *VirtualWireLldpHighAvailabilityXml_11_0_2 `xml:"high-availability,omitempty"` + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type VirtualWireLldpHighAvailabilityXml_11_0_2 struct { + PassivePreNegotiation *string `xml:"passive-pre-negotiation,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "comment" || v == "Comment" { + return e.Comment, nil + } + if v == "lacp" || v == "Lacp" { + return e.Lacp, nil + } + if v == "link_duplex" || v == "LinkDuplex" { + return e.LinkDuplex, nil + } + if v == "link_speed" || v == "LinkSpeed" { + return e.LinkSpeed, nil + } + if v == "link_state" || v == "LinkState" { + return e.LinkState, nil + } + if v == "poe" || v == "Poe" { + return e.Poe, nil + } + if v == "aggregate_group" || v == "AggregateGroup" { + return e.AggregateGroup, nil + } + if v == "decrypt_mirror" || v == "DecryptMirror" { + return e.DecryptMirror, nil + } + if v == "ha" || v == "Ha" { + return e.Ha, nil + } + if v == "layer2" || v == "Layer2" { + return e.Layer2, nil + } + if v == "layer3" || v == "Layer3" { + return e.Layer3, nil + } + if v == "log_card" || v == "LogCard" { + return e.LogCard, nil + } + if v == "tap" || v == "Tap" { + return e.Tap, nil + } + if v == "virtual_wire" || v == "VirtualWire" { + return e.VirtualWire, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + version_11_0_2, _ := version.New("11.0.2") + version_11_1_0, _ := version.New("11.1.0") + if vn.Gte(version_11_0_2) && vn.Lt(version_11_1_0) { + return specifyEntry_11_0_2, &entryXmlContainer_11_0_2{}, nil + } + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.Comment = o.Comment + var nestedLacp *LacpXml + if o.Lacp != nil { + nestedLacp = &LacpXml{} + if _, ok := o.Misc["Lacp"]; ok { + nestedLacp.Misc = o.Misc["Lacp"] + } + if o.Lacp.PortPriority != nil { + nestedLacp.PortPriority = o.Lacp.PortPriority + } + } + entry.Lacp = nestedLacp + + entry.LinkDuplex = o.LinkDuplex + entry.LinkSpeed = o.LinkSpeed + entry.LinkState = o.LinkState + var nestedPoe *PoeXml + if o.Poe != nil { + nestedPoe = &PoeXml{} + if _, ok := o.Misc["Poe"]; ok { + nestedPoe.Misc = o.Misc["Poe"] + } + if o.Poe.PoeEnabled != nil { + nestedPoe.PoeEnabled = util.YesNo(o.Poe.PoeEnabled, nil) + } + if o.Poe.PoeRsvdPwr != nil { + nestedPoe.PoeRsvdPwr = o.Poe.PoeRsvdPwr + } + } + entry.Poe = nestedPoe + + entry.AggregateGroup = o.AggregateGroup + var nestedDecryptMirror *DecryptMirrorXml + if o.DecryptMirror != nil { + nestedDecryptMirror = &DecryptMirrorXml{} + if _, ok := o.Misc["DecryptMirror"]; ok { + nestedDecryptMirror.Misc = o.Misc["DecryptMirror"] + } + } + entry.DecryptMirror = nestedDecryptMirror + + var nestedHa *HaXml + if o.Ha != nil { + nestedHa = &HaXml{} + if _, ok := o.Misc["Ha"]; ok { + nestedHa.Misc = o.Misc["Ha"] + } + } + entry.Ha = nestedHa + + var nestedLayer2 *Layer2Xml + if o.Layer2 != nil { + nestedLayer2 = &Layer2Xml{} + if _, ok := o.Misc["Layer2"]; ok { + nestedLayer2.Misc = o.Misc["Layer2"] + } + if o.Layer2.Lldp != nil { + nestedLayer2.Lldp = &Layer2LldpXml{} + if _, ok := o.Misc["Layer2Lldp"]; ok { + nestedLayer2.Lldp.Misc = o.Misc["Layer2Lldp"] + } + if o.Layer2.Lldp.Enable != nil { + nestedLayer2.Lldp.Enable = util.YesNo(o.Layer2.Lldp.Enable, nil) + } + if o.Layer2.Lldp.HighAvailability != nil { + nestedLayer2.Lldp.HighAvailability = &Layer2LldpHighAvailabilityXml{} + if _, ok := o.Misc["Layer2LldpHighAvailability"]; ok { + nestedLayer2.Lldp.HighAvailability.Misc = o.Misc["Layer2LldpHighAvailability"] + } + if o.Layer2.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer2.Lldp.HighAvailability.PassivePreNegotiation = util.YesNo(o.Layer2.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.Layer2.Lldp.Profile != nil { + nestedLayer2.Lldp.Profile = o.Layer2.Lldp.Profile + } + } + if o.Layer2.NetflowProfile != nil { + nestedLayer2.NetflowProfile = o.Layer2.NetflowProfile + } + } + entry.Layer2 = nestedLayer2 + + var nestedLayer3 *Layer3Xml + if o.Layer3 != nil { + nestedLayer3 = &Layer3Xml{} + if _, ok := o.Misc["Layer3"]; ok { + nestedLayer3.Misc = o.Misc["Layer3"] + } + if o.Layer3.Bonjour != nil { + nestedLayer3.Bonjour = &Layer3BonjourXml{} + if _, ok := o.Misc["Layer3Bonjour"]; ok { + nestedLayer3.Bonjour.Misc = o.Misc["Layer3Bonjour"] + } + if o.Layer3.Bonjour.Enable != nil { + nestedLayer3.Bonjour.Enable = util.YesNo(o.Layer3.Bonjour.Enable, nil) + } + if o.Layer3.Bonjour.GroupId != nil { + nestedLayer3.Bonjour.GroupId = o.Layer3.Bonjour.GroupId + } + if o.Layer3.Bonjour.TtlCheck != nil { + nestedLayer3.Bonjour.TtlCheck = util.YesNo(o.Layer3.Bonjour.TtlCheck, nil) + } + } + if o.Layer3.DdnsConfig != nil { + nestedLayer3.DdnsConfig = &Layer3DdnsConfigXml{} + if _, ok := o.Misc["Layer3DdnsConfig"]; ok { + nestedLayer3.DdnsConfig.Misc = o.Misc["Layer3DdnsConfig"] + } + if o.Layer3.DdnsConfig.DdnsCertProfile != nil { + nestedLayer3.DdnsConfig.DdnsCertProfile = o.Layer3.DdnsConfig.DdnsCertProfile + } + if o.Layer3.DdnsConfig.DdnsEnabled != nil { + nestedLayer3.DdnsConfig.DdnsEnabled = util.YesNo(o.Layer3.DdnsConfig.DdnsEnabled, nil) + } + if o.Layer3.DdnsConfig.DdnsHostname != nil { + nestedLayer3.DdnsConfig.DdnsHostname = o.Layer3.DdnsConfig.DdnsHostname + } + if o.Layer3.DdnsConfig.DdnsIp != nil { + nestedLayer3.DdnsConfig.DdnsIp = util.StrToMem(o.Layer3.DdnsConfig.DdnsIp) + } + if o.Layer3.DdnsConfig.DdnsIpv6 != nil { + nestedLayer3.DdnsConfig.DdnsIpv6 = util.StrToMem(o.Layer3.DdnsConfig.DdnsIpv6) + } + if o.Layer3.DdnsConfig.DdnsUpdateInterval != nil { + nestedLayer3.DdnsConfig.DdnsUpdateInterval = o.Layer3.DdnsConfig.DdnsUpdateInterval + } + if o.Layer3.DdnsConfig.DdnsVendor != nil { + nestedLayer3.DdnsConfig.DdnsVendor = o.Layer3.DdnsConfig.DdnsVendor + } + if o.Layer3.DdnsConfig.DdnsVendorConfig != nil { + nestedLayer3.DdnsConfig.DdnsVendorConfig = []Layer3DdnsConfigDdnsVendorConfigXml{} + for _, oLayer3DdnsConfigDdnsVendorConfig := range o.Layer3.DdnsConfig.DdnsVendorConfig { + nestedLayer3DdnsConfigDdnsVendorConfig := Layer3DdnsConfigDdnsVendorConfigXml{} + if _, ok := o.Misc["Layer3DdnsConfigDdnsVendorConfig"]; ok { + nestedLayer3DdnsConfigDdnsVendorConfig.Misc = o.Misc["Layer3DdnsConfigDdnsVendorConfig"] + } + if oLayer3DdnsConfigDdnsVendorConfig.Value != nil { + nestedLayer3DdnsConfigDdnsVendorConfig.Value = oLayer3DdnsConfigDdnsVendorConfig.Value + } + if oLayer3DdnsConfigDdnsVendorConfig.Name != "" { + nestedLayer3DdnsConfigDdnsVendorConfig.Name = oLayer3DdnsConfigDdnsVendorConfig.Name + } + nestedLayer3.DdnsConfig.DdnsVendorConfig = append(nestedLayer3.DdnsConfig.DdnsVendorConfig, nestedLayer3DdnsConfigDdnsVendorConfig) + } + } + } + if o.Layer3.DfIgnore != nil { + nestedLayer3.DfIgnore = util.YesNo(o.Layer3.DfIgnore, nil) + } + if o.Layer3.Pppoe != nil { + nestedLayer3.Pppoe = &Layer3PppoeXml{} + if _, ok := o.Misc["Layer3Pppoe"]; ok { + nestedLayer3.Pppoe.Misc = o.Misc["Layer3Pppoe"] + } + if o.Layer3.Pppoe.DefaultRouteMetric != nil { + nestedLayer3.Pppoe.DefaultRouteMetric = o.Layer3.Pppoe.DefaultRouteMetric + } + if o.Layer3.Pppoe.Enable != nil { + nestedLayer3.Pppoe.Enable = util.YesNo(o.Layer3.Pppoe.Enable, nil) + } + if o.Layer3.Pppoe.Password != nil { + nestedLayer3.Pppoe.Password = o.Layer3.Pppoe.Password + } + if o.Layer3.Pppoe.StaticAddress != nil { + nestedLayer3.Pppoe.StaticAddress = &Layer3PppoeStaticAddressXml{} + if _, ok := o.Misc["Layer3PppoeStaticAddress"]; ok { + nestedLayer3.Pppoe.StaticAddress.Misc = o.Misc["Layer3PppoeStaticAddress"] + } + if o.Layer3.Pppoe.StaticAddress.Ip != nil { + nestedLayer3.Pppoe.StaticAddress.Ip = o.Layer3.Pppoe.StaticAddress.Ip + } + } + if o.Layer3.Pppoe.AccessConcentrator != nil { + nestedLayer3.Pppoe.AccessConcentrator = o.Layer3.Pppoe.AccessConcentrator + } + if o.Layer3.Pppoe.CreateDefaultRoute != nil { + nestedLayer3.Pppoe.CreateDefaultRoute = util.YesNo(o.Layer3.Pppoe.CreateDefaultRoute, nil) + } + if o.Layer3.Pppoe.Service != nil { + nestedLayer3.Pppoe.Service = o.Layer3.Pppoe.Service + } + if o.Layer3.Pppoe.Username != nil { + nestedLayer3.Pppoe.Username = o.Layer3.Pppoe.Username + } + if o.Layer3.Pppoe.Authentication != nil { + nestedLayer3.Pppoe.Authentication = o.Layer3.Pppoe.Authentication + } + if o.Layer3.Pppoe.Passive != nil { + nestedLayer3.Pppoe.Passive = &Layer3PppoePassiveXml{} + if _, ok := o.Misc["Layer3PppoePassive"]; ok { + nestedLayer3.Pppoe.Passive.Misc = o.Misc["Layer3PppoePassive"] + } + if o.Layer3.Pppoe.Passive.Enable != nil { + nestedLayer3.Pppoe.Passive.Enable = util.YesNo(o.Layer3.Pppoe.Passive.Enable, nil) + } + } + } + if o.Layer3.DecryptForward != nil { + nestedLayer3.DecryptForward = util.YesNo(o.Layer3.DecryptForward, nil) + } + if o.Layer3.DhcpClient != nil { + nestedLayer3.DhcpClient = &Layer3DhcpClientXml{} + if _, ok := o.Misc["Layer3DhcpClient"]; ok { + nestedLayer3.DhcpClient.Misc = o.Misc["Layer3DhcpClient"] + } + if o.Layer3.DhcpClient.CreateDefaultRoute != nil { + nestedLayer3.DhcpClient.CreateDefaultRoute = util.YesNo(o.Layer3.DhcpClient.CreateDefaultRoute, nil) + } + if o.Layer3.DhcpClient.DefaultRouteMetric != nil { + nestedLayer3.DhcpClient.DefaultRouteMetric = o.Layer3.DhcpClient.DefaultRouteMetric + } + if o.Layer3.DhcpClient.Enable != nil { + nestedLayer3.DhcpClient.Enable = util.YesNo(o.Layer3.DhcpClient.Enable, nil) + } + if o.Layer3.DhcpClient.SendHostname != nil { + nestedLayer3.DhcpClient.SendHostname = &Layer3DhcpClientSendHostnameXml{} + if _, ok := o.Misc["Layer3DhcpClientSendHostname"]; ok { + nestedLayer3.DhcpClient.SendHostname.Misc = o.Misc["Layer3DhcpClientSendHostname"] + } + if o.Layer3.DhcpClient.SendHostname.Hostname != nil { + nestedLayer3.DhcpClient.SendHostname.Hostname = o.Layer3.DhcpClient.SendHostname.Hostname + } + if o.Layer3.DhcpClient.SendHostname.Enable != nil { + nestedLayer3.DhcpClient.SendHostname.Enable = util.YesNo(o.Layer3.DhcpClient.SendHostname.Enable, nil) + } + } + } + if o.Layer3.NdpProxy != nil { + nestedLayer3.NdpProxy = &Layer3NdpProxyXml{} + if _, ok := o.Misc["Layer3NdpProxy"]; ok { + nestedLayer3.NdpProxy.Misc = o.Misc["Layer3NdpProxy"] + } + if o.Layer3.NdpProxy.Address != nil { + nestedLayer3.NdpProxy.Address = []Layer3NdpProxyAddressXml{} + for _, oLayer3NdpProxyAddress := range o.Layer3.NdpProxy.Address { + nestedLayer3NdpProxyAddress := Layer3NdpProxyAddressXml{} + if _, ok := o.Misc["Layer3NdpProxyAddress"]; ok { + nestedLayer3NdpProxyAddress.Misc = o.Misc["Layer3NdpProxyAddress"] + } + if oLayer3NdpProxyAddress.Negate != nil { + nestedLayer3NdpProxyAddress.Negate = util.YesNo(oLayer3NdpProxyAddress.Negate, nil) + } + if oLayer3NdpProxyAddress.Name != "" { + nestedLayer3NdpProxyAddress.Name = oLayer3NdpProxyAddress.Name + } + nestedLayer3.NdpProxy.Address = append(nestedLayer3.NdpProxy.Address, nestedLayer3NdpProxyAddress) + } + } + if o.Layer3.NdpProxy.Enabled != nil { + nestedLayer3.NdpProxy.Enabled = util.YesNo(o.Layer3.NdpProxy.Enabled, nil) + } + } + if o.Layer3.NetflowProfile != nil { + nestedLayer3.NetflowProfile = o.Layer3.NetflowProfile + } + if o.Layer3.ClusterInterconnect != nil { + nestedLayer3.ClusterInterconnect = util.YesNo(o.Layer3.ClusterInterconnect, nil) + } + if o.Layer3.Arp != nil { + nestedLayer3.Arp = []Layer3ArpXml{} + for _, oLayer3Arp := range o.Layer3.Arp { + nestedLayer3Arp := Layer3ArpXml{} + if _, ok := o.Misc["Layer3Arp"]; ok { + nestedLayer3Arp.Misc = o.Misc["Layer3Arp"] + } + if oLayer3Arp.HwAddress != nil { + nestedLayer3Arp.HwAddress = oLayer3Arp.HwAddress + } + if oLayer3Arp.Name != "" { + nestedLayer3Arp.Name = oLayer3Arp.Name + } + nestedLayer3.Arp = append(nestedLayer3.Arp, nestedLayer3Arp) + } + } + if o.Layer3.Ip != nil { + nestedLayer3.Ip = []Layer3IpXml{} + for _, oLayer3Ip := range o.Layer3.Ip { + nestedLayer3Ip := Layer3IpXml{} + if _, ok := o.Misc["Layer3Ip"]; ok { + nestedLayer3Ip.Misc = o.Misc["Layer3Ip"] + } + if oLayer3Ip.SdwanGateway != nil { + nestedLayer3Ip.SdwanGateway = oLayer3Ip.SdwanGateway + } + if oLayer3Ip.Name != "" { + nestedLayer3Ip.Name = oLayer3Ip.Name + } + nestedLayer3.Ip = append(nestedLayer3.Ip, nestedLayer3Ip) + } + } + if o.Layer3.Mtu != nil { + nestedLayer3.Mtu = o.Layer3.Mtu + } + if o.Layer3.TrafficInterconnect != nil { + nestedLayer3.TrafficInterconnect = util.YesNo(o.Layer3.TrafficInterconnect, nil) + } + if o.Layer3.AdjustTcpMss != nil { + nestedLayer3.AdjustTcpMss = &Layer3AdjustTcpMssXml{} + if _, ok := o.Misc["Layer3AdjustTcpMss"]; ok { + nestedLayer3.AdjustTcpMss.Misc = o.Misc["Layer3AdjustTcpMss"] + } + if o.Layer3.AdjustTcpMss.Enable != nil { + nestedLayer3.AdjustTcpMss.Enable = util.YesNo(o.Layer3.AdjustTcpMss.Enable, nil) + } + if o.Layer3.AdjustTcpMss.Ipv4MssAdjustment != nil { + nestedLayer3.AdjustTcpMss.Ipv4MssAdjustment = o.Layer3.AdjustTcpMss.Ipv4MssAdjustment + } + if o.Layer3.AdjustTcpMss.Ipv6MssAdjustment != nil { + nestedLayer3.AdjustTcpMss.Ipv6MssAdjustment = o.Layer3.AdjustTcpMss.Ipv6MssAdjustment + } + } + if o.Layer3.InterfaceManagementProfile != nil { + nestedLayer3.InterfaceManagementProfile = o.Layer3.InterfaceManagementProfile + } + if o.Layer3.Ipv6 != nil { + nestedLayer3.Ipv6 = &Layer3Ipv6Xml{} + if _, ok := o.Misc["Layer3Ipv6"]; ok { + nestedLayer3.Ipv6.Misc = o.Misc["Layer3Ipv6"] + } + if o.Layer3.Ipv6.InterfaceId != nil { + nestedLayer3.Ipv6.InterfaceId = o.Layer3.Ipv6.InterfaceId + } + if o.Layer3.Ipv6.NeighborDiscovery != nil { + nestedLayer3.Ipv6.NeighborDiscovery = &Layer3Ipv6NeighborDiscoveryXml{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscovery"]; ok { + nestedLayer3.Ipv6.NeighborDiscovery.Misc = o.Misc["Layer3Ipv6NeighborDiscovery"] + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement = &Layer3Ipv6NeighborDiscoveryRouterAdvertisementXml{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisement"]; ok { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisement"] + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport = &Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportXml{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport"]; ok { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport"] + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml{} + for _, oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := range o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer"]; ok { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer"] + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime != nil { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = append(nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server, nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer) + } + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml{} + for _, oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := range o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix"]; ok { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix"] + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime != nil { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime + } + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = append(nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix, nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix) + } + } + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + } + if o.Layer3.Ipv6.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.NeighborDiscovery.EnableDad = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.NeighborDiscovery.EnableNdpMonitor = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = []Layer3Ipv6NeighborDiscoveryNeighborXml{} + for _, oLayer3Ipv6NeighborDiscoveryNeighbor := range o.Layer3.Ipv6.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6NeighborDiscoveryNeighbor := Layer3Ipv6NeighborDiscoveryNeighborXml{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryNeighbor"]; ok { + nestedLayer3Ipv6NeighborDiscoveryNeighbor.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryNeighbor"] + } + if oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress + } + if oLayer3Ipv6NeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryNeighbor.Name = oLayer3Ipv6NeighborDiscoveryNeighbor.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.NeighborDiscovery.Neighbor, nestedLayer3Ipv6NeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.NeighborDiscovery.NsInterval + } + if o.Layer3.Ipv6.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.ReachableTime + } + } + if o.Layer3.Ipv6.DhcpClient != nil { + nestedLayer3.Ipv6.DhcpClient = &Layer3Ipv6DhcpClientXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClient"]; ok { + nestedLayer3.Ipv6.DhcpClient.Misc = o.Misc["Layer3Ipv6DhcpClient"] + } + if o.Layer3.Ipv6.DhcpClient.AcceptRaRoute != nil { + nestedLayer3.Ipv6.DhcpClient.AcceptRaRoute = util.YesNo(o.Layer3.Ipv6.DhcpClient.AcceptRaRoute, nil) + } + if o.Layer3.Ipv6.DhcpClient.DefaultRouteMetric != nil { + nestedLayer3.Ipv6.DhcpClient.DefaultRouteMetric = o.Layer3.Ipv6.DhcpClient.DefaultRouteMetric + } + if o.Layer3.Ipv6.DhcpClient.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.Enable = util.YesNo(o.Layer3.Ipv6.DhcpClient.Enable, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery = &Layer3Ipv6DhcpClientNeighborDiscoveryXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscovery"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscovery"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable = util.YesNo(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = []Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer"]; ok { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer"] + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6Xml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6"] + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable = util.YesNo(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6Xml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6"] + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix"]; ok { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix"] + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad = util.YesNo(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor = util.YesNo(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor = []Layer3Ipv6DhcpClientNeighborDiscoveryNeighborXml{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor := Layer3Ipv6DhcpClientNeighborDiscoveryNeighborXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor"]; ok { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor"] + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor, nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor) + } + } + } + if o.Layer3.Ipv6.DhcpClient.Preference != nil { + nestedLayer3.Ipv6.DhcpClient.Preference = o.Layer3.Ipv6.DhcpClient.Preference + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation = &Layer3Ipv6DhcpClientPrefixDelegationXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientPrefixDelegation"]; ok { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Misc = o.Misc["Layer3Ipv6DhcpClientPrefixDelegation"] + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable = &Layer3Ipv6DhcpClientPrefixDelegationEnableXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnable"]; ok { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Misc = o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnable"] + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No = &Layer3Ipv6DhcpClientPrefixDelegationEnableNoXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableNo"]; ok { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No.Misc = o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableNo"] + } + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes = &Layer3Ipv6DhcpClientPrefixDelegationEnableYesXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableYes"]; ok { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.Misc = o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableYes"] + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint = util.YesNo(o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint, nil) + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options = &Layer3Ipv6DhcpClientV6OptionsXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientV6Options"]; ok { + nestedLayer3.Ipv6.DhcpClient.V6Options.Misc = o.Misc["Layer3Ipv6DhcpClientV6Options"] + } + if o.Layer3.Ipv6.DhcpClient.V6Options.DuidType != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.DuidType = o.Layer3.Ipv6.DhcpClient.V6Options.DuidType + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable = &Layer3Ipv6DhcpClientV6OptionsEnableXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientV6OptionsEnable"]; ok { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Misc = o.Misc["Layer3Ipv6DhcpClientV6OptionsEnable"] + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.No != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.No = &Layer3Ipv6DhcpClientV6OptionsEnableNoXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientV6OptionsEnableNo"]; ok { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.No.Misc = o.Misc["Layer3Ipv6DhcpClientV6OptionsEnableNo"] + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes = &Layer3Ipv6DhcpClientV6OptionsEnableYesXml{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientV6OptionsEnableYes"]; ok { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes.Misc = o.Misc["Layer3Ipv6DhcpClientV6OptionsEnableYes"] + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr = util.YesNo(o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr, nil) + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr = util.YesNo(o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr, nil) + } + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options.RapidCommit != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.RapidCommit = util.YesNo(o.Layer3.Ipv6.DhcpClient.V6Options.RapidCommit, nil) + } + if o.Layer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig = util.YesNo(o.Layer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig, nil) + } + } + } + if o.Layer3.Ipv6.Inherited != nil { + nestedLayer3.Ipv6.Inherited = &Layer3Ipv6InheritedXml{} + if _, ok := o.Misc["Layer3Ipv6Inherited"]; ok { + nestedLayer3.Ipv6.Inherited.Misc = o.Misc["Layer3Ipv6Inherited"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery = &Layer3Ipv6InheritedNeighborDiscoveryXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscovery"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscovery"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement = &Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisementXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServer"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServer"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6Xml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = []Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer := Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer"]; ok { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer"] + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name = oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6Xml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix"]; ok { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix"] + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.NsInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor = []Layer3Ipv6InheritedNeighborDiscoveryNeighborXml{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryNeighbor := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor := Layer3Ipv6InheritedNeighborDiscoveryNeighborXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryNeighbor"]; ok { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryNeighbor"] + } + if oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress + } + if oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name = oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor, nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.EnableDad = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor, nil) + } + } + if o.Layer3.Ipv6.Inherited.AssignAddr != nil { + nestedLayer3.Ipv6.Inherited.AssignAddr = []Layer3Ipv6InheritedAssignAddrXml{} + for _, oLayer3Ipv6InheritedAssignAddr := range o.Layer3.Ipv6.Inherited.AssignAddr { + nestedLayer3Ipv6InheritedAssignAddr := Layer3Ipv6InheritedAssignAddrXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddr"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Misc = o.Misc["Layer3Ipv6InheritedAssignAddr"] + } + if oLayer3Ipv6InheritedAssignAddr.Name != "" { + nestedLayer3Ipv6InheritedAssignAddr.Name = oLayer3Ipv6InheritedAssignAddr.Name + } + if oLayer3Ipv6InheritedAssignAddr.Type != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type = &Layer3Ipv6InheritedAssignAddrTypeXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrType"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrType"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua = &Layer3Ipv6InheritedAssignAddrTypeGuaXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeGua"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeGua"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolType"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolType"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic"] + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicIdXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier + } + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise = &Layer3Ipv6InheritedAssignAddrTypeGuaAdvertiseXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag, nil) + } + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula = &Layer3Ipv6InheritedAssignAddrTypeUlaXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeUla"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeUla"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise = &Layer3Ipv6InheritedAssignAddrTypeUlaAdvertiseXml{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Address != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Address = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Address + } + } + } + nestedLayer3.Ipv6.Inherited.AssignAddr = append(nestedLayer3.Ipv6.Inherited.AssignAddr, nestedLayer3Ipv6InheritedAssignAddr) + } + } + if o.Layer3.Ipv6.Inherited.Enable != nil { + nestedLayer3.Ipv6.Inherited.Enable = util.YesNo(o.Layer3.Ipv6.Inherited.Enable, nil) + } + } + if o.Layer3.Ipv6.Address != nil { + nestedLayer3.Ipv6.Address = []Layer3Ipv6AddressXml{} + for _, oLayer3Ipv6Address := range o.Layer3.Ipv6.Address { + nestedLayer3Ipv6Address := Layer3Ipv6AddressXml{} + if _, ok := o.Misc["Layer3Ipv6Address"]; ok { + nestedLayer3Ipv6Address.Misc = o.Misc["Layer3Ipv6Address"] + } + if oLayer3Ipv6Address.Advertise != nil { + nestedLayer3Ipv6Address.Advertise = &Layer3Ipv6AddressAdvertiseXml{} + if _, ok := o.Misc["Layer3Ipv6AddressAdvertise"]; ok { + nestedLayer3Ipv6Address.Advertise.Misc = o.Misc["Layer3Ipv6AddressAdvertise"] + } + if oLayer3Ipv6Address.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6Address.Advertise.OnlinkFlag = util.YesNo(oLayer3Ipv6Address.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6Address.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6Address.Advertise.AutoConfigFlag = util.YesNo(oLayer3Ipv6Address.Advertise.AutoConfigFlag, nil) + } + if oLayer3Ipv6Address.Advertise.Enable != nil { + nestedLayer3Ipv6Address.Advertise.Enable = util.YesNo(oLayer3Ipv6Address.Advertise.Enable, nil) + } + if oLayer3Ipv6Address.Advertise.ValidLifetime != nil { + nestedLayer3Ipv6Address.Advertise.ValidLifetime = oLayer3Ipv6Address.Advertise.ValidLifetime + } + if oLayer3Ipv6Address.Advertise.PreferredLifetime != nil { + nestedLayer3Ipv6Address.Advertise.PreferredLifetime = oLayer3Ipv6Address.Advertise.PreferredLifetime + } + } + if oLayer3Ipv6Address.Name != "" { + nestedLayer3Ipv6Address.Name = oLayer3Ipv6Address.Name + } + if oLayer3Ipv6Address.EnableOnInterface != nil { + nestedLayer3Ipv6Address.EnableOnInterface = util.YesNo(oLayer3Ipv6Address.EnableOnInterface, nil) + } + if oLayer3Ipv6Address.Prefix != nil { + nestedLayer3Ipv6Address.Prefix = &Layer3Ipv6AddressPrefixXml{} + if _, ok := o.Misc["Layer3Ipv6AddressPrefix"]; ok { + nestedLayer3Ipv6Address.Prefix.Misc = o.Misc["Layer3Ipv6AddressPrefix"] + } + } + if oLayer3Ipv6Address.Anycast != nil { + nestedLayer3Ipv6Address.Anycast = &Layer3Ipv6AddressAnycastXml{} + if _, ok := o.Misc["Layer3Ipv6AddressAnycast"]; ok { + nestedLayer3Ipv6Address.Anycast.Misc = o.Misc["Layer3Ipv6AddressAnycast"] + } + } + nestedLayer3.Ipv6.Address = append(nestedLayer3.Ipv6.Address, nestedLayer3Ipv6Address) + } + } + if o.Layer3.Ipv6.Enabled != nil { + nestedLayer3.Ipv6.Enabled = util.YesNo(o.Layer3.Ipv6.Enabled, nil) + } + } + if o.Layer3.Lldp != nil { + nestedLayer3.Lldp = &Layer3LldpXml{} + if _, ok := o.Misc["Layer3Lldp"]; ok { + nestedLayer3.Lldp.Misc = o.Misc["Layer3Lldp"] + } + if o.Layer3.Lldp.HighAvailability != nil { + nestedLayer3.Lldp.HighAvailability = &Layer3LldpHighAvailabilityXml{} + if _, ok := o.Misc["Layer3LldpHighAvailability"]; ok { + nestedLayer3.Lldp.HighAvailability.Misc = o.Misc["Layer3LldpHighAvailability"] + } + if o.Layer3.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer3.Lldp.HighAvailability.PassivePreNegotiation = util.YesNo(o.Layer3.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.Layer3.Lldp.Profile != nil { + nestedLayer3.Lldp.Profile = o.Layer3.Lldp.Profile + } + if o.Layer3.Lldp.Enable != nil { + nestedLayer3.Lldp.Enable = util.YesNo(o.Layer3.Lldp.Enable, nil) + } + } + if o.Layer3.SdwanLinkSettings != nil { + nestedLayer3.SdwanLinkSettings = &Layer3SdwanLinkSettingsXml{} + if _, ok := o.Misc["Layer3SdwanLinkSettings"]; ok { + nestedLayer3.SdwanLinkSettings.Misc = o.Misc["Layer3SdwanLinkSettings"] + } + if o.Layer3.SdwanLinkSettings.Enable != nil { + nestedLayer3.SdwanLinkSettings.Enable = util.YesNo(o.Layer3.SdwanLinkSettings.Enable, nil) + } + if o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile != nil { + nestedLayer3.SdwanLinkSettings.SdwanInterfaceProfile = o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile + } + if o.Layer3.SdwanLinkSettings.UpstreamNat != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat = &Layer3SdwanLinkSettingsUpstreamNatXml{} + if _, ok := o.Misc["Layer3SdwanLinkSettingsUpstreamNat"]; ok { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Misc = o.Misc["Layer3SdwanLinkSettingsUpstreamNat"] + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.Enable != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Enable = util.YesNo(o.Layer3.SdwanLinkSettings.UpstreamNat.Enable, nil) + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.Ddns != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Ddns = &Layer3SdwanLinkSettingsUpstreamNatDdnsXml{} + if _, ok := o.Misc["Layer3SdwanLinkSettingsUpstreamNatDdns"]; ok { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Ddns.Misc = o.Misc["Layer3SdwanLinkSettingsUpstreamNatDdns"] + } + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp = &Layer3SdwanLinkSettingsUpstreamNatStaticIpXml{} + if _, ok := o.Misc["Layer3SdwanLinkSettingsUpstreamNatStaticIp"]; ok { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp.Misc = o.Misc["Layer3SdwanLinkSettingsUpstreamNatStaticIp"] + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress + } + } + } + } + if o.Layer3.UntaggedSubInterface != nil { + nestedLayer3.UntaggedSubInterface = util.YesNo(o.Layer3.UntaggedSubInterface, nil) + } + } + entry.Layer3 = nestedLayer3 + + var nestedLogCard *LogCardXml + if o.LogCard != nil { + nestedLogCard = &LogCardXml{} + if _, ok := o.Misc["LogCard"]; ok { + nestedLogCard.Misc = o.Misc["LogCard"] + } + if o.LogCard.DefaultGateway != nil { + nestedLogCard.DefaultGateway = o.LogCard.DefaultGateway + } + if o.LogCard.IpAddress != nil { + nestedLogCard.IpAddress = o.LogCard.IpAddress + } + if o.LogCard.Ipv6Address != nil { + nestedLogCard.Ipv6Address = o.LogCard.Ipv6Address + } + if o.LogCard.Ipv6DefaultGateway != nil { + nestedLogCard.Ipv6DefaultGateway = o.LogCard.Ipv6DefaultGateway + } + if o.LogCard.Netmask != nil { + nestedLogCard.Netmask = o.LogCard.Netmask + } + } + entry.LogCard = nestedLogCard + + var nestedTap *TapXml + if o.Tap != nil { + nestedTap = &TapXml{} + if _, ok := o.Misc["Tap"]; ok { + nestedTap.Misc = o.Misc["Tap"] + } + if o.Tap.NetflowProfile != nil { + nestedTap.NetflowProfile = o.Tap.NetflowProfile + } + } + entry.Tap = nestedTap + + var nestedVirtualWire *VirtualWireXml + if o.VirtualWire != nil { + nestedVirtualWire = &VirtualWireXml{} + if _, ok := o.Misc["VirtualWire"]; ok { + nestedVirtualWire.Misc = o.Misc["VirtualWire"] + } + if o.VirtualWire.Lacp != nil { + nestedVirtualWire.Lacp = &VirtualWireLacpXml{} + if _, ok := o.Misc["VirtualWireLacp"]; ok { + nestedVirtualWire.Lacp.Misc = o.Misc["VirtualWireLacp"] + } + if o.VirtualWire.Lacp.HighAvailability != nil { + nestedVirtualWire.Lacp.HighAvailability = &VirtualWireLacpHighAvailabilityXml{} + if _, ok := o.Misc["VirtualWireLacpHighAvailability"]; ok { + nestedVirtualWire.Lacp.HighAvailability.Misc = o.Misc["VirtualWireLacpHighAvailability"] + } + if o.VirtualWire.Lacp.HighAvailability.PassivePreNegotiation != nil { + nestedVirtualWire.Lacp.HighAvailability.PassivePreNegotiation = util.YesNo(o.VirtualWire.Lacp.HighAvailability.PassivePreNegotiation, nil) + } + } + } + if o.VirtualWire.Lldp != nil { + nestedVirtualWire.Lldp = &VirtualWireLldpXml{} + if _, ok := o.Misc["VirtualWireLldp"]; ok { + nestedVirtualWire.Lldp.Misc = o.Misc["VirtualWireLldp"] + } + if o.VirtualWire.Lldp.Enable != nil { + nestedVirtualWire.Lldp.Enable = util.YesNo(o.VirtualWire.Lldp.Enable, nil) + } + if o.VirtualWire.Lldp.HighAvailability != nil { + nestedVirtualWire.Lldp.HighAvailability = &VirtualWireLldpHighAvailabilityXml{} + if _, ok := o.Misc["VirtualWireLldpHighAvailability"]; ok { + nestedVirtualWire.Lldp.HighAvailability.Misc = o.Misc["VirtualWireLldpHighAvailability"] + } + if o.VirtualWire.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedVirtualWire.Lldp.HighAvailability.PassivePreNegotiation = util.YesNo(o.VirtualWire.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.VirtualWire.Lldp.Profile != nil { + nestedVirtualWire.Lldp.Profile = o.VirtualWire.Lldp.Profile + } + } + if o.VirtualWire.NetflowProfile != nil { + nestedVirtualWire.NetflowProfile = o.VirtualWire.NetflowProfile + } + } + entry.VirtualWire = nestedVirtualWire + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func specifyEntry_11_0_2(o *Entry) (any, error) { + entry := entryXml_11_0_2{} + entry.Name = o.Name + entry.Comment = o.Comment + var nestedLacp *LacpXml_11_0_2 + if o.Lacp != nil { + nestedLacp = &LacpXml_11_0_2{} + if _, ok := o.Misc["Lacp"]; ok { + nestedLacp.Misc = o.Misc["Lacp"] + } + if o.Lacp.PortPriority != nil { + nestedLacp.PortPriority = o.Lacp.PortPriority + } + } + entry.Lacp = nestedLacp + + entry.LinkDuplex = o.LinkDuplex + entry.LinkSpeed = o.LinkSpeed + entry.LinkState = o.LinkState + var nestedPoe *PoeXml_11_0_2 + if o.Poe != nil { + nestedPoe = &PoeXml_11_0_2{} + if _, ok := o.Misc["Poe"]; ok { + nestedPoe.Misc = o.Misc["Poe"] + } + if o.Poe.PoeEnabled != nil { + nestedPoe.PoeEnabled = util.YesNo(o.Poe.PoeEnabled, nil) + } + if o.Poe.PoeRsvdPwr != nil { + nestedPoe.PoeRsvdPwr = o.Poe.PoeRsvdPwr + } + } + entry.Poe = nestedPoe + + entry.AggregateGroup = o.AggregateGroup + var nestedDecryptMirror *DecryptMirrorXml_11_0_2 + if o.DecryptMirror != nil { + nestedDecryptMirror = &DecryptMirrorXml_11_0_2{} + if _, ok := o.Misc["DecryptMirror"]; ok { + nestedDecryptMirror.Misc = o.Misc["DecryptMirror"] + } + } + entry.DecryptMirror = nestedDecryptMirror + + var nestedHa *HaXml_11_0_2 + if o.Ha != nil { + nestedHa = &HaXml_11_0_2{} + if _, ok := o.Misc["Ha"]; ok { + nestedHa.Misc = o.Misc["Ha"] + } + } + entry.Ha = nestedHa + + var nestedLayer2 *Layer2Xml_11_0_2 + if o.Layer2 != nil { + nestedLayer2 = &Layer2Xml_11_0_2{} + if _, ok := o.Misc["Layer2"]; ok { + nestedLayer2.Misc = o.Misc["Layer2"] + } + if o.Layer2.Lldp != nil { + nestedLayer2.Lldp = &Layer2LldpXml_11_0_2{} + if _, ok := o.Misc["Layer2Lldp"]; ok { + nestedLayer2.Lldp.Misc = o.Misc["Layer2Lldp"] + } + if o.Layer2.Lldp.Enable != nil { + nestedLayer2.Lldp.Enable = util.YesNo(o.Layer2.Lldp.Enable, nil) + } + if o.Layer2.Lldp.HighAvailability != nil { + nestedLayer2.Lldp.HighAvailability = &Layer2LldpHighAvailabilityXml_11_0_2{} + if _, ok := o.Misc["Layer2LldpHighAvailability"]; ok { + nestedLayer2.Lldp.HighAvailability.Misc = o.Misc["Layer2LldpHighAvailability"] + } + if o.Layer2.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer2.Lldp.HighAvailability.PassivePreNegotiation = util.YesNo(o.Layer2.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.Layer2.Lldp.Profile != nil { + nestedLayer2.Lldp.Profile = o.Layer2.Lldp.Profile + } + } + if o.Layer2.NetflowProfile != nil { + nestedLayer2.NetflowProfile = o.Layer2.NetflowProfile + } + } + entry.Layer2 = nestedLayer2 + + var nestedLayer3 *Layer3Xml_11_0_2 + if o.Layer3 != nil { + nestedLayer3 = &Layer3Xml_11_0_2{} + if _, ok := o.Misc["Layer3"]; ok { + nestedLayer3.Misc = o.Misc["Layer3"] + } + if o.Layer3.DfIgnore != nil { + nestedLayer3.DfIgnore = util.YesNo(o.Layer3.DfIgnore, nil) + } + if o.Layer3.Pppoe != nil { + nestedLayer3.Pppoe = &Layer3PppoeXml_11_0_2{} + if _, ok := o.Misc["Layer3Pppoe"]; ok { + nestedLayer3.Pppoe.Misc = o.Misc["Layer3Pppoe"] + } + if o.Layer3.Pppoe.StaticAddress != nil { + nestedLayer3.Pppoe.StaticAddress = &Layer3PppoeStaticAddressXml_11_0_2{} + if _, ok := o.Misc["Layer3PppoeStaticAddress"]; ok { + nestedLayer3.Pppoe.StaticAddress.Misc = o.Misc["Layer3PppoeStaticAddress"] + } + if o.Layer3.Pppoe.StaticAddress.Ip != nil { + nestedLayer3.Pppoe.StaticAddress.Ip = o.Layer3.Pppoe.StaticAddress.Ip + } + } + if o.Layer3.Pppoe.AccessConcentrator != nil { + nestedLayer3.Pppoe.AccessConcentrator = o.Layer3.Pppoe.AccessConcentrator + } + if o.Layer3.Pppoe.CreateDefaultRoute != nil { + nestedLayer3.Pppoe.CreateDefaultRoute = util.YesNo(o.Layer3.Pppoe.CreateDefaultRoute, nil) + } + if o.Layer3.Pppoe.DefaultRouteMetric != nil { + nestedLayer3.Pppoe.DefaultRouteMetric = o.Layer3.Pppoe.DefaultRouteMetric + } + if o.Layer3.Pppoe.Enable != nil { + nestedLayer3.Pppoe.Enable = util.YesNo(o.Layer3.Pppoe.Enable, nil) + } + if o.Layer3.Pppoe.Password != nil { + nestedLayer3.Pppoe.Password = o.Layer3.Pppoe.Password + } + if o.Layer3.Pppoe.Authentication != nil { + nestedLayer3.Pppoe.Authentication = o.Layer3.Pppoe.Authentication + } + if o.Layer3.Pppoe.Passive != nil { + nestedLayer3.Pppoe.Passive = &Layer3PppoePassiveXml_11_0_2{} + if _, ok := o.Misc["Layer3PppoePassive"]; ok { + nestedLayer3.Pppoe.Passive.Misc = o.Misc["Layer3PppoePassive"] + } + if o.Layer3.Pppoe.Passive.Enable != nil { + nestedLayer3.Pppoe.Passive.Enable = util.YesNo(o.Layer3.Pppoe.Passive.Enable, nil) + } + } + if o.Layer3.Pppoe.Service != nil { + nestedLayer3.Pppoe.Service = o.Layer3.Pppoe.Service + } + if o.Layer3.Pppoe.Username != nil { + nestedLayer3.Pppoe.Username = o.Layer3.Pppoe.Username + } + } + if o.Layer3.Bonjour != nil { + nestedLayer3.Bonjour = &Layer3BonjourXml_11_0_2{} + if _, ok := o.Misc["Layer3Bonjour"]; ok { + nestedLayer3.Bonjour.Misc = o.Misc["Layer3Bonjour"] + } + if o.Layer3.Bonjour.TtlCheck != nil { + nestedLayer3.Bonjour.TtlCheck = util.YesNo(o.Layer3.Bonjour.TtlCheck, nil) + } + if o.Layer3.Bonjour.Enable != nil { + nestedLayer3.Bonjour.Enable = util.YesNo(o.Layer3.Bonjour.Enable, nil) + } + if o.Layer3.Bonjour.GroupId != nil { + nestedLayer3.Bonjour.GroupId = o.Layer3.Bonjour.GroupId + } + } + if o.Layer3.DdnsConfig != nil { + nestedLayer3.DdnsConfig = &Layer3DdnsConfigXml_11_0_2{} + if _, ok := o.Misc["Layer3DdnsConfig"]; ok { + nestedLayer3.DdnsConfig.Misc = o.Misc["Layer3DdnsConfig"] + } + if o.Layer3.DdnsConfig.DdnsHostname != nil { + nestedLayer3.DdnsConfig.DdnsHostname = o.Layer3.DdnsConfig.DdnsHostname + } + if o.Layer3.DdnsConfig.DdnsIp != nil { + nestedLayer3.DdnsConfig.DdnsIp = util.StrToMem(o.Layer3.DdnsConfig.DdnsIp) + } + if o.Layer3.DdnsConfig.DdnsIpv6 != nil { + nestedLayer3.DdnsConfig.DdnsIpv6 = util.StrToMem(o.Layer3.DdnsConfig.DdnsIpv6) + } + if o.Layer3.DdnsConfig.DdnsUpdateInterval != nil { + nestedLayer3.DdnsConfig.DdnsUpdateInterval = o.Layer3.DdnsConfig.DdnsUpdateInterval + } + if o.Layer3.DdnsConfig.DdnsVendor != nil { + nestedLayer3.DdnsConfig.DdnsVendor = o.Layer3.DdnsConfig.DdnsVendor + } + if o.Layer3.DdnsConfig.DdnsVendorConfig != nil { + nestedLayer3.DdnsConfig.DdnsVendorConfig = []Layer3DdnsConfigDdnsVendorConfigXml_11_0_2{} + for _, oLayer3DdnsConfigDdnsVendorConfig := range o.Layer3.DdnsConfig.DdnsVendorConfig { + nestedLayer3DdnsConfigDdnsVendorConfig := Layer3DdnsConfigDdnsVendorConfigXml_11_0_2{} + if _, ok := o.Misc["Layer3DdnsConfigDdnsVendorConfig"]; ok { + nestedLayer3DdnsConfigDdnsVendorConfig.Misc = o.Misc["Layer3DdnsConfigDdnsVendorConfig"] + } + if oLayer3DdnsConfigDdnsVendorConfig.Value != nil { + nestedLayer3DdnsConfigDdnsVendorConfig.Value = oLayer3DdnsConfigDdnsVendorConfig.Value + } + if oLayer3DdnsConfigDdnsVendorConfig.Name != "" { + nestedLayer3DdnsConfigDdnsVendorConfig.Name = oLayer3DdnsConfigDdnsVendorConfig.Name + } + nestedLayer3.DdnsConfig.DdnsVendorConfig = append(nestedLayer3.DdnsConfig.DdnsVendorConfig, nestedLayer3DdnsConfigDdnsVendorConfig) + } + } + if o.Layer3.DdnsConfig.DdnsCertProfile != nil { + nestedLayer3.DdnsConfig.DdnsCertProfile = o.Layer3.DdnsConfig.DdnsCertProfile + } + if o.Layer3.DdnsConfig.DdnsEnabled != nil { + nestedLayer3.DdnsConfig.DdnsEnabled = util.YesNo(o.Layer3.DdnsConfig.DdnsEnabled, nil) + } + } + if o.Layer3.NdpProxy != nil { + nestedLayer3.NdpProxy = &Layer3NdpProxyXml_11_0_2{} + if _, ok := o.Misc["Layer3NdpProxy"]; ok { + nestedLayer3.NdpProxy.Misc = o.Misc["Layer3NdpProxy"] + } + if o.Layer3.NdpProxy.Address != nil { + nestedLayer3.NdpProxy.Address = []Layer3NdpProxyAddressXml_11_0_2{} + for _, oLayer3NdpProxyAddress := range o.Layer3.NdpProxy.Address { + nestedLayer3NdpProxyAddress := Layer3NdpProxyAddressXml_11_0_2{} + if _, ok := o.Misc["Layer3NdpProxyAddress"]; ok { + nestedLayer3NdpProxyAddress.Misc = o.Misc["Layer3NdpProxyAddress"] + } + if oLayer3NdpProxyAddress.Name != "" { + nestedLayer3NdpProxyAddress.Name = oLayer3NdpProxyAddress.Name + } + if oLayer3NdpProxyAddress.Negate != nil { + nestedLayer3NdpProxyAddress.Negate = util.YesNo(oLayer3NdpProxyAddress.Negate, nil) + } + nestedLayer3.NdpProxy.Address = append(nestedLayer3.NdpProxy.Address, nestedLayer3NdpProxyAddress) + } + } + if o.Layer3.NdpProxy.Enabled != nil { + nestedLayer3.NdpProxy.Enabled = util.YesNo(o.Layer3.NdpProxy.Enabled, nil) + } + } + if o.Layer3.NetflowProfile != nil { + nestedLayer3.NetflowProfile = o.Layer3.NetflowProfile + } + if o.Layer3.ClusterInterconnect != nil { + nestedLayer3.ClusterInterconnect = util.YesNo(o.Layer3.ClusterInterconnect, nil) + } + if o.Layer3.DecryptForward != nil { + nestedLayer3.DecryptForward = util.YesNo(o.Layer3.DecryptForward, nil) + } + if o.Layer3.DhcpClient != nil { + nestedLayer3.DhcpClient = &Layer3DhcpClientXml_11_0_2{} + if _, ok := o.Misc["Layer3DhcpClient"]; ok { + nestedLayer3.DhcpClient.Misc = o.Misc["Layer3DhcpClient"] + } + if o.Layer3.DhcpClient.CreateDefaultRoute != nil { + nestedLayer3.DhcpClient.CreateDefaultRoute = util.YesNo(o.Layer3.DhcpClient.CreateDefaultRoute, nil) + } + if o.Layer3.DhcpClient.DefaultRouteMetric != nil { + nestedLayer3.DhcpClient.DefaultRouteMetric = o.Layer3.DhcpClient.DefaultRouteMetric + } + if o.Layer3.DhcpClient.Enable != nil { + nestedLayer3.DhcpClient.Enable = util.YesNo(o.Layer3.DhcpClient.Enable, nil) + } + if o.Layer3.DhcpClient.SendHostname != nil { + nestedLayer3.DhcpClient.SendHostname = &Layer3DhcpClientSendHostnameXml_11_0_2{} + if _, ok := o.Misc["Layer3DhcpClientSendHostname"]; ok { + nestedLayer3.DhcpClient.SendHostname.Misc = o.Misc["Layer3DhcpClientSendHostname"] + } + if o.Layer3.DhcpClient.SendHostname.Enable != nil { + nestedLayer3.DhcpClient.SendHostname.Enable = util.YesNo(o.Layer3.DhcpClient.SendHostname.Enable, nil) + } + if o.Layer3.DhcpClient.SendHostname.Hostname != nil { + nestedLayer3.DhcpClient.SendHostname.Hostname = o.Layer3.DhcpClient.SendHostname.Hostname + } + } + } + if o.Layer3.Mtu != nil { + nestedLayer3.Mtu = o.Layer3.Mtu + } + if o.Layer3.TrafficInterconnect != nil { + nestedLayer3.TrafficInterconnect = util.YesNo(o.Layer3.TrafficInterconnect, nil) + } + if o.Layer3.Arp != nil { + nestedLayer3.Arp = []Layer3ArpXml_11_0_2{} + for _, oLayer3Arp := range o.Layer3.Arp { + nestedLayer3Arp := Layer3ArpXml_11_0_2{} + if _, ok := o.Misc["Layer3Arp"]; ok { + nestedLayer3Arp.Misc = o.Misc["Layer3Arp"] + } + if oLayer3Arp.HwAddress != nil { + nestedLayer3Arp.HwAddress = oLayer3Arp.HwAddress + } + if oLayer3Arp.Name != "" { + nestedLayer3Arp.Name = oLayer3Arp.Name + } + nestedLayer3.Arp = append(nestedLayer3.Arp, nestedLayer3Arp) + } + } + if o.Layer3.Ip != nil { + nestedLayer3.Ip = []Layer3IpXml_11_0_2{} + for _, oLayer3Ip := range o.Layer3.Ip { + nestedLayer3Ip := Layer3IpXml_11_0_2{} + if _, ok := o.Misc["Layer3Ip"]; ok { + nestedLayer3Ip.Misc = o.Misc["Layer3Ip"] + } + if oLayer3Ip.SdwanGateway != nil { + nestedLayer3Ip.SdwanGateway = oLayer3Ip.SdwanGateway + } + if oLayer3Ip.Name != "" { + nestedLayer3Ip.Name = oLayer3Ip.Name + } + nestedLayer3.Ip = append(nestedLayer3.Ip, nestedLayer3Ip) + } + } + if o.Layer3.Ipv6 != nil { + nestedLayer3.Ipv6 = &Layer3Ipv6Xml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6"]; ok { + nestedLayer3.Ipv6.Misc = o.Misc["Layer3Ipv6"] + } + if o.Layer3.Ipv6.Address != nil { + nestedLayer3.Ipv6.Address = []Layer3Ipv6AddressXml_11_0_2{} + for _, oLayer3Ipv6Address := range o.Layer3.Ipv6.Address { + nestedLayer3Ipv6Address := Layer3Ipv6AddressXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6Address"]; ok { + nestedLayer3Ipv6Address.Misc = o.Misc["Layer3Ipv6Address"] + } + if oLayer3Ipv6Address.Name != "" { + nestedLayer3Ipv6Address.Name = oLayer3Ipv6Address.Name + } + if oLayer3Ipv6Address.EnableOnInterface != nil { + nestedLayer3Ipv6Address.EnableOnInterface = util.YesNo(oLayer3Ipv6Address.EnableOnInterface, nil) + } + if oLayer3Ipv6Address.Prefix != nil { + nestedLayer3Ipv6Address.Prefix = &Layer3Ipv6AddressPrefixXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6AddressPrefix"]; ok { + nestedLayer3Ipv6Address.Prefix.Misc = o.Misc["Layer3Ipv6AddressPrefix"] + } + } + if oLayer3Ipv6Address.Anycast != nil { + nestedLayer3Ipv6Address.Anycast = &Layer3Ipv6AddressAnycastXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6AddressAnycast"]; ok { + nestedLayer3Ipv6Address.Anycast.Misc = o.Misc["Layer3Ipv6AddressAnycast"] + } + } + if oLayer3Ipv6Address.Advertise != nil { + nestedLayer3Ipv6Address.Advertise = &Layer3Ipv6AddressAdvertiseXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6AddressAdvertise"]; ok { + nestedLayer3Ipv6Address.Advertise.Misc = o.Misc["Layer3Ipv6AddressAdvertise"] + } + if oLayer3Ipv6Address.Advertise.Enable != nil { + nestedLayer3Ipv6Address.Advertise.Enable = util.YesNo(oLayer3Ipv6Address.Advertise.Enable, nil) + } + if oLayer3Ipv6Address.Advertise.ValidLifetime != nil { + nestedLayer3Ipv6Address.Advertise.ValidLifetime = oLayer3Ipv6Address.Advertise.ValidLifetime + } + if oLayer3Ipv6Address.Advertise.PreferredLifetime != nil { + nestedLayer3Ipv6Address.Advertise.PreferredLifetime = oLayer3Ipv6Address.Advertise.PreferredLifetime + } + if oLayer3Ipv6Address.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6Address.Advertise.OnlinkFlag = util.YesNo(oLayer3Ipv6Address.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6Address.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6Address.Advertise.AutoConfigFlag = util.YesNo(oLayer3Ipv6Address.Advertise.AutoConfigFlag, nil) + } + } + nestedLayer3.Ipv6.Address = append(nestedLayer3.Ipv6.Address, nestedLayer3Ipv6Address) + } + } + if o.Layer3.Ipv6.Enabled != nil { + nestedLayer3.Ipv6.Enabled = util.YesNo(o.Layer3.Ipv6.Enabled, nil) + } + if o.Layer3.Ipv6.InterfaceId != nil { + nestedLayer3.Ipv6.InterfaceId = o.Layer3.Ipv6.InterfaceId + } + if o.Layer3.Ipv6.NeighborDiscovery != nil { + nestedLayer3.Ipv6.NeighborDiscovery = &Layer3Ipv6NeighborDiscoveryXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscovery"]; ok { + nestedLayer3.Ipv6.NeighborDiscovery.Misc = o.Misc["Layer3Ipv6NeighborDiscovery"] + } + if o.Layer3.Ipv6.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.NeighborDiscovery.EnableDad = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.NeighborDiscovery.EnableNdpMonitor = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = []Layer3Ipv6NeighborDiscoveryNeighborXml_11_0_2{} + for _, oLayer3Ipv6NeighborDiscoveryNeighbor := range o.Layer3.Ipv6.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6NeighborDiscoveryNeighbor := Layer3Ipv6NeighborDiscoveryNeighborXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryNeighbor"]; ok { + nestedLayer3Ipv6NeighborDiscoveryNeighbor.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryNeighbor"] + } + if oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress + } + if oLayer3Ipv6NeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryNeighbor.Name = oLayer3Ipv6NeighborDiscoveryNeighbor.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.NeighborDiscovery.Neighbor, nestedLayer3Ipv6NeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.NeighborDiscovery.NsInterval + } + if o.Layer3.Ipv6.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.ReachableTime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement = &Layer3Ipv6NeighborDiscoveryRouterAdvertisementXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisement"]; ok { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisement"] + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport = &Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport"]; ok { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport"] + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml_11_0_2{} + for _, oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := range o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer"]; ok { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer"] + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime != nil { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = append(nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server, nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer) + } + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml_11_0_2{} + for _, oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := range o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix"]; ok { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix"] + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime != nil { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = append(nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix, nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix) + } + } + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval + } + } + if o.Layer3.Ipv6.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.NeighborDiscovery.DadAttempts + } + } + if o.Layer3.Ipv6.DhcpClient != nil { + nestedLayer3.Ipv6.DhcpClient = &Layer3Ipv6DhcpClientXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClient"]; ok { + nestedLayer3.Ipv6.DhcpClient.Misc = o.Misc["Layer3Ipv6DhcpClient"] + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation = &Layer3Ipv6DhcpClientPrefixDelegationXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientPrefixDelegation"]; ok { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Misc = o.Misc["Layer3Ipv6DhcpClientPrefixDelegation"] + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable = &Layer3Ipv6DhcpClientPrefixDelegationEnableXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnable"]; ok { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Misc = o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnable"] + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No = &Layer3Ipv6DhcpClientPrefixDelegationEnableNoXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableNo"]; ok { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No.Misc = o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableNo"] + } + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes = &Layer3Ipv6DhcpClientPrefixDelegationEnableYesXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableYes"]; ok { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.Misc = o.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableYes"] + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint = util.YesNo(o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint, nil) + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options = &Layer3Ipv6DhcpClientV6OptionsXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientV6Options"]; ok { + nestedLayer3.Ipv6.DhcpClient.V6Options.Misc = o.Misc["Layer3Ipv6DhcpClientV6Options"] + } + if o.Layer3.Ipv6.DhcpClient.V6Options.RapidCommit != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.RapidCommit = util.YesNo(o.Layer3.Ipv6.DhcpClient.V6Options.RapidCommit, nil) + } + if o.Layer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig = util.YesNo(o.Layer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig, nil) + } + if o.Layer3.Ipv6.DhcpClient.V6Options.DuidType != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.DuidType = o.Layer3.Ipv6.DhcpClient.V6Options.DuidType + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable = &Layer3Ipv6DhcpClientV6OptionsEnableXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientV6OptionsEnable"]; ok { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Misc = o.Misc["Layer3Ipv6DhcpClientV6OptionsEnable"] + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes = &Layer3Ipv6DhcpClientV6OptionsEnableYesXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientV6OptionsEnableYes"]; ok { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes.Misc = o.Misc["Layer3Ipv6DhcpClientV6OptionsEnableYes"] + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr = util.YesNo(o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr, nil) + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr = util.YesNo(o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr, nil) + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.No != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.No = &Layer3Ipv6DhcpClientV6OptionsEnableNoXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientV6OptionsEnableNo"]; ok { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.No.Misc = o.Misc["Layer3Ipv6DhcpClientV6OptionsEnableNo"] + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.AcceptRaRoute != nil { + nestedLayer3.Ipv6.DhcpClient.AcceptRaRoute = util.YesNo(o.Layer3.Ipv6.DhcpClient.AcceptRaRoute, nil) + } + if o.Layer3.Ipv6.DhcpClient.DefaultRouteMetric != nil { + nestedLayer3.Ipv6.DhcpClient.DefaultRouteMetric = o.Layer3.Ipv6.DhcpClient.DefaultRouteMetric + } + if o.Layer3.Ipv6.DhcpClient.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.Enable = util.YesNo(o.Layer3.Ipv6.DhcpClient.Enable, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery = &Layer3Ipv6DhcpClientNeighborDiscoveryXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscovery"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscovery"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor = []Layer3Ipv6DhcpClientNeighborDiscoveryNeighborXml_11_0_2{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor := Layer3Ipv6DhcpClientNeighborDiscoveryNeighborXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor"]; ok { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor"] + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor, nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = []Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml_11_0_2{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer"]; ok { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer"] + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6Xml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6"] + } + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable = util.YesNo(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable, nil) + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6Xml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6"] + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual"]; ok { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual"] + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml_11_0_2{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix"]; ok { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc = o.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix"] + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable = util.YesNo(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable, nil) + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad = util.YesNo(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor = util.YesNo(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor, nil) + } + } + if o.Layer3.Ipv6.DhcpClient.Preference != nil { + nestedLayer3.Ipv6.DhcpClient.Preference = o.Layer3.Ipv6.DhcpClient.Preference + } + } + if o.Layer3.Ipv6.Inherited != nil { + nestedLayer3.Ipv6.Inherited = &Layer3Ipv6InheritedXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6Inherited"]; ok { + nestedLayer3.Ipv6.Inherited.Misc = o.Misc["Layer3Ipv6Inherited"] + } + if o.Layer3.Ipv6.Inherited.AssignAddr != nil { + nestedLayer3.Ipv6.Inherited.AssignAddr = []Layer3Ipv6InheritedAssignAddrXml_11_0_2{} + for _, oLayer3Ipv6InheritedAssignAddr := range o.Layer3.Ipv6.Inherited.AssignAddr { + nestedLayer3Ipv6InheritedAssignAddr := Layer3Ipv6InheritedAssignAddrXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddr"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Misc = o.Misc["Layer3Ipv6InheritedAssignAddr"] + } + if oLayer3Ipv6InheritedAssignAddr.Type != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type = &Layer3Ipv6InheritedAssignAddrTypeXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrType"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrType"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua = &Layer3Ipv6InheritedAssignAddrTypeGuaXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeGua"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeGua"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolType"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolType"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic"] + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicIdXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier + } + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise = &Layer3Ipv6InheritedAssignAddrTypeGuaAdvertiseXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag, nil) + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula = &Layer3Ipv6InheritedAssignAddrTypeUlaXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeUla"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeUla"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Address != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Address = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Address + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise = &Layer3Ipv6InheritedAssignAddrTypeUlaAdvertiseXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise"]; ok { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Misc = o.Misc["Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise"] + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag = util.YesNo(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag, nil) + } + } + } + } + if oLayer3Ipv6InheritedAssignAddr.Name != "" { + nestedLayer3Ipv6InheritedAssignAddr.Name = oLayer3Ipv6InheritedAssignAddr.Name + } + nestedLayer3.Ipv6.Inherited.AssignAddr = append(nestedLayer3.Ipv6.Inherited.AssignAddr, nestedLayer3Ipv6InheritedAssignAddr) + } + } + if o.Layer3.Ipv6.Inherited.Enable != nil { + nestedLayer3.Ipv6.Inherited.Enable = util.YesNo(o.Layer3.Ipv6.Inherited.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery = &Layer3Ipv6InheritedNeighborDiscoveryXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscovery"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscovery"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.NsInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement = &Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisementXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServer"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServer"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6Xml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = []Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml_11_0_2{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer := Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer"]; ok { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer"] + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name = oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6Xml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual"]; ok { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual"] + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml_11_0_2{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix"]; ok { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix"] + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable, nil) + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor = []Layer3Ipv6InheritedNeighborDiscoveryNeighborXml_11_0_2{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryNeighbor := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor := Layer3Ipv6InheritedNeighborDiscoveryNeighborXml_11_0_2{} + if _, ok := o.Misc["Layer3Ipv6InheritedNeighborDiscoveryNeighbor"]; ok { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Misc = o.Misc["Layer3Ipv6InheritedNeighborDiscoveryNeighbor"] + } + if oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress + } + if oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name = oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor, nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.EnableDad = util.YesNo(o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableDad, nil) + } + } + } + } + if o.Layer3.Lldp != nil { + nestedLayer3.Lldp = &Layer3LldpXml_11_0_2{} + if _, ok := o.Misc["Layer3Lldp"]; ok { + nestedLayer3.Lldp.Misc = o.Misc["Layer3Lldp"] + } + if o.Layer3.Lldp.Enable != nil { + nestedLayer3.Lldp.Enable = util.YesNo(o.Layer3.Lldp.Enable, nil) + } + if o.Layer3.Lldp.HighAvailability != nil { + nestedLayer3.Lldp.HighAvailability = &Layer3LldpHighAvailabilityXml_11_0_2{} + if _, ok := o.Misc["Layer3LldpHighAvailability"]; ok { + nestedLayer3.Lldp.HighAvailability.Misc = o.Misc["Layer3LldpHighAvailability"] + } + if o.Layer3.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer3.Lldp.HighAvailability.PassivePreNegotiation = util.YesNo(o.Layer3.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.Layer3.Lldp.Profile != nil { + nestedLayer3.Lldp.Profile = o.Layer3.Lldp.Profile + } + } + if o.Layer3.SdwanLinkSettings != nil { + nestedLayer3.SdwanLinkSettings = &Layer3SdwanLinkSettingsXml_11_0_2{} + if _, ok := o.Misc["Layer3SdwanLinkSettings"]; ok { + nestedLayer3.SdwanLinkSettings.Misc = o.Misc["Layer3SdwanLinkSettings"] + } + if o.Layer3.SdwanLinkSettings.UpstreamNat != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat = &Layer3SdwanLinkSettingsUpstreamNatXml_11_0_2{} + if _, ok := o.Misc["Layer3SdwanLinkSettingsUpstreamNat"]; ok { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Misc = o.Misc["Layer3SdwanLinkSettingsUpstreamNat"] + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.Enable != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Enable = util.YesNo(o.Layer3.SdwanLinkSettings.UpstreamNat.Enable, nil) + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.Ddns != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Ddns = &Layer3SdwanLinkSettingsUpstreamNatDdnsXml_11_0_2{} + if _, ok := o.Misc["Layer3SdwanLinkSettingsUpstreamNatDdns"]; ok { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Ddns.Misc = o.Misc["Layer3SdwanLinkSettingsUpstreamNatDdns"] + } + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp = &Layer3SdwanLinkSettingsUpstreamNatStaticIpXml_11_0_2{} + if _, ok := o.Misc["Layer3SdwanLinkSettingsUpstreamNatStaticIp"]; ok { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp.Misc = o.Misc["Layer3SdwanLinkSettingsUpstreamNatStaticIp"] + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress + } + } + } + if o.Layer3.SdwanLinkSettings.Enable != nil { + nestedLayer3.SdwanLinkSettings.Enable = util.YesNo(o.Layer3.SdwanLinkSettings.Enable, nil) + } + if o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile != nil { + nestedLayer3.SdwanLinkSettings.SdwanInterfaceProfile = o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile + } + } + if o.Layer3.UntaggedSubInterface != nil { + nestedLayer3.UntaggedSubInterface = util.YesNo(o.Layer3.UntaggedSubInterface, nil) + } + if o.Layer3.AdjustTcpMss != nil { + nestedLayer3.AdjustTcpMss = &Layer3AdjustTcpMssXml_11_0_2{} + if _, ok := o.Misc["Layer3AdjustTcpMss"]; ok { + nestedLayer3.AdjustTcpMss.Misc = o.Misc["Layer3AdjustTcpMss"] + } + if o.Layer3.AdjustTcpMss.Enable != nil { + nestedLayer3.AdjustTcpMss.Enable = util.YesNo(o.Layer3.AdjustTcpMss.Enable, nil) + } + if o.Layer3.AdjustTcpMss.Ipv4MssAdjustment != nil { + nestedLayer3.AdjustTcpMss.Ipv4MssAdjustment = o.Layer3.AdjustTcpMss.Ipv4MssAdjustment + } + if o.Layer3.AdjustTcpMss.Ipv6MssAdjustment != nil { + nestedLayer3.AdjustTcpMss.Ipv6MssAdjustment = o.Layer3.AdjustTcpMss.Ipv6MssAdjustment + } + } + if o.Layer3.InterfaceManagementProfile != nil { + nestedLayer3.InterfaceManagementProfile = o.Layer3.InterfaceManagementProfile + } + } + entry.Layer3 = nestedLayer3 + + var nestedLogCard *LogCardXml_11_0_2 + if o.LogCard != nil { + nestedLogCard = &LogCardXml_11_0_2{} + if _, ok := o.Misc["LogCard"]; ok { + nestedLogCard.Misc = o.Misc["LogCard"] + } + if o.LogCard.Ipv6DefaultGateway != nil { + nestedLogCard.Ipv6DefaultGateway = o.LogCard.Ipv6DefaultGateway + } + if o.LogCard.Netmask != nil { + nestedLogCard.Netmask = o.LogCard.Netmask + } + if o.LogCard.DefaultGateway != nil { + nestedLogCard.DefaultGateway = o.LogCard.DefaultGateway + } + if o.LogCard.IpAddress != nil { + nestedLogCard.IpAddress = o.LogCard.IpAddress + } + if o.LogCard.Ipv6Address != nil { + nestedLogCard.Ipv6Address = o.LogCard.Ipv6Address + } + } + entry.LogCard = nestedLogCard + + var nestedTap *TapXml_11_0_2 + if o.Tap != nil { + nestedTap = &TapXml_11_0_2{} + if _, ok := o.Misc["Tap"]; ok { + nestedTap.Misc = o.Misc["Tap"] + } + if o.Tap.NetflowProfile != nil { + nestedTap.NetflowProfile = o.Tap.NetflowProfile + } + } + entry.Tap = nestedTap + + var nestedVirtualWire *VirtualWireXml_11_0_2 + if o.VirtualWire != nil { + nestedVirtualWire = &VirtualWireXml_11_0_2{} + if _, ok := o.Misc["VirtualWire"]; ok { + nestedVirtualWire.Misc = o.Misc["VirtualWire"] + } + if o.VirtualWire.Lacp != nil { + nestedVirtualWire.Lacp = &VirtualWireLacpXml_11_0_2{} + if _, ok := o.Misc["VirtualWireLacp"]; ok { + nestedVirtualWire.Lacp.Misc = o.Misc["VirtualWireLacp"] + } + if o.VirtualWire.Lacp.HighAvailability != nil { + nestedVirtualWire.Lacp.HighAvailability = &VirtualWireLacpHighAvailabilityXml_11_0_2{} + if _, ok := o.Misc["VirtualWireLacpHighAvailability"]; ok { + nestedVirtualWire.Lacp.HighAvailability.Misc = o.Misc["VirtualWireLacpHighAvailability"] + } + if o.VirtualWire.Lacp.HighAvailability.PassivePreNegotiation != nil { + nestedVirtualWire.Lacp.HighAvailability.PassivePreNegotiation = util.YesNo(o.VirtualWire.Lacp.HighAvailability.PassivePreNegotiation, nil) + } + } + } + if o.VirtualWire.Lldp != nil { + nestedVirtualWire.Lldp = &VirtualWireLldpXml_11_0_2{} + if _, ok := o.Misc["VirtualWireLldp"]; ok { + nestedVirtualWire.Lldp.Misc = o.Misc["VirtualWireLldp"] + } + if o.VirtualWire.Lldp.Enable != nil { + nestedVirtualWire.Lldp.Enable = util.YesNo(o.VirtualWire.Lldp.Enable, nil) + } + if o.VirtualWire.Lldp.HighAvailability != nil { + nestedVirtualWire.Lldp.HighAvailability = &VirtualWireLldpHighAvailabilityXml_11_0_2{} + if _, ok := o.Misc["VirtualWireLldpHighAvailability"]; ok { + nestedVirtualWire.Lldp.HighAvailability.Misc = o.Misc["VirtualWireLldpHighAvailability"] + } + if o.VirtualWire.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedVirtualWire.Lldp.HighAvailability.PassivePreNegotiation = util.YesNo(o.VirtualWire.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.VirtualWire.Lldp.Profile != nil { + nestedVirtualWire.Lldp.Profile = o.VirtualWire.Lldp.Profile + } + } + if o.VirtualWire.NetflowProfile != nil { + nestedVirtualWire.NetflowProfile = o.VirtualWire.NetflowProfile + } + } + entry.VirtualWire = nestedVirtualWire + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.Comment = o.Comment + var nestedLacp *Lacp + if o.Lacp != nil { + nestedLacp = &Lacp{} + if o.Lacp.Misc != nil { + entry.Misc["Lacp"] = o.Lacp.Misc + } + if o.Lacp.PortPriority != nil { + nestedLacp.PortPriority = o.Lacp.PortPriority + } + } + entry.Lacp = nestedLacp + + entry.LinkDuplex = o.LinkDuplex + entry.LinkSpeed = o.LinkSpeed + entry.LinkState = o.LinkState + var nestedPoe *Poe + if o.Poe != nil { + nestedPoe = &Poe{} + if o.Poe.Misc != nil { + entry.Misc["Poe"] = o.Poe.Misc + } + if o.Poe.PoeEnabled != nil { + nestedPoe.PoeEnabled = util.AsBool(o.Poe.PoeEnabled, nil) + } + if o.Poe.PoeRsvdPwr != nil { + nestedPoe.PoeRsvdPwr = o.Poe.PoeRsvdPwr + } + } + entry.Poe = nestedPoe + + entry.AggregateGroup = o.AggregateGroup + var nestedDecryptMirror *DecryptMirror + if o.DecryptMirror != nil { + nestedDecryptMirror = &DecryptMirror{} + if o.DecryptMirror.Misc != nil { + entry.Misc["DecryptMirror"] = o.DecryptMirror.Misc + } + } + entry.DecryptMirror = nestedDecryptMirror + + var nestedHa *Ha + if o.Ha != nil { + nestedHa = &Ha{} + if o.Ha.Misc != nil { + entry.Misc["Ha"] = o.Ha.Misc + } + } + entry.Ha = nestedHa + + var nestedLayer2 *Layer2 + if o.Layer2 != nil { + nestedLayer2 = &Layer2{} + if o.Layer2.Misc != nil { + entry.Misc["Layer2"] = o.Layer2.Misc + } + if o.Layer2.Lldp != nil { + nestedLayer2.Lldp = &Layer2Lldp{} + if o.Layer2.Lldp.Misc != nil { + entry.Misc["Layer2Lldp"] = o.Layer2.Lldp.Misc + } + if o.Layer2.Lldp.Enable != nil { + nestedLayer2.Lldp.Enable = util.AsBool(o.Layer2.Lldp.Enable, nil) + } + if o.Layer2.Lldp.HighAvailability != nil { + nestedLayer2.Lldp.HighAvailability = &Layer2LldpHighAvailability{} + if o.Layer2.Lldp.HighAvailability.Misc != nil { + entry.Misc["Layer2LldpHighAvailability"] = o.Layer2.Lldp.HighAvailability.Misc + } + if o.Layer2.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer2.Lldp.HighAvailability.PassivePreNegotiation = util.AsBool(o.Layer2.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.Layer2.Lldp.Profile != nil { + nestedLayer2.Lldp.Profile = o.Layer2.Lldp.Profile + } + } + if o.Layer2.NetflowProfile != nil { + nestedLayer2.NetflowProfile = o.Layer2.NetflowProfile + } + } + entry.Layer2 = nestedLayer2 + + var nestedLayer3 *Layer3 + if o.Layer3 != nil { + nestedLayer3 = &Layer3{} + if o.Layer3.Misc != nil { + entry.Misc["Layer3"] = o.Layer3.Misc + } + if o.Layer3.Arp != nil { + nestedLayer3.Arp = []Layer3Arp{} + for _, oLayer3Arp := range o.Layer3.Arp { + nestedLayer3Arp := Layer3Arp{} + if oLayer3Arp.Misc != nil { + entry.Misc["Layer3Arp"] = oLayer3Arp.Misc + } + if oLayer3Arp.HwAddress != nil { + nestedLayer3Arp.HwAddress = oLayer3Arp.HwAddress + } + if oLayer3Arp.Name != "" { + nestedLayer3Arp.Name = oLayer3Arp.Name + } + nestedLayer3.Arp = append(nestedLayer3.Arp, nestedLayer3Arp) + } + } + if o.Layer3.Ip != nil { + nestedLayer3.Ip = []Layer3Ip{} + for _, oLayer3Ip := range o.Layer3.Ip { + nestedLayer3Ip := Layer3Ip{} + if oLayer3Ip.Misc != nil { + entry.Misc["Layer3Ip"] = oLayer3Ip.Misc + } + if oLayer3Ip.SdwanGateway != nil { + nestedLayer3Ip.SdwanGateway = oLayer3Ip.SdwanGateway + } + if oLayer3Ip.Name != "" { + nestedLayer3Ip.Name = oLayer3Ip.Name + } + nestedLayer3.Ip = append(nestedLayer3.Ip, nestedLayer3Ip) + } + } + if o.Layer3.Mtu != nil { + nestedLayer3.Mtu = o.Layer3.Mtu + } + if o.Layer3.TrafficInterconnect != nil { + nestedLayer3.TrafficInterconnect = util.AsBool(o.Layer3.TrafficInterconnect, nil) + } + if o.Layer3.AdjustTcpMss != nil { + nestedLayer3.AdjustTcpMss = &Layer3AdjustTcpMss{} + if o.Layer3.AdjustTcpMss.Misc != nil { + entry.Misc["Layer3AdjustTcpMss"] = o.Layer3.AdjustTcpMss.Misc + } + if o.Layer3.AdjustTcpMss.Enable != nil { + nestedLayer3.AdjustTcpMss.Enable = util.AsBool(o.Layer3.AdjustTcpMss.Enable, nil) + } + if o.Layer3.AdjustTcpMss.Ipv4MssAdjustment != nil { + nestedLayer3.AdjustTcpMss.Ipv4MssAdjustment = o.Layer3.AdjustTcpMss.Ipv4MssAdjustment + } + if o.Layer3.AdjustTcpMss.Ipv6MssAdjustment != nil { + nestedLayer3.AdjustTcpMss.Ipv6MssAdjustment = o.Layer3.AdjustTcpMss.Ipv6MssAdjustment + } + } + if o.Layer3.InterfaceManagementProfile != nil { + nestedLayer3.InterfaceManagementProfile = o.Layer3.InterfaceManagementProfile + } + if o.Layer3.Ipv6 != nil { + nestedLayer3.Ipv6 = &Layer3Ipv6{} + if o.Layer3.Ipv6.Misc != nil { + entry.Misc["Layer3Ipv6"] = o.Layer3.Ipv6.Misc + } + if o.Layer3.Ipv6.Inherited != nil { + nestedLayer3.Ipv6.Inherited = &Layer3Ipv6Inherited{} + if o.Layer3.Ipv6.Inherited.Misc != nil { + entry.Misc["Layer3Ipv6Inherited"] = o.Layer3.Ipv6.Inherited.Misc + } + if o.Layer3.Ipv6.Inherited.AssignAddr != nil { + nestedLayer3.Ipv6.Inherited.AssignAddr = []Layer3Ipv6InheritedAssignAddr{} + for _, oLayer3Ipv6InheritedAssignAddr := range o.Layer3.Ipv6.Inherited.AssignAddr { + nestedLayer3Ipv6InheritedAssignAddr := Layer3Ipv6InheritedAssignAddr{} + if oLayer3Ipv6InheritedAssignAddr.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddr"] = oLayer3Ipv6InheritedAssignAddr.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type = &Layer3Ipv6InheritedAssignAddrType{} + if oLayer3Ipv6InheritedAssignAddr.Type.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrType"] = oLayer3Ipv6InheritedAssignAddr.Type.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua = &Layer3Ipv6InheritedAssignAddrTypeGua{} + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeGua"] = oLayer3Ipv6InheritedAssignAddr.Type.Gua.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolType{} + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolType"] = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic{} + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic"] = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic.Misc + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId{} + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId"] = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier + } + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise = &Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise{} + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise"] = oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag, nil) + } + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula = &Layer3Ipv6InheritedAssignAddrTypeUla{} + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeUla"] = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise = &Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise{} + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise"] = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable, nil) + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Address != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Address = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Address + } + } + } + if oLayer3Ipv6InheritedAssignAddr.Name != "" { + nestedLayer3Ipv6InheritedAssignAddr.Name = oLayer3Ipv6InheritedAssignAddr.Name + } + nestedLayer3.Ipv6.Inherited.AssignAddr = append(nestedLayer3.Ipv6.Inherited.AssignAddr, nestedLayer3Ipv6InheritedAssignAddr) + } + } + if o.Layer3.Ipv6.Inherited.Enable != nil { + nestedLayer3.Ipv6.Inherited.Enable = util.AsBool(o.Layer3.Ipv6.Inherited.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery = &Layer3Ipv6InheritedNeighborDiscovery{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscovery"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer = &Layer3Ipv6InheritedNeighborDiscoveryDnsServer{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServer"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = []Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer := Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer{} + if oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer"] = oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Misc + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name = oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix{} + if oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix"] = oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.NsInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement = &Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.EnableDad = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor = []Layer3Ipv6InheritedNeighborDiscoveryNeighbor{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryNeighbor := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor := Layer3Ipv6InheritedNeighborDiscoveryNeighbor{} + if oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryNeighbor"] = oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Misc + } + if oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress + } + if oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name = oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor, nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime + } + } + } + if o.Layer3.Ipv6.Address != nil { + nestedLayer3.Ipv6.Address = []Layer3Ipv6Address{} + for _, oLayer3Ipv6Address := range o.Layer3.Ipv6.Address { + nestedLayer3Ipv6Address := Layer3Ipv6Address{} + if oLayer3Ipv6Address.Misc != nil { + entry.Misc["Layer3Ipv6Address"] = oLayer3Ipv6Address.Misc + } + if oLayer3Ipv6Address.EnableOnInterface != nil { + nestedLayer3Ipv6Address.EnableOnInterface = util.AsBool(oLayer3Ipv6Address.EnableOnInterface, nil) + } + if oLayer3Ipv6Address.Prefix != nil { + nestedLayer3Ipv6Address.Prefix = &Layer3Ipv6AddressPrefix{} + if oLayer3Ipv6Address.Prefix.Misc != nil { + entry.Misc["Layer3Ipv6AddressPrefix"] = oLayer3Ipv6Address.Prefix.Misc + } + } + if oLayer3Ipv6Address.Anycast != nil { + nestedLayer3Ipv6Address.Anycast = &Layer3Ipv6AddressAnycast{} + if oLayer3Ipv6Address.Anycast.Misc != nil { + entry.Misc["Layer3Ipv6AddressAnycast"] = oLayer3Ipv6Address.Anycast.Misc + } + } + if oLayer3Ipv6Address.Advertise != nil { + nestedLayer3Ipv6Address.Advertise = &Layer3Ipv6AddressAdvertise{} + if oLayer3Ipv6Address.Advertise.Misc != nil { + entry.Misc["Layer3Ipv6AddressAdvertise"] = oLayer3Ipv6Address.Advertise.Misc + } + if oLayer3Ipv6Address.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6Address.Advertise.AutoConfigFlag = util.AsBool(oLayer3Ipv6Address.Advertise.AutoConfigFlag, nil) + } + if oLayer3Ipv6Address.Advertise.Enable != nil { + nestedLayer3Ipv6Address.Advertise.Enable = util.AsBool(oLayer3Ipv6Address.Advertise.Enable, nil) + } + if oLayer3Ipv6Address.Advertise.ValidLifetime != nil { + nestedLayer3Ipv6Address.Advertise.ValidLifetime = oLayer3Ipv6Address.Advertise.ValidLifetime + } + if oLayer3Ipv6Address.Advertise.PreferredLifetime != nil { + nestedLayer3Ipv6Address.Advertise.PreferredLifetime = oLayer3Ipv6Address.Advertise.PreferredLifetime + } + if oLayer3Ipv6Address.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6Address.Advertise.OnlinkFlag = util.AsBool(oLayer3Ipv6Address.Advertise.OnlinkFlag, nil) + } + } + if oLayer3Ipv6Address.Name != "" { + nestedLayer3Ipv6Address.Name = oLayer3Ipv6Address.Name + } + nestedLayer3.Ipv6.Address = append(nestedLayer3.Ipv6.Address, nestedLayer3Ipv6Address) + } + } + if o.Layer3.Ipv6.Enabled != nil { + nestedLayer3.Ipv6.Enabled = util.AsBool(o.Layer3.Ipv6.Enabled, nil) + } + if o.Layer3.Ipv6.InterfaceId != nil { + nestedLayer3.Ipv6.InterfaceId = o.Layer3.Ipv6.InterfaceId + } + if o.Layer3.Ipv6.NeighborDiscovery != nil { + nestedLayer3.Ipv6.NeighborDiscovery = &Layer3Ipv6NeighborDiscovery{} + if o.Layer3.Ipv6.NeighborDiscovery.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscovery"] = o.Layer3.Ipv6.NeighborDiscovery.Misc + } + if o.Layer3.Ipv6.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.NeighborDiscovery.NsInterval + } + if o.Layer3.Ipv6.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.ReachableTime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement = &Layer3Ipv6NeighborDiscoveryRouterAdvertisement{} + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisement"] = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Misc + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport = &Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport{} + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport"] = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Misc + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer{} + for _, oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := range o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer{} + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer"] = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Misc + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime != nil { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = append(nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server, nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer) + } + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix{} + for _, oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := range o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix{} + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix"] = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Misc + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime != nil { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = append(nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix, nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix) + } + } + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + } + if o.Layer3.Ipv6.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.NeighborDiscovery.EnableDad = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.NeighborDiscovery.EnableNdpMonitor = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = []Layer3Ipv6NeighborDiscoveryNeighbor{} + for _, oLayer3Ipv6NeighborDiscoveryNeighbor := range o.Layer3.Ipv6.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6NeighborDiscoveryNeighbor := Layer3Ipv6NeighborDiscoveryNeighbor{} + if oLayer3Ipv6NeighborDiscoveryNeighbor.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscoveryNeighbor"] = oLayer3Ipv6NeighborDiscoveryNeighbor.Misc + } + if oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress + } + if oLayer3Ipv6NeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryNeighbor.Name = oLayer3Ipv6NeighborDiscoveryNeighbor.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.NeighborDiscovery.Neighbor, nestedLayer3Ipv6NeighborDiscoveryNeighbor) + } + } + } + if o.Layer3.Ipv6.DhcpClient != nil { + nestedLayer3.Ipv6.DhcpClient = &Layer3Ipv6DhcpClient{} + if o.Layer3.Ipv6.DhcpClient.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClient"] = o.Layer3.Ipv6.DhcpClient.Misc + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation = &Layer3Ipv6DhcpClientPrefixDelegation{} + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientPrefixDelegation"] = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Misc + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable = &Layer3Ipv6DhcpClientPrefixDelegationEnable{} + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnable"] = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Misc + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No = &Layer3Ipv6DhcpClientPrefixDelegationEnableNo{} + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableNo"] = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No.Misc + } + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes = &Layer3Ipv6DhcpClientPrefixDelegationEnableYes{} + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableYes"] = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.Misc + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint = util.AsBool(o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint, nil) + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options = &Layer3Ipv6DhcpClientV6Options{} + if o.Layer3.Ipv6.DhcpClient.V6Options.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientV6Options"] = o.Layer3.Ipv6.DhcpClient.V6Options.Misc + } + if o.Layer3.Ipv6.DhcpClient.V6Options.DuidType != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.DuidType = o.Layer3.Ipv6.DhcpClient.V6Options.DuidType + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable = &Layer3Ipv6DhcpClientV6OptionsEnable{} + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientV6OptionsEnable"] = o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Misc + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.No != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.No = &Layer3Ipv6DhcpClientV6OptionsEnableNo{} + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.No.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientV6OptionsEnableNo"] = o.Layer3.Ipv6.DhcpClient.V6Options.Enable.No.Misc + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes = &Layer3Ipv6DhcpClientV6OptionsEnableYes{} + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientV6OptionsEnableYes"] = o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.Misc + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr = util.AsBool(o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr, nil) + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr = util.AsBool(o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr, nil) + } + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options.RapidCommit != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.RapidCommit = util.AsBool(o.Layer3.Ipv6.DhcpClient.V6Options.RapidCommit, nil) + } + if o.Layer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig = util.AsBool(o.Layer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig, nil) + } + } + if o.Layer3.Ipv6.DhcpClient.AcceptRaRoute != nil { + nestedLayer3.Ipv6.DhcpClient.AcceptRaRoute = util.AsBool(o.Layer3.Ipv6.DhcpClient.AcceptRaRoute, nil) + } + if o.Layer3.Ipv6.DhcpClient.DefaultRouteMetric != nil { + nestedLayer3.Ipv6.DhcpClient.DefaultRouteMetric = o.Layer3.Ipv6.DhcpClient.DefaultRouteMetric + } + if o.Layer3.Ipv6.DhcpClient.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.Enable = util.AsBool(o.Layer3.Ipv6.DhcpClient.Enable, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery = &Layer3Ipv6DhcpClientNeighborDiscovery{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscovery"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable = util.AsBool(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = []Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer{} + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer"] = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Misc + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable = util.AsBool(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix{} + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix"] = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad = util.AsBool(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor = util.AsBool(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor = []Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor := Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor{} + if oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor"] = oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Misc + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor, nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts + } + } + if o.Layer3.Ipv6.DhcpClient.Preference != nil { + nestedLayer3.Ipv6.DhcpClient.Preference = o.Layer3.Ipv6.DhcpClient.Preference + } + } + } + if o.Layer3.Lldp != nil { + nestedLayer3.Lldp = &Layer3Lldp{} + if o.Layer3.Lldp.Misc != nil { + entry.Misc["Layer3Lldp"] = o.Layer3.Lldp.Misc + } + if o.Layer3.Lldp.Enable != nil { + nestedLayer3.Lldp.Enable = util.AsBool(o.Layer3.Lldp.Enable, nil) + } + if o.Layer3.Lldp.HighAvailability != nil { + nestedLayer3.Lldp.HighAvailability = &Layer3LldpHighAvailability{} + if o.Layer3.Lldp.HighAvailability.Misc != nil { + entry.Misc["Layer3LldpHighAvailability"] = o.Layer3.Lldp.HighAvailability.Misc + } + if o.Layer3.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer3.Lldp.HighAvailability.PassivePreNegotiation = util.AsBool(o.Layer3.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.Layer3.Lldp.Profile != nil { + nestedLayer3.Lldp.Profile = o.Layer3.Lldp.Profile + } + } + if o.Layer3.SdwanLinkSettings != nil { + nestedLayer3.SdwanLinkSettings = &Layer3SdwanLinkSettings{} + if o.Layer3.SdwanLinkSettings.Misc != nil { + entry.Misc["Layer3SdwanLinkSettings"] = o.Layer3.SdwanLinkSettings.Misc + } + if o.Layer3.SdwanLinkSettings.Enable != nil { + nestedLayer3.SdwanLinkSettings.Enable = util.AsBool(o.Layer3.SdwanLinkSettings.Enable, nil) + } + if o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile != nil { + nestedLayer3.SdwanLinkSettings.SdwanInterfaceProfile = o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile + } + if o.Layer3.SdwanLinkSettings.UpstreamNat != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat = &Layer3SdwanLinkSettingsUpstreamNat{} + if o.Layer3.SdwanLinkSettings.UpstreamNat.Misc != nil { + entry.Misc["Layer3SdwanLinkSettingsUpstreamNat"] = o.Layer3.SdwanLinkSettings.UpstreamNat.Misc + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.Enable != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Enable = util.AsBool(o.Layer3.SdwanLinkSettings.UpstreamNat.Enable, nil) + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.Ddns != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Ddns = &Layer3SdwanLinkSettingsUpstreamNatDdns{} + if o.Layer3.SdwanLinkSettings.UpstreamNat.Ddns.Misc != nil { + entry.Misc["Layer3SdwanLinkSettingsUpstreamNatDdns"] = o.Layer3.SdwanLinkSettings.UpstreamNat.Ddns.Misc + } + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp = &Layer3SdwanLinkSettingsUpstreamNatStaticIp{} + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Misc != nil { + entry.Misc["Layer3SdwanLinkSettingsUpstreamNatStaticIp"] = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Misc + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress + } + } + } + } + if o.Layer3.UntaggedSubInterface != nil { + nestedLayer3.UntaggedSubInterface = util.AsBool(o.Layer3.UntaggedSubInterface, nil) + } + if o.Layer3.Bonjour != nil { + nestedLayer3.Bonjour = &Layer3Bonjour{} + if o.Layer3.Bonjour.Misc != nil { + entry.Misc["Layer3Bonjour"] = o.Layer3.Bonjour.Misc + } + if o.Layer3.Bonjour.Enable != nil { + nestedLayer3.Bonjour.Enable = util.AsBool(o.Layer3.Bonjour.Enable, nil) + } + if o.Layer3.Bonjour.GroupId != nil { + nestedLayer3.Bonjour.GroupId = o.Layer3.Bonjour.GroupId + } + if o.Layer3.Bonjour.TtlCheck != nil { + nestedLayer3.Bonjour.TtlCheck = util.AsBool(o.Layer3.Bonjour.TtlCheck, nil) + } + } + if o.Layer3.DdnsConfig != nil { + nestedLayer3.DdnsConfig = &Layer3DdnsConfig{} + if o.Layer3.DdnsConfig.Misc != nil { + entry.Misc["Layer3DdnsConfig"] = o.Layer3.DdnsConfig.Misc + } + if o.Layer3.DdnsConfig.DdnsEnabled != nil { + nestedLayer3.DdnsConfig.DdnsEnabled = util.AsBool(o.Layer3.DdnsConfig.DdnsEnabled, nil) + } + if o.Layer3.DdnsConfig.DdnsHostname != nil { + nestedLayer3.DdnsConfig.DdnsHostname = o.Layer3.DdnsConfig.DdnsHostname + } + if o.Layer3.DdnsConfig.DdnsIp != nil { + nestedLayer3.DdnsConfig.DdnsIp = util.MemToStr(o.Layer3.DdnsConfig.DdnsIp) + } + if o.Layer3.DdnsConfig.DdnsIpv6 != nil { + nestedLayer3.DdnsConfig.DdnsIpv6 = util.MemToStr(o.Layer3.DdnsConfig.DdnsIpv6) + } + if o.Layer3.DdnsConfig.DdnsUpdateInterval != nil { + nestedLayer3.DdnsConfig.DdnsUpdateInterval = o.Layer3.DdnsConfig.DdnsUpdateInterval + } + if o.Layer3.DdnsConfig.DdnsVendor != nil { + nestedLayer3.DdnsConfig.DdnsVendor = o.Layer3.DdnsConfig.DdnsVendor + } + if o.Layer3.DdnsConfig.DdnsVendorConfig != nil { + nestedLayer3.DdnsConfig.DdnsVendorConfig = []Layer3DdnsConfigDdnsVendorConfig{} + for _, oLayer3DdnsConfigDdnsVendorConfig := range o.Layer3.DdnsConfig.DdnsVendorConfig { + nestedLayer3DdnsConfigDdnsVendorConfig := Layer3DdnsConfigDdnsVendorConfig{} + if oLayer3DdnsConfigDdnsVendorConfig.Misc != nil { + entry.Misc["Layer3DdnsConfigDdnsVendorConfig"] = oLayer3DdnsConfigDdnsVendorConfig.Misc + } + if oLayer3DdnsConfigDdnsVendorConfig.Value != nil { + nestedLayer3DdnsConfigDdnsVendorConfig.Value = oLayer3DdnsConfigDdnsVendorConfig.Value + } + if oLayer3DdnsConfigDdnsVendorConfig.Name != "" { + nestedLayer3DdnsConfigDdnsVendorConfig.Name = oLayer3DdnsConfigDdnsVendorConfig.Name + } + nestedLayer3.DdnsConfig.DdnsVendorConfig = append(nestedLayer3.DdnsConfig.DdnsVendorConfig, nestedLayer3DdnsConfigDdnsVendorConfig) + } + } + if o.Layer3.DdnsConfig.DdnsCertProfile != nil { + nestedLayer3.DdnsConfig.DdnsCertProfile = o.Layer3.DdnsConfig.DdnsCertProfile + } + } + if o.Layer3.DfIgnore != nil { + nestedLayer3.DfIgnore = util.AsBool(o.Layer3.DfIgnore, nil) + } + if o.Layer3.Pppoe != nil { + nestedLayer3.Pppoe = &Layer3Pppoe{} + if o.Layer3.Pppoe.Misc != nil { + entry.Misc["Layer3Pppoe"] = o.Layer3.Pppoe.Misc + } + if o.Layer3.Pppoe.DefaultRouteMetric != nil { + nestedLayer3.Pppoe.DefaultRouteMetric = o.Layer3.Pppoe.DefaultRouteMetric + } + if o.Layer3.Pppoe.Enable != nil { + nestedLayer3.Pppoe.Enable = util.AsBool(o.Layer3.Pppoe.Enable, nil) + } + if o.Layer3.Pppoe.Password != nil { + nestedLayer3.Pppoe.Password = o.Layer3.Pppoe.Password + } + if o.Layer3.Pppoe.StaticAddress != nil { + nestedLayer3.Pppoe.StaticAddress = &Layer3PppoeStaticAddress{} + if o.Layer3.Pppoe.StaticAddress.Misc != nil { + entry.Misc["Layer3PppoeStaticAddress"] = o.Layer3.Pppoe.StaticAddress.Misc + } + if o.Layer3.Pppoe.StaticAddress.Ip != nil { + nestedLayer3.Pppoe.StaticAddress.Ip = o.Layer3.Pppoe.StaticAddress.Ip + } + } + if o.Layer3.Pppoe.AccessConcentrator != nil { + nestedLayer3.Pppoe.AccessConcentrator = o.Layer3.Pppoe.AccessConcentrator + } + if o.Layer3.Pppoe.CreateDefaultRoute != nil { + nestedLayer3.Pppoe.CreateDefaultRoute = util.AsBool(o.Layer3.Pppoe.CreateDefaultRoute, nil) + } + if o.Layer3.Pppoe.Service != nil { + nestedLayer3.Pppoe.Service = o.Layer3.Pppoe.Service + } + if o.Layer3.Pppoe.Username != nil { + nestedLayer3.Pppoe.Username = o.Layer3.Pppoe.Username + } + if o.Layer3.Pppoe.Authentication != nil { + nestedLayer3.Pppoe.Authentication = o.Layer3.Pppoe.Authentication + } + if o.Layer3.Pppoe.Passive != nil { + nestedLayer3.Pppoe.Passive = &Layer3PppoePassive{} + if o.Layer3.Pppoe.Passive.Misc != nil { + entry.Misc["Layer3PppoePassive"] = o.Layer3.Pppoe.Passive.Misc + } + if o.Layer3.Pppoe.Passive.Enable != nil { + nestedLayer3.Pppoe.Passive.Enable = util.AsBool(o.Layer3.Pppoe.Passive.Enable, nil) + } + } + } + if o.Layer3.DecryptForward != nil { + nestedLayer3.DecryptForward = util.AsBool(o.Layer3.DecryptForward, nil) + } + if o.Layer3.DhcpClient != nil { + nestedLayer3.DhcpClient = &Layer3DhcpClient{} + if o.Layer3.DhcpClient.Misc != nil { + entry.Misc["Layer3DhcpClient"] = o.Layer3.DhcpClient.Misc + } + if o.Layer3.DhcpClient.SendHostname != nil { + nestedLayer3.DhcpClient.SendHostname = &Layer3DhcpClientSendHostname{} + if o.Layer3.DhcpClient.SendHostname.Misc != nil { + entry.Misc["Layer3DhcpClientSendHostname"] = o.Layer3.DhcpClient.SendHostname.Misc + } + if o.Layer3.DhcpClient.SendHostname.Enable != nil { + nestedLayer3.DhcpClient.SendHostname.Enable = util.AsBool(o.Layer3.DhcpClient.SendHostname.Enable, nil) + } + if o.Layer3.DhcpClient.SendHostname.Hostname != nil { + nestedLayer3.DhcpClient.SendHostname.Hostname = o.Layer3.DhcpClient.SendHostname.Hostname + } + } + if o.Layer3.DhcpClient.CreateDefaultRoute != nil { + nestedLayer3.DhcpClient.CreateDefaultRoute = util.AsBool(o.Layer3.DhcpClient.CreateDefaultRoute, nil) + } + if o.Layer3.DhcpClient.DefaultRouteMetric != nil { + nestedLayer3.DhcpClient.DefaultRouteMetric = o.Layer3.DhcpClient.DefaultRouteMetric + } + if o.Layer3.DhcpClient.Enable != nil { + nestedLayer3.DhcpClient.Enable = util.AsBool(o.Layer3.DhcpClient.Enable, nil) + } + } + if o.Layer3.NdpProxy != nil { + nestedLayer3.NdpProxy = &Layer3NdpProxy{} + if o.Layer3.NdpProxy.Misc != nil { + entry.Misc["Layer3NdpProxy"] = o.Layer3.NdpProxy.Misc + } + if o.Layer3.NdpProxy.Address != nil { + nestedLayer3.NdpProxy.Address = []Layer3NdpProxyAddress{} + for _, oLayer3NdpProxyAddress := range o.Layer3.NdpProxy.Address { + nestedLayer3NdpProxyAddress := Layer3NdpProxyAddress{} + if oLayer3NdpProxyAddress.Misc != nil { + entry.Misc["Layer3NdpProxyAddress"] = oLayer3NdpProxyAddress.Misc + } + if oLayer3NdpProxyAddress.Negate != nil { + nestedLayer3NdpProxyAddress.Negate = util.AsBool(oLayer3NdpProxyAddress.Negate, nil) + } + if oLayer3NdpProxyAddress.Name != "" { + nestedLayer3NdpProxyAddress.Name = oLayer3NdpProxyAddress.Name + } + nestedLayer3.NdpProxy.Address = append(nestedLayer3.NdpProxy.Address, nestedLayer3NdpProxyAddress) + } + } + if o.Layer3.NdpProxy.Enabled != nil { + nestedLayer3.NdpProxy.Enabled = util.AsBool(o.Layer3.NdpProxy.Enabled, nil) + } + } + if o.Layer3.NetflowProfile != nil { + nestedLayer3.NetflowProfile = o.Layer3.NetflowProfile + } + if o.Layer3.ClusterInterconnect != nil { + nestedLayer3.ClusterInterconnect = util.AsBool(o.Layer3.ClusterInterconnect, nil) + } + } + entry.Layer3 = nestedLayer3 + + var nestedLogCard *LogCard + if o.LogCard != nil { + nestedLogCard = &LogCard{} + if o.LogCard.Misc != nil { + entry.Misc["LogCard"] = o.LogCard.Misc + } + if o.LogCard.Netmask != nil { + nestedLogCard.Netmask = o.LogCard.Netmask + } + if o.LogCard.DefaultGateway != nil { + nestedLogCard.DefaultGateway = o.LogCard.DefaultGateway + } + if o.LogCard.IpAddress != nil { + nestedLogCard.IpAddress = o.LogCard.IpAddress + } + if o.LogCard.Ipv6Address != nil { + nestedLogCard.Ipv6Address = o.LogCard.Ipv6Address + } + if o.LogCard.Ipv6DefaultGateway != nil { + nestedLogCard.Ipv6DefaultGateway = o.LogCard.Ipv6DefaultGateway + } + } + entry.LogCard = nestedLogCard + + var nestedTap *Tap + if o.Tap != nil { + nestedTap = &Tap{} + if o.Tap.Misc != nil { + entry.Misc["Tap"] = o.Tap.Misc + } + if o.Tap.NetflowProfile != nil { + nestedTap.NetflowProfile = o.Tap.NetflowProfile + } + } + entry.Tap = nestedTap + + var nestedVirtualWire *VirtualWire + if o.VirtualWire != nil { + nestedVirtualWire = &VirtualWire{} + if o.VirtualWire.Misc != nil { + entry.Misc["VirtualWire"] = o.VirtualWire.Misc + } + if o.VirtualWire.Lacp != nil { + nestedVirtualWire.Lacp = &VirtualWireLacp{} + if o.VirtualWire.Lacp.Misc != nil { + entry.Misc["VirtualWireLacp"] = o.VirtualWire.Lacp.Misc + } + if o.VirtualWire.Lacp.HighAvailability != nil { + nestedVirtualWire.Lacp.HighAvailability = &VirtualWireLacpHighAvailability{} + if o.VirtualWire.Lacp.HighAvailability.Misc != nil { + entry.Misc["VirtualWireLacpHighAvailability"] = o.VirtualWire.Lacp.HighAvailability.Misc + } + if o.VirtualWire.Lacp.HighAvailability.PassivePreNegotiation != nil { + nestedVirtualWire.Lacp.HighAvailability.PassivePreNegotiation = util.AsBool(o.VirtualWire.Lacp.HighAvailability.PassivePreNegotiation, nil) + } + } + } + if o.VirtualWire.Lldp != nil { + nestedVirtualWire.Lldp = &VirtualWireLldp{} + if o.VirtualWire.Lldp.Misc != nil { + entry.Misc["VirtualWireLldp"] = o.VirtualWire.Lldp.Misc + } + if o.VirtualWire.Lldp.Enable != nil { + nestedVirtualWire.Lldp.Enable = util.AsBool(o.VirtualWire.Lldp.Enable, nil) + } + if o.VirtualWire.Lldp.HighAvailability != nil { + nestedVirtualWire.Lldp.HighAvailability = &VirtualWireLldpHighAvailability{} + if o.VirtualWire.Lldp.HighAvailability.Misc != nil { + entry.Misc["VirtualWireLldpHighAvailability"] = o.VirtualWire.Lldp.HighAvailability.Misc + } + if o.VirtualWire.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedVirtualWire.Lldp.HighAvailability.PassivePreNegotiation = util.AsBool(o.VirtualWire.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.VirtualWire.Lldp.Profile != nil { + nestedVirtualWire.Lldp.Profile = o.VirtualWire.Lldp.Profile + } + } + if o.VirtualWire.NetflowProfile != nil { + nestedVirtualWire.NetflowProfile = o.VirtualWire.NetflowProfile + } } + entry.VirtualWire = nestedVirtualWire + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) } - entry.Ha = nestedHa - var nestedLayer3 *Layer3Xml - if o.Layer3 != nil { - nestedLayer3 = &Layer3Xml{} - if _, ok := o.Misc["Layer3"]; ok { - nestedLayer3.Misc = o.Misc["Layer3"] + return entryList, nil +} +func (c *entryXmlContainer_11_0_2) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), } - if o.Layer3.Bonjour != nil { - nestedLayer3.Bonjour = &Layer3BonjourXml{} - if _, ok := o.Misc["Layer3Bonjour"]; ok { - nestedLayer3.Bonjour.Misc = o.Misc["Layer3Bonjour"] + entry.Name = o.Name + entry.Comment = o.Comment + var nestedLacp *Lacp + if o.Lacp != nil { + nestedLacp = &Lacp{} + if o.Lacp.Misc != nil { + entry.Misc["Lacp"] = o.Lacp.Misc } - if o.Layer3.Bonjour.Enable != nil { - nestedLayer3.Bonjour.Enable = util.YesNo(o.Layer3.Bonjour.Enable, nil) + if o.Lacp.PortPriority != nil { + nestedLacp.PortPriority = o.Lacp.PortPriority + } + } + entry.Lacp = nestedLacp + + entry.LinkDuplex = o.LinkDuplex + entry.LinkSpeed = o.LinkSpeed + entry.LinkState = o.LinkState + var nestedPoe *Poe + if o.Poe != nil { + nestedPoe = &Poe{} + if o.Poe.Misc != nil { + entry.Misc["Poe"] = o.Poe.Misc + } + if o.Poe.PoeEnabled != nil { + nestedPoe.PoeEnabled = util.AsBool(o.Poe.PoeEnabled, nil) + } + if o.Poe.PoeRsvdPwr != nil { + nestedPoe.PoeRsvdPwr = o.Poe.PoeRsvdPwr + } + } + entry.Poe = nestedPoe + + entry.AggregateGroup = o.AggregateGroup + var nestedDecryptMirror *DecryptMirror + if o.DecryptMirror != nil { + nestedDecryptMirror = &DecryptMirror{} + if o.DecryptMirror.Misc != nil { + entry.Misc["DecryptMirror"] = o.DecryptMirror.Misc + } + } + entry.DecryptMirror = nestedDecryptMirror + + var nestedHa *Ha + if o.Ha != nil { + nestedHa = &Ha{} + if o.Ha.Misc != nil { + entry.Misc["Ha"] = o.Ha.Misc + } + } + entry.Ha = nestedHa + + var nestedLayer2 *Layer2 + if o.Layer2 != nil { + nestedLayer2 = &Layer2{} + if o.Layer2.Misc != nil { + entry.Misc["Layer2"] = o.Layer2.Misc + } + if o.Layer2.Lldp != nil { + nestedLayer2.Lldp = &Layer2Lldp{} + if o.Layer2.Lldp.Misc != nil { + entry.Misc["Layer2Lldp"] = o.Layer2.Lldp.Misc + } + if o.Layer2.Lldp.Enable != nil { + nestedLayer2.Lldp.Enable = util.AsBool(o.Layer2.Lldp.Enable, nil) + } + if o.Layer2.Lldp.HighAvailability != nil { + nestedLayer2.Lldp.HighAvailability = &Layer2LldpHighAvailability{} + if o.Layer2.Lldp.HighAvailability.Misc != nil { + entry.Misc["Layer2LldpHighAvailability"] = o.Layer2.Lldp.HighAvailability.Misc + } + if o.Layer2.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer2.Lldp.HighAvailability.PassivePreNegotiation = util.AsBool(o.Layer2.Lldp.HighAvailability.PassivePreNegotiation, nil) + } + } + if o.Layer2.Lldp.Profile != nil { + nestedLayer2.Lldp.Profile = o.Layer2.Lldp.Profile + } + } + if o.Layer2.NetflowProfile != nil { + nestedLayer2.NetflowProfile = o.Layer2.NetflowProfile + } + } + entry.Layer2 = nestedLayer2 + + var nestedLayer3 *Layer3 + if o.Layer3 != nil { + nestedLayer3 = &Layer3{} + if o.Layer3.Misc != nil { + entry.Misc["Layer3"] = o.Layer3.Misc + } + if o.Layer3.Arp != nil { + nestedLayer3.Arp = []Layer3Arp{} + for _, oLayer3Arp := range o.Layer3.Arp { + nestedLayer3Arp := Layer3Arp{} + if oLayer3Arp.Misc != nil { + entry.Misc["Layer3Arp"] = oLayer3Arp.Misc + } + if oLayer3Arp.HwAddress != nil { + nestedLayer3Arp.HwAddress = oLayer3Arp.HwAddress + } + if oLayer3Arp.Name != "" { + nestedLayer3Arp.Name = oLayer3Arp.Name + } + nestedLayer3.Arp = append(nestedLayer3.Arp, nestedLayer3Arp) + } + } + if o.Layer3.Ip != nil { + nestedLayer3.Ip = []Layer3Ip{} + for _, oLayer3Ip := range o.Layer3.Ip { + nestedLayer3Ip := Layer3Ip{} + if oLayer3Ip.Misc != nil { + entry.Misc["Layer3Ip"] = oLayer3Ip.Misc + } + if oLayer3Ip.SdwanGateway != nil { + nestedLayer3Ip.SdwanGateway = oLayer3Ip.SdwanGateway + } + if oLayer3Ip.Name != "" { + nestedLayer3Ip.Name = oLayer3Ip.Name + } + nestedLayer3.Ip = append(nestedLayer3.Ip, nestedLayer3Ip) + } + } + if o.Layer3.Mtu != nil { + nestedLayer3.Mtu = o.Layer3.Mtu + } + if o.Layer3.TrafficInterconnect != nil { + nestedLayer3.TrafficInterconnect = util.AsBool(o.Layer3.TrafficInterconnect, nil) + } + if o.Layer3.AdjustTcpMss != nil { + nestedLayer3.AdjustTcpMss = &Layer3AdjustTcpMss{} + if o.Layer3.AdjustTcpMss.Misc != nil { + entry.Misc["Layer3AdjustTcpMss"] = o.Layer3.AdjustTcpMss.Misc + } + if o.Layer3.AdjustTcpMss.Enable != nil { + nestedLayer3.AdjustTcpMss.Enable = util.AsBool(o.Layer3.AdjustTcpMss.Enable, nil) + } + if o.Layer3.AdjustTcpMss.Ipv4MssAdjustment != nil { + nestedLayer3.AdjustTcpMss.Ipv4MssAdjustment = o.Layer3.AdjustTcpMss.Ipv4MssAdjustment + } + if o.Layer3.AdjustTcpMss.Ipv6MssAdjustment != nil { + nestedLayer3.AdjustTcpMss.Ipv6MssAdjustment = o.Layer3.AdjustTcpMss.Ipv6MssAdjustment + } + } + if o.Layer3.InterfaceManagementProfile != nil { + nestedLayer3.InterfaceManagementProfile = o.Layer3.InterfaceManagementProfile + } + if o.Layer3.Ipv6 != nil { + nestedLayer3.Ipv6 = &Layer3Ipv6{} + if o.Layer3.Ipv6.Misc != nil { + entry.Misc["Layer3Ipv6"] = o.Layer3.Ipv6.Misc + } + if o.Layer3.Ipv6.Address != nil { + nestedLayer3.Ipv6.Address = []Layer3Ipv6Address{} + for _, oLayer3Ipv6Address := range o.Layer3.Ipv6.Address { + nestedLayer3Ipv6Address := Layer3Ipv6Address{} + if oLayer3Ipv6Address.Misc != nil { + entry.Misc["Layer3Ipv6Address"] = oLayer3Ipv6Address.Misc + } + if oLayer3Ipv6Address.Name != "" { + nestedLayer3Ipv6Address.Name = oLayer3Ipv6Address.Name + } + if oLayer3Ipv6Address.EnableOnInterface != nil { + nestedLayer3Ipv6Address.EnableOnInterface = util.AsBool(oLayer3Ipv6Address.EnableOnInterface, nil) + } + if oLayer3Ipv6Address.Prefix != nil { + nestedLayer3Ipv6Address.Prefix = &Layer3Ipv6AddressPrefix{} + if oLayer3Ipv6Address.Prefix.Misc != nil { + entry.Misc["Layer3Ipv6AddressPrefix"] = oLayer3Ipv6Address.Prefix.Misc + } + } + if oLayer3Ipv6Address.Anycast != nil { + nestedLayer3Ipv6Address.Anycast = &Layer3Ipv6AddressAnycast{} + if oLayer3Ipv6Address.Anycast.Misc != nil { + entry.Misc["Layer3Ipv6AddressAnycast"] = oLayer3Ipv6Address.Anycast.Misc + } + } + if oLayer3Ipv6Address.Advertise != nil { + nestedLayer3Ipv6Address.Advertise = &Layer3Ipv6AddressAdvertise{} + if oLayer3Ipv6Address.Advertise.Misc != nil { + entry.Misc["Layer3Ipv6AddressAdvertise"] = oLayer3Ipv6Address.Advertise.Misc + } + if oLayer3Ipv6Address.Advertise.Enable != nil { + nestedLayer3Ipv6Address.Advertise.Enable = util.AsBool(oLayer3Ipv6Address.Advertise.Enable, nil) + } + if oLayer3Ipv6Address.Advertise.ValidLifetime != nil { + nestedLayer3Ipv6Address.Advertise.ValidLifetime = oLayer3Ipv6Address.Advertise.ValidLifetime + } + if oLayer3Ipv6Address.Advertise.PreferredLifetime != nil { + nestedLayer3Ipv6Address.Advertise.PreferredLifetime = oLayer3Ipv6Address.Advertise.PreferredLifetime + } + if oLayer3Ipv6Address.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6Address.Advertise.OnlinkFlag = util.AsBool(oLayer3Ipv6Address.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6Address.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6Address.Advertise.AutoConfigFlag = util.AsBool(oLayer3Ipv6Address.Advertise.AutoConfigFlag, nil) + } + } + nestedLayer3.Ipv6.Address = append(nestedLayer3.Ipv6.Address, nestedLayer3Ipv6Address) + } + } + if o.Layer3.Ipv6.Enabled != nil { + nestedLayer3.Ipv6.Enabled = util.AsBool(o.Layer3.Ipv6.Enabled, nil) + } + if o.Layer3.Ipv6.InterfaceId != nil { + nestedLayer3.Ipv6.InterfaceId = o.Layer3.Ipv6.InterfaceId + } + if o.Layer3.Ipv6.NeighborDiscovery != nil { + nestedLayer3.Ipv6.NeighborDiscovery = &Layer3Ipv6NeighborDiscovery{} + if o.Layer3.Ipv6.NeighborDiscovery.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscovery"] = o.Layer3.Ipv6.NeighborDiscovery.Misc + } + if o.Layer3.Ipv6.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.ReachableTime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement = &Layer3Ipv6NeighborDiscoveryRouterAdvertisement{} + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisement"] = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Misc + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport = &Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport{} + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport"] = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Misc + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer{} + for _, oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := range o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer{} + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer"] = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Misc + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime != nil { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = append(nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server, nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer) + } + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix{} + for _, oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := range o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix{} + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix"] = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Misc + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime != nil { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime + } + if oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name = oLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = append(nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix, nestedLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix) + } + } + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + } + if o.Layer3.Ipv6.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.NeighborDiscovery.EnableDad = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.NeighborDiscovery.EnableNdpMonitor = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Layer3.Ipv6.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = []Layer3Ipv6NeighborDiscoveryNeighbor{} + for _, oLayer3Ipv6NeighborDiscoveryNeighbor := range o.Layer3.Ipv6.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6NeighborDiscoveryNeighbor := Layer3Ipv6NeighborDiscoveryNeighbor{} + if oLayer3Ipv6NeighborDiscoveryNeighbor.Misc != nil { + entry.Misc["Layer3Ipv6NeighborDiscoveryNeighbor"] = oLayer3Ipv6NeighborDiscoveryNeighbor.Misc + } + if oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress + } + if oLayer3Ipv6NeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6NeighborDiscoveryNeighbor.Name = oLayer3Ipv6NeighborDiscoveryNeighbor.Name + } + nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.NeighborDiscovery.Neighbor, nestedLayer3Ipv6NeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.NeighborDiscovery.NsInterval + } + } + if o.Layer3.Ipv6.DhcpClient != nil { + nestedLayer3.Ipv6.DhcpClient = &Layer3Ipv6DhcpClient{} + if o.Layer3.Ipv6.DhcpClient.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClient"] = o.Layer3.Ipv6.DhcpClient.Misc + } + if o.Layer3.Ipv6.DhcpClient.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.Enable = util.AsBool(o.Layer3.Ipv6.DhcpClient.Enable, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery = &Layer3Ipv6DhcpClientNeighborDiscovery{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscovery"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable = util.AsBool(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = []Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer{} + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer"] = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Misc + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable = util.AsBool(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual = &Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual{} + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual"] = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Misc + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix{} + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix"] = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad = util.AsBool(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor = util.AsBool(o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor = []Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor{} + for _, oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor := range o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor := Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor{} + if oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor"] = oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Misc + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.HwAddress + } + if oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name = oLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor.Name + } + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.Neighbor, nestedLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.DhcpClient.NeighborDiscovery.NsInterval + } + } + if o.Layer3.Ipv6.DhcpClient.Preference != nil { + nestedLayer3.Ipv6.DhcpClient.Preference = o.Layer3.Ipv6.DhcpClient.Preference + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation = &Layer3Ipv6DhcpClientPrefixDelegation{} + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientPrefixDelegation"] = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Misc + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable = &Layer3Ipv6DhcpClientPrefixDelegationEnable{} + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnable"] = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Misc + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No = &Layer3Ipv6DhcpClientPrefixDelegationEnableNo{} + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableNo"] = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.No.Misc + } + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes = &Layer3Ipv6DhcpClientPrefixDelegationEnableYes{} + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientPrefixDelegationEnableYes"] = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.Misc + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen = o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen + } + if o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint != nil { + nestedLayer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint = util.AsBool(o.Layer3.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint, nil) + } + } + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options = &Layer3Ipv6DhcpClientV6Options{} + if o.Layer3.Ipv6.DhcpClient.V6Options.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientV6Options"] = o.Layer3.Ipv6.DhcpClient.V6Options.Misc + } + if o.Layer3.Ipv6.DhcpClient.V6Options.DuidType != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.DuidType = o.Layer3.Ipv6.DhcpClient.V6Options.DuidType + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable = &Layer3Ipv6DhcpClientV6OptionsEnable{} + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientV6OptionsEnable"] = o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Misc + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.No != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.No = &Layer3Ipv6DhcpClientV6OptionsEnableNo{} + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.No.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientV6OptionsEnableNo"] = o.Layer3.Ipv6.DhcpClient.V6Options.Enable.No.Misc + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes = &Layer3Ipv6DhcpClientV6OptionsEnableYes{} + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.Misc != nil { + entry.Misc["Layer3Ipv6DhcpClientV6OptionsEnableYes"] = o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.Misc + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr = util.AsBool(o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr, nil) + } + if o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr = util.AsBool(o.Layer3.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr, nil) + } + } + } + if o.Layer3.Ipv6.DhcpClient.V6Options.RapidCommit != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.RapidCommit = util.AsBool(o.Layer3.Ipv6.DhcpClient.V6Options.RapidCommit, nil) + } + if o.Layer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig != nil { + nestedLayer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig = util.AsBool(o.Layer3.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig, nil) + } + } + if o.Layer3.Ipv6.DhcpClient.AcceptRaRoute != nil { + nestedLayer3.Ipv6.DhcpClient.AcceptRaRoute = util.AsBool(o.Layer3.Ipv6.DhcpClient.AcceptRaRoute, nil) + } + if o.Layer3.Ipv6.DhcpClient.DefaultRouteMetric != nil { + nestedLayer3.Ipv6.DhcpClient.DefaultRouteMetric = o.Layer3.Ipv6.DhcpClient.DefaultRouteMetric + } + } + if o.Layer3.Ipv6.Inherited != nil { + nestedLayer3.Ipv6.Inherited = &Layer3Ipv6Inherited{} + if o.Layer3.Ipv6.Inherited.Misc != nil { + entry.Misc["Layer3Ipv6Inherited"] = o.Layer3.Ipv6.Inherited.Misc + } + if o.Layer3.Ipv6.Inherited.Enable != nil { + nestedLayer3.Ipv6.Inherited.Enable = util.AsBool(o.Layer3.Ipv6.Inherited.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery = &Layer3Ipv6InheritedNeighborDiscovery{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscovery"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement = &Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer = &Layer3Ipv6InheritedNeighborDiscoveryDnsServer{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServer"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual = &Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = []Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer := Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer{} + if oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer"] = oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Misc + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name = oLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual = &Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual{} + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual"] = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Misc + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix{} + if oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix"] = oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + if oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.NsInterval != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.Inherited.NeighborDiscovery.NsInterval + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.Neighbor != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor = []Layer3Ipv6InheritedNeighborDiscoveryNeighbor{} + for _, oLayer3Ipv6InheritedNeighborDiscoveryNeighbor := range o.Layer3.Ipv6.Inherited.NeighborDiscovery.Neighbor { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor := Layer3Ipv6InheritedNeighborDiscoveryNeighbor{} + if oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Misc != nil { + entry.Misc["Layer3Ipv6InheritedNeighborDiscoveryNeighbor"] = oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Misc + } + if oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name != "" { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name = oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.Name + } + if oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress != nil { + nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6InheritedNeighborDiscoveryNeighbor.HwAddress + } + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.Inherited.NeighborDiscovery.Neighbor, nestedLayer3Ipv6InheritedNeighborDiscoveryNeighbor) + } + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.Inherited.NeighborDiscovery.ReachableTime + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.Inherited.NeighborDiscovery.DadAttempts + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableDad != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.EnableDad = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor != nil { + nestedLayer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor = util.AsBool(o.Layer3.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor, nil) + } + } + if o.Layer3.Ipv6.Inherited.AssignAddr != nil { + nestedLayer3.Ipv6.Inherited.AssignAddr = []Layer3Ipv6InheritedAssignAddr{} + for _, oLayer3Ipv6InheritedAssignAddr := range o.Layer3.Ipv6.Inherited.AssignAddr { + nestedLayer3Ipv6InheritedAssignAddr := Layer3Ipv6InheritedAssignAddr{} + if oLayer3Ipv6InheritedAssignAddr.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddr"] = oLayer3Ipv6InheritedAssignAddr.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type = &Layer3Ipv6InheritedAssignAddrType{} + if oLayer3Ipv6InheritedAssignAddr.Type.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrType"] = oLayer3Ipv6InheritedAssignAddr.Type.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua = &Layer3Ipv6InheritedAssignAddrTypeGua{} + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeGua"] = oLayer3Ipv6InheritedAssignAddr.Type.Gua.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Gua.EnableOnInterface, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PrefixPool + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolType{} + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolType"] = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic{} + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic"] = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic.Misc + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId = &Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId{} + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId"] = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier = oLayer3Ipv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier + } + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise = &Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise{} + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise"] = oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.Enable, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag, nil) + } + } + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula = &Layer3Ipv6InheritedAssignAddrTypeUla{} + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeUla"] = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.EnableOnInterface, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Address != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Address = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Address + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Prefix, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Anycast, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise = &Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise{} + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Misc != nil { + entry.Misc["Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise"] = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Misc + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.Enable, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime = oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag, nil) + } + if oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag != nil { + nestedLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag = util.AsBool(oLayer3Ipv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag, nil) + } + } + } + } + if oLayer3Ipv6InheritedAssignAddr.Name != "" { + nestedLayer3Ipv6InheritedAssignAddr.Name = oLayer3Ipv6InheritedAssignAddr.Name + } + nestedLayer3.Ipv6.Inherited.AssignAddr = append(nestedLayer3.Ipv6.Inherited.AssignAddr, nestedLayer3Ipv6InheritedAssignAddr) + } + } + } } - } - if o.Layer3.UntaggedSubInterface != nil { - nestedLayer3.UntaggedSubInterface = util.YesNo(o.Layer3.UntaggedSubInterface, nil) - } - if o.Layer3.Arp != nil { - nestedLayer3.Arp = []Layer3ArpXml{} - for _, oLayer3Arp := range o.Layer3.Arp { - nestedLayer3Arp := Layer3ArpXml{} - if _, ok := o.Misc["Layer3Arp"]; ok { - nestedLayer3Arp.Misc = o.Misc["Layer3Arp"] + if o.Layer3.Lldp != nil { + nestedLayer3.Lldp = &Layer3Lldp{} + if o.Layer3.Lldp.Misc != nil { + entry.Misc["Layer3Lldp"] = o.Layer3.Lldp.Misc } - if oLayer3Arp.HwAddress != nil { - nestedLayer3Arp.HwAddress = oLayer3Arp.HwAddress + if o.Layer3.Lldp.Profile != nil { + nestedLayer3.Lldp.Profile = o.Layer3.Lldp.Profile } - if oLayer3Arp.Name != "" { - nestedLayer3Arp.Name = oLayer3Arp.Name + if o.Layer3.Lldp.Enable != nil { + nestedLayer3.Lldp.Enable = util.AsBool(o.Layer3.Lldp.Enable, nil) + } + if o.Layer3.Lldp.HighAvailability != nil { + nestedLayer3.Lldp.HighAvailability = &Layer3LldpHighAvailability{} + if o.Layer3.Lldp.HighAvailability.Misc != nil { + entry.Misc["Layer3LldpHighAvailability"] = o.Layer3.Lldp.HighAvailability.Misc + } + if o.Layer3.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedLayer3.Lldp.HighAvailability.PassivePreNegotiation = util.AsBool(o.Layer3.Lldp.HighAvailability.PassivePreNegotiation, nil) + } } - nestedLayer3.Arp = append(nestedLayer3.Arp, nestedLayer3Arp) - } - } - if o.Layer3.NdpProxy != nil { - nestedLayer3.NdpProxy = util.YesNo(o.Layer3.NdpProxy, nil) - } - if o.Layer3.Lldp != nil { - nestedLayer3.Lldp = &Layer3LldpXml{} - if _, ok := o.Misc["Layer3Lldp"]; ok { - nestedLayer3.Lldp.Misc = o.Misc["Layer3Lldp"] - } - if o.Layer3.Lldp.Enable != nil { - nestedLayer3.Lldp.Enable = util.YesNo(o.Layer3.Lldp.Enable, nil) - } - if o.Layer3.Lldp.Profile != nil { - nestedLayer3.Lldp.Profile = o.Layer3.Lldp.Profile - } - } - if o.Layer3.DhcpClient != nil { - nestedLayer3.DhcpClient = &Layer3DhcpClientXml{} - if _, ok := o.Misc["Layer3DhcpClient"]; ok { - nestedLayer3.DhcpClient.Misc = o.Misc["Layer3DhcpClient"] } - if o.Layer3.DhcpClient.SendHostname != nil { - nestedLayer3.DhcpClient.SendHostname = &Layer3DhcpClientSendHostnameXml{} - if _, ok := o.Misc["Layer3DhcpClientSendHostname"]; ok { - nestedLayer3.DhcpClient.SendHostname.Misc = o.Misc["Layer3DhcpClientSendHostname"] + if o.Layer3.SdwanLinkSettings != nil { + nestedLayer3.SdwanLinkSettings = &Layer3SdwanLinkSettings{} + if o.Layer3.SdwanLinkSettings.Misc != nil { + entry.Misc["Layer3SdwanLinkSettings"] = o.Layer3.SdwanLinkSettings.Misc } - if o.Layer3.DhcpClient.SendHostname.Enable != nil { - nestedLayer3.DhcpClient.SendHostname.Enable = util.YesNo(o.Layer3.DhcpClient.SendHostname.Enable, nil) + if o.Layer3.SdwanLinkSettings.Enable != nil { + nestedLayer3.SdwanLinkSettings.Enable = util.AsBool(o.Layer3.SdwanLinkSettings.Enable, nil) } - if o.Layer3.DhcpClient.SendHostname.Hostname != nil { - nestedLayer3.DhcpClient.SendHostname.Hostname = o.Layer3.DhcpClient.SendHostname.Hostname + if o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile != nil { + nestedLayer3.SdwanLinkSettings.SdwanInterfaceProfile = o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile + } + if o.Layer3.SdwanLinkSettings.UpstreamNat != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat = &Layer3SdwanLinkSettingsUpstreamNat{} + if o.Layer3.SdwanLinkSettings.UpstreamNat.Misc != nil { + entry.Misc["Layer3SdwanLinkSettingsUpstreamNat"] = o.Layer3.SdwanLinkSettings.UpstreamNat.Misc + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.Enable != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Enable = util.AsBool(o.Layer3.SdwanLinkSettings.UpstreamNat.Enable, nil) + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp = &Layer3SdwanLinkSettingsUpstreamNatStaticIp{} + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Misc != nil { + entry.Misc["Layer3SdwanLinkSettingsUpstreamNatStaticIp"] = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Misc + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.Fqdn + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp.IpAddress + } + } + if o.Layer3.SdwanLinkSettings.UpstreamNat.Ddns != nil { + nestedLayer3.SdwanLinkSettings.UpstreamNat.Ddns = &Layer3SdwanLinkSettingsUpstreamNatDdns{} + if o.Layer3.SdwanLinkSettings.UpstreamNat.Ddns.Misc != nil { + entry.Misc["Layer3SdwanLinkSettingsUpstreamNatDdns"] = o.Layer3.SdwanLinkSettings.UpstreamNat.Ddns.Misc + } + } } } - if o.Layer3.DhcpClient.Enable != nil { - nestedLayer3.DhcpClient.Enable = util.YesNo(o.Layer3.DhcpClient.Enable, nil) - } - if o.Layer3.DhcpClient.CreateDefaultRoute != nil { - nestedLayer3.DhcpClient.CreateDefaultRoute = util.YesNo(o.Layer3.DhcpClient.CreateDefaultRoute, nil) - } - if o.Layer3.DhcpClient.DefaultRouteMetric != nil { - nestedLayer3.DhcpClient.DefaultRouteMetric = o.Layer3.DhcpClient.DefaultRouteMetric - } - } - if o.Layer3.NetflowProfile != nil { - nestedLayer3.NetflowProfile = o.Layer3.NetflowProfile - } - if o.Layer3.SdwanLinkSettings != nil { - nestedLayer3.SdwanLinkSettings = &Layer3SdwanLinkSettingsXml{} - if _, ok := o.Misc["Layer3SdwanLinkSettings"]; ok { - nestedLayer3.SdwanLinkSettings.Misc = o.Misc["Layer3SdwanLinkSettings"] - } - if o.Layer3.SdwanLinkSettings.Enable != nil { - nestedLayer3.SdwanLinkSettings.Enable = util.YesNo(o.Layer3.SdwanLinkSettings.Enable, nil) - } - if o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile != nil { - nestedLayer3.SdwanLinkSettings.SdwanInterfaceProfile = o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile + if o.Layer3.UntaggedSubInterface != nil { + nestedLayer3.UntaggedSubInterface = util.AsBool(o.Layer3.UntaggedSubInterface, nil) } - if o.Layer3.SdwanLinkSettings.UpstreamNat != nil { - nestedLayer3.SdwanLinkSettings.UpstreamNat = &Layer3SdwanLinkSettingsUpstreamNatXml{} - if _, ok := o.Misc["Layer3SdwanLinkSettingsUpstreamNat"]; ok { - nestedLayer3.SdwanLinkSettings.UpstreamNat.Misc = o.Misc["Layer3SdwanLinkSettingsUpstreamNat"] + if o.Layer3.Bonjour != nil { + nestedLayer3.Bonjour = &Layer3Bonjour{} + if o.Layer3.Bonjour.Misc != nil { + entry.Misc["Layer3Bonjour"] = o.Layer3.Bonjour.Misc } - if o.Layer3.SdwanLinkSettings.UpstreamNat.Enable != nil { - nestedLayer3.SdwanLinkSettings.UpstreamNat.Enable = util.YesNo(o.Layer3.SdwanLinkSettings.UpstreamNat.Enable, nil) + if o.Layer3.Bonjour.Enable != nil { + nestedLayer3.Bonjour.Enable = util.AsBool(o.Layer3.Bonjour.Enable, nil) } - if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp != nil { - nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp + if o.Layer3.Bonjour.GroupId != nil { + nestedLayer3.Bonjour.GroupId = o.Layer3.Bonjour.GroupId + } + if o.Layer3.Bonjour.TtlCheck != nil { + nestedLayer3.Bonjour.TtlCheck = util.AsBool(o.Layer3.Bonjour.TtlCheck, nil) } } - } - if o.Layer3.AdjustTcpMss != nil { - nestedLayer3.AdjustTcpMss = &Layer3AdjustTcpMssXml{} - if _, ok := o.Misc["Layer3AdjustTcpMss"]; ok { - nestedLayer3.AdjustTcpMss.Misc = o.Misc["Layer3AdjustTcpMss"] - } - if o.Layer3.AdjustTcpMss.Ipv6MssAdjustment != nil { - nestedLayer3.AdjustTcpMss.Ipv6MssAdjustment = o.Layer3.AdjustTcpMss.Ipv6MssAdjustment - } - if o.Layer3.AdjustTcpMss.Enable != nil { - nestedLayer3.AdjustTcpMss.Enable = util.YesNo(o.Layer3.AdjustTcpMss.Enable, nil) - } - if o.Layer3.AdjustTcpMss.Ipv4MssAdjustment != nil { - nestedLayer3.AdjustTcpMss.Ipv4MssAdjustment = o.Layer3.AdjustTcpMss.Ipv4MssAdjustment - } - } - if o.Layer3.Mtu != nil { - nestedLayer3.Mtu = o.Layer3.Mtu - } - if o.Layer3.Ips != nil { - nestedLayer3.Ips = []Layer3IpsXml{} - for _, oLayer3Ips := range o.Layer3.Ips { - nestedLayer3Ips := Layer3IpsXml{} - if _, ok := o.Misc["Layer3Ips"]; ok { - nestedLayer3Ips.Misc = o.Misc["Layer3Ips"] + if o.Layer3.DdnsConfig != nil { + nestedLayer3.DdnsConfig = &Layer3DdnsConfig{} + if o.Layer3.DdnsConfig.Misc != nil { + entry.Misc["Layer3DdnsConfig"] = o.Layer3.DdnsConfig.Misc } - if oLayer3Ips.SdwanGateway != nil { - nestedLayer3Ips.SdwanGateway = oLayer3Ips.SdwanGateway + if o.Layer3.DdnsConfig.DdnsIpv6 != nil { + nestedLayer3.DdnsConfig.DdnsIpv6 = util.MemToStr(o.Layer3.DdnsConfig.DdnsIpv6) } - if oLayer3Ips.Name != "" { - nestedLayer3Ips.Name = oLayer3Ips.Name + if o.Layer3.DdnsConfig.DdnsUpdateInterval != nil { + nestedLayer3.DdnsConfig.DdnsUpdateInterval = o.Layer3.DdnsConfig.DdnsUpdateInterval } - nestedLayer3.Ips = append(nestedLayer3.Ips, nestedLayer3Ips) - } - } - if o.Layer3.Ipv6 != nil { - nestedLayer3.Ipv6 = &Layer3Ipv6Xml{} - if _, ok := o.Misc["Layer3Ipv6"]; ok { - nestedLayer3.Ipv6.Misc = o.Misc["Layer3Ipv6"] - } - if o.Layer3.Ipv6.Enabled != nil { - nestedLayer3.Ipv6.Enabled = util.YesNo(o.Layer3.Ipv6.Enabled, nil) - } - if o.Layer3.Ipv6.InterfaceId != nil { - nestedLayer3.Ipv6.InterfaceId = o.Layer3.Ipv6.InterfaceId - } - if o.Layer3.Ipv6.Addresses != nil { - nestedLayer3.Ipv6.Addresses = []Layer3Ipv6AddressesXml{} - for _, oLayer3Ipv6Addresses := range o.Layer3.Ipv6.Addresses { - nestedLayer3Ipv6Addresses := Layer3Ipv6AddressesXml{} - if _, ok := o.Misc["Layer3Ipv6Addresses"]; ok { - nestedLayer3Ipv6Addresses.Misc = o.Misc["Layer3Ipv6Addresses"] - } - if oLayer3Ipv6Addresses.Name != "" { - nestedLayer3Ipv6Addresses.Name = oLayer3Ipv6Addresses.Name - } - if oLayer3Ipv6Addresses.EnableOnInterface != nil { - nestedLayer3Ipv6Addresses.EnableOnInterface = util.YesNo(oLayer3Ipv6Addresses.EnableOnInterface, nil) - } - if oLayer3Ipv6Addresses.Prefix != nil { - nestedLayer3Ipv6Addresses.Prefix = oLayer3Ipv6Addresses.Prefix - } - if oLayer3Ipv6Addresses.Anycast != nil { - nestedLayer3Ipv6Addresses.Anycast = oLayer3Ipv6Addresses.Anycast - } - if oLayer3Ipv6Addresses.Advertise != nil { - nestedLayer3Ipv6Addresses.Advertise = &Layer3Ipv6AddressesAdvertiseXml{} - if _, ok := o.Misc["Layer3Ipv6AddressesAdvertise"]; ok { - nestedLayer3Ipv6Addresses.Advertise.Misc = o.Misc["Layer3Ipv6AddressesAdvertise"] - } - if oLayer3Ipv6Addresses.Advertise.OnlinkFlag != nil { - nestedLayer3Ipv6Addresses.Advertise.OnlinkFlag = util.YesNo(oLayer3Ipv6Addresses.Advertise.OnlinkFlag, nil) - } - if oLayer3Ipv6Addresses.Advertise.AutoConfigFlag != nil { - nestedLayer3Ipv6Addresses.Advertise.AutoConfigFlag = util.YesNo(oLayer3Ipv6Addresses.Advertise.AutoConfigFlag, nil) - } - if oLayer3Ipv6Addresses.Advertise.Enable != nil { - nestedLayer3Ipv6Addresses.Advertise.Enable = util.YesNo(oLayer3Ipv6Addresses.Advertise.Enable, nil) + if o.Layer3.DdnsConfig.DdnsVendor != nil { + nestedLayer3.DdnsConfig.DdnsVendor = o.Layer3.DdnsConfig.DdnsVendor + } + if o.Layer3.DdnsConfig.DdnsVendorConfig != nil { + nestedLayer3.DdnsConfig.DdnsVendorConfig = []Layer3DdnsConfigDdnsVendorConfig{} + for _, oLayer3DdnsConfigDdnsVendorConfig := range o.Layer3.DdnsConfig.DdnsVendorConfig { + nestedLayer3DdnsConfigDdnsVendorConfig := Layer3DdnsConfigDdnsVendorConfig{} + if oLayer3DdnsConfigDdnsVendorConfig.Misc != nil { + entry.Misc["Layer3DdnsConfigDdnsVendorConfig"] = oLayer3DdnsConfigDdnsVendorConfig.Misc } - if oLayer3Ipv6Addresses.Advertise.ValidLifetime != nil { - nestedLayer3Ipv6Addresses.Advertise.ValidLifetime = oLayer3Ipv6Addresses.Advertise.ValidLifetime + if oLayer3DdnsConfigDdnsVendorConfig.Value != nil { + nestedLayer3DdnsConfigDdnsVendorConfig.Value = oLayer3DdnsConfigDdnsVendorConfig.Value } - if oLayer3Ipv6Addresses.Advertise.PreferredLifetime != nil { - nestedLayer3Ipv6Addresses.Advertise.PreferredLifetime = oLayer3Ipv6Addresses.Advertise.PreferredLifetime + if oLayer3DdnsConfigDdnsVendorConfig.Name != "" { + nestedLayer3DdnsConfigDdnsVendorConfig.Name = oLayer3DdnsConfigDdnsVendorConfig.Name } + nestedLayer3.DdnsConfig.DdnsVendorConfig = append(nestedLayer3.DdnsConfig.DdnsVendorConfig, nestedLayer3DdnsConfigDdnsVendorConfig) } - nestedLayer3.Ipv6.Addresses = append(nestedLayer3.Ipv6.Addresses, nestedLayer3Ipv6Addresses) + } + if o.Layer3.DdnsConfig.DdnsCertProfile != nil { + nestedLayer3.DdnsConfig.DdnsCertProfile = o.Layer3.DdnsConfig.DdnsCertProfile + } + if o.Layer3.DdnsConfig.DdnsEnabled != nil { + nestedLayer3.DdnsConfig.DdnsEnabled = util.AsBool(o.Layer3.DdnsConfig.DdnsEnabled, nil) + } + if o.Layer3.DdnsConfig.DdnsHostname != nil { + nestedLayer3.DdnsConfig.DdnsHostname = o.Layer3.DdnsConfig.DdnsHostname + } + if o.Layer3.DdnsConfig.DdnsIp != nil { + nestedLayer3.DdnsConfig.DdnsIp = util.MemToStr(o.Layer3.DdnsConfig.DdnsIp) } } - if o.Layer3.Ipv6.NeighborDiscovery != nil { - nestedLayer3.Ipv6.NeighborDiscovery = &Layer3Ipv6NeighborDiscoveryXml{} - if _, ok := o.Misc["Layer3Ipv6NeighborDiscovery"]; ok { - nestedLayer3.Ipv6.NeighborDiscovery.Misc = o.Misc["Layer3Ipv6NeighborDiscovery"] + if o.Layer3.DfIgnore != nil { + nestedLayer3.DfIgnore = util.AsBool(o.Layer3.DfIgnore, nil) + } + if o.Layer3.Pppoe != nil { + nestedLayer3.Pppoe = &Layer3Pppoe{} + if o.Layer3.Pppoe.Misc != nil { + entry.Misc["Layer3Pppoe"] = o.Layer3.Pppoe.Misc } - if o.Layer3.Ipv6.NeighborDiscovery.NsInterval != nil { - nestedLayer3.Ipv6.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.NeighborDiscovery.NsInterval + if o.Layer3.Pppoe.DefaultRouteMetric != nil { + nestedLayer3.Pppoe.DefaultRouteMetric = o.Layer3.Pppoe.DefaultRouteMetric } - if o.Layer3.Ipv6.NeighborDiscovery.ReachableTime != nil { - nestedLayer3.Ipv6.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.ReachableTime + if o.Layer3.Pppoe.Enable != nil { + nestedLayer3.Pppoe.Enable = util.AsBool(o.Layer3.Pppoe.Enable, nil) } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement = &Layer3Ipv6NeighborDiscoveryRouterAdvertisementXml{} - if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisement"]; ok { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisement"] - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable, nil) - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + if o.Layer3.Pppoe.Password != nil { + nestedLayer3.Pppoe.Password = o.Layer3.Pppoe.Password + } + if o.Layer3.Pppoe.StaticAddress != nil { + nestedLayer3.Pppoe.StaticAddress = &Layer3PppoeStaticAddress{} + if o.Layer3.Pppoe.StaticAddress.Misc != nil { + entry.Misc["Layer3PppoeStaticAddress"] = o.Layer3.Pppoe.StaticAddress.Misc } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + if o.Layer3.Pppoe.StaticAddress.Ip != nil { + nestedLayer3.Pppoe.StaticAddress.Ip = o.Layer3.Pppoe.StaticAddress.Ip } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval + } + if o.Layer3.Pppoe.AccessConcentrator != nil { + nestedLayer3.Pppoe.AccessConcentrator = o.Layer3.Pppoe.AccessConcentrator + } + if o.Layer3.Pppoe.CreateDefaultRoute != nil { + nestedLayer3.Pppoe.CreateDefaultRoute = util.AsBool(o.Layer3.Pppoe.CreateDefaultRoute, nil) + } + if o.Layer3.Pppoe.Service != nil { + nestedLayer3.Pppoe.Service = o.Layer3.Pppoe.Service + } + if o.Layer3.Pppoe.Username != nil { + nestedLayer3.Pppoe.Username = o.Layer3.Pppoe.Username + } + if o.Layer3.Pppoe.Authentication != nil { + nestedLayer3.Pppoe.Authentication = o.Layer3.Pppoe.Authentication + } + if o.Layer3.Pppoe.Passive != nil { + nestedLayer3.Pppoe.Passive = &Layer3PppoePassive{} + if o.Layer3.Pppoe.Passive.Misc != nil { + entry.Misc["Layer3PppoePassive"] = o.Layer3.Pppoe.Passive.Misc } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime + if o.Layer3.Pppoe.Passive.Enable != nil { + nestedLayer3.Pppoe.Passive.Enable = util.AsBool(o.Layer3.Pppoe.Passive.Enable, nil) } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + } + if o.Layer3.DecryptForward != nil { + nestedLayer3.DecryptForward = util.AsBool(o.Layer3.DecryptForward, nil) + } + if o.Layer3.DhcpClient != nil { + nestedLayer3.DhcpClient = &Layer3DhcpClient{} + if o.Layer3.DhcpClient.Misc != nil { + entry.Misc["Layer3DhcpClient"] = o.Layer3.DhcpClient.Misc + } + if o.Layer3.DhcpClient.CreateDefaultRoute != nil { + nestedLayer3.DhcpClient.CreateDefaultRoute = util.AsBool(o.Layer3.DhcpClient.CreateDefaultRoute, nil) + } + if o.Layer3.DhcpClient.DefaultRouteMetric != nil { + nestedLayer3.DhcpClient.DefaultRouteMetric = o.Layer3.DhcpClient.DefaultRouteMetric + } + if o.Layer3.DhcpClient.Enable != nil { + nestedLayer3.DhcpClient.Enable = util.AsBool(o.Layer3.DhcpClient.Enable, nil) + } + if o.Layer3.DhcpClient.SendHostname != nil { + nestedLayer3.DhcpClient.SendHostname = &Layer3DhcpClientSendHostname{} + if o.Layer3.DhcpClient.SendHostname.Misc != nil { + entry.Misc["Layer3DhcpClientSendHostname"] = o.Layer3.DhcpClient.SendHostname.Misc } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit + if o.Layer3.DhcpClient.SendHostname.Enable != nil { + nestedLayer3.DhcpClient.SendHostname.Enable = util.AsBool(o.Layer3.DhcpClient.SendHostname.Enable, nil) } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference + if o.Layer3.DhcpClient.SendHostname.Hostname != nil { + nestedLayer3.DhcpClient.SendHostname.Hostname = o.Layer3.DhcpClient.SendHostname.Hostname } } - if o.Layer3.Ipv6.NeighborDiscovery.Neighbor != nil { - nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = []Layer3Ipv6NeighborDiscoveryNeighborXml{} - for _, oLayer3Ipv6NeighborDiscoveryNeighbor := range o.Layer3.Ipv6.NeighborDiscovery.Neighbor { - nestedLayer3Ipv6NeighborDiscoveryNeighbor := Layer3Ipv6NeighborDiscoveryNeighborXml{} - if _, ok := o.Misc["Layer3Ipv6NeighborDiscoveryNeighbor"]; ok { - nestedLayer3Ipv6NeighborDiscoveryNeighbor.Misc = o.Misc["Layer3Ipv6NeighborDiscoveryNeighbor"] + } + if o.Layer3.NdpProxy != nil { + nestedLayer3.NdpProxy = &Layer3NdpProxy{} + if o.Layer3.NdpProxy.Misc != nil { + entry.Misc["Layer3NdpProxy"] = o.Layer3.NdpProxy.Misc + } + if o.Layer3.NdpProxy.Address != nil { + nestedLayer3.NdpProxy.Address = []Layer3NdpProxyAddress{} + for _, oLayer3NdpProxyAddress := range o.Layer3.NdpProxy.Address { + nestedLayer3NdpProxyAddress := Layer3NdpProxyAddress{} + if oLayer3NdpProxyAddress.Misc != nil { + entry.Misc["Layer3NdpProxyAddress"] = oLayer3NdpProxyAddress.Misc } - if oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress != nil { - nestedLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress + if oLayer3NdpProxyAddress.Negate != nil { + nestedLayer3NdpProxyAddress.Negate = util.AsBool(oLayer3NdpProxyAddress.Negate, nil) } - if oLayer3Ipv6NeighborDiscoveryNeighbor.Name != "" { - nestedLayer3Ipv6NeighborDiscoveryNeighbor.Name = oLayer3Ipv6NeighborDiscoveryNeighbor.Name + if oLayer3NdpProxyAddress.Name != "" { + nestedLayer3NdpProxyAddress.Name = oLayer3NdpProxyAddress.Name } - nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.NeighborDiscovery.Neighbor, nestedLayer3Ipv6NeighborDiscoveryNeighbor) + nestedLayer3.NdpProxy.Address = append(nestedLayer3.NdpProxy.Address, nestedLayer3NdpProxyAddress) } } - if o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor != nil { - nestedLayer3.Ipv6.NeighborDiscovery.EnableNdpMonitor = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor, nil) + if o.Layer3.NdpProxy.Enabled != nil { + nestedLayer3.NdpProxy.Enabled = util.AsBool(o.Layer3.NdpProxy.Enabled, nil) } - if o.Layer3.Ipv6.NeighborDiscovery.EnableDad != nil { - nestedLayer3.Ipv6.NeighborDiscovery.EnableDad = util.YesNo(o.Layer3.Ipv6.NeighborDiscovery.EnableDad, nil) + } + if o.Layer3.NetflowProfile != nil { + nestedLayer3.NetflowProfile = o.Layer3.NetflowProfile + } + if o.Layer3.ClusterInterconnect != nil { + nestedLayer3.ClusterInterconnect = util.AsBool(o.Layer3.ClusterInterconnect, nil) + } + } + entry.Layer3 = nestedLayer3 + + var nestedLogCard *LogCard + if o.LogCard != nil { + nestedLogCard = &LogCard{} + if o.LogCard.Misc != nil { + entry.Misc["LogCard"] = o.LogCard.Misc + } + if o.LogCard.DefaultGateway != nil { + nestedLogCard.DefaultGateway = o.LogCard.DefaultGateway + } + if o.LogCard.IpAddress != nil { + nestedLogCard.IpAddress = o.LogCard.IpAddress + } + if o.LogCard.Ipv6Address != nil { + nestedLogCard.Ipv6Address = o.LogCard.Ipv6Address + } + if o.LogCard.Ipv6DefaultGateway != nil { + nestedLogCard.Ipv6DefaultGateway = o.LogCard.Ipv6DefaultGateway + } + if o.LogCard.Netmask != nil { + nestedLogCard.Netmask = o.LogCard.Netmask + } + } + entry.LogCard = nestedLogCard + + var nestedTap *Tap + if o.Tap != nil { + nestedTap = &Tap{} + if o.Tap.Misc != nil { + entry.Misc["Tap"] = o.Tap.Misc + } + if o.Tap.NetflowProfile != nil { + nestedTap.NetflowProfile = o.Tap.NetflowProfile + } + } + entry.Tap = nestedTap + + var nestedVirtualWire *VirtualWire + if o.VirtualWire != nil { + nestedVirtualWire = &VirtualWire{} + if o.VirtualWire.Misc != nil { + entry.Misc["VirtualWire"] = o.VirtualWire.Misc + } + if o.VirtualWire.Lacp != nil { + nestedVirtualWire.Lacp = &VirtualWireLacp{} + if o.VirtualWire.Lacp.Misc != nil { + entry.Misc["VirtualWireLacp"] = o.VirtualWire.Lacp.Misc } - if o.Layer3.Ipv6.NeighborDiscovery.DadAttempts != nil { - nestedLayer3.Ipv6.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.NeighborDiscovery.DadAttempts + if o.VirtualWire.Lacp.HighAvailability != nil { + nestedVirtualWire.Lacp.HighAvailability = &VirtualWireLacpHighAvailability{} + if o.VirtualWire.Lacp.HighAvailability.Misc != nil { + entry.Misc["VirtualWireLacpHighAvailability"] = o.VirtualWire.Lacp.HighAvailability.Misc + } + if o.VirtualWire.Lacp.HighAvailability.PassivePreNegotiation != nil { + nestedVirtualWire.Lacp.HighAvailability.PassivePreNegotiation = util.AsBool(o.VirtualWire.Lacp.HighAvailability.PassivePreNegotiation, nil) + } } } - if o.Layer3.Ipv6.DnsServer != nil { - nestedLayer3.Ipv6.DnsServer = &Layer3Ipv6DnsServerXml{} - if _, ok := o.Misc["Layer3Ipv6DnsServer"]; ok { - nestedLayer3.Ipv6.DnsServer.Misc = o.Misc["Layer3Ipv6DnsServer"] + if o.VirtualWire.Lldp != nil { + nestedVirtualWire.Lldp = &VirtualWireLldp{} + if o.VirtualWire.Lldp.Misc != nil { + entry.Misc["VirtualWireLldp"] = o.VirtualWire.Lldp.Misc } - if o.Layer3.Ipv6.DnsServer.Enable != nil { - nestedLayer3.Ipv6.DnsServer.Enable = util.YesNo(o.Layer3.Ipv6.DnsServer.Enable, nil) + if o.VirtualWire.Lldp.Profile != nil { + nestedVirtualWire.Lldp.Profile = o.VirtualWire.Lldp.Profile } - if o.Layer3.Ipv6.DnsServer.Source != nil { - nestedLayer3.Ipv6.DnsServer.Source = &Layer3Ipv6DnsServerSourceXml{} - if _, ok := o.Misc["Layer3Ipv6DnsServerSource"]; ok { - nestedLayer3.Ipv6.DnsServer.Source.Misc = o.Misc["Layer3Ipv6DnsServerSource"] - } - if o.Layer3.Ipv6.DnsServer.Source.Dhcpv6 != nil { - nestedLayer3.Ipv6.DnsServer.Source.Dhcpv6 = &Layer3Ipv6DnsServerSourceDhcpv6Xml{} - if _, ok := o.Misc["Layer3Ipv6DnsServerSourceDhcpv6"]; ok { - nestedLayer3.Ipv6.DnsServer.Source.Dhcpv6.Misc = o.Misc["Layer3Ipv6DnsServerSourceDhcpv6"] - } - if o.Layer3.Ipv6.DnsServer.Source.Dhcpv6.PrefixPool != nil { - nestedLayer3.Ipv6.DnsServer.Source.Dhcpv6.PrefixPool = o.Layer3.Ipv6.DnsServer.Source.Dhcpv6.PrefixPool - } - } - if o.Layer3.Ipv6.DnsServer.Source.Manual != nil { - nestedLayer3.Ipv6.DnsServer.Source.Manual = &Layer3Ipv6DnsServerSourceManualXml{} - if _, ok := o.Misc["Layer3Ipv6DnsServerSourceManual"]; ok { - nestedLayer3.Ipv6.DnsServer.Source.Manual.Misc = o.Misc["Layer3Ipv6DnsServerSourceManual"] - } - if o.Layer3.Ipv6.DnsServer.Source.Manual.Suffix != nil { - nestedLayer3.Ipv6.DnsServer.Source.Manual.Suffix = []Layer3Ipv6DnsServerSourceManualSuffixXml{} - for _, oLayer3Ipv6DnsServerSourceManualSuffix := range o.Layer3.Ipv6.DnsServer.Source.Manual.Suffix { - nestedLayer3Ipv6DnsServerSourceManualSuffix := Layer3Ipv6DnsServerSourceManualSuffixXml{} - if _, ok := o.Misc["Layer3Ipv6DnsServerSourceManualSuffix"]; ok { - nestedLayer3Ipv6DnsServerSourceManualSuffix.Misc = o.Misc["Layer3Ipv6DnsServerSourceManualSuffix"] - } - if oLayer3Ipv6DnsServerSourceManualSuffix.Lifetime != nil { - nestedLayer3Ipv6DnsServerSourceManualSuffix.Lifetime = oLayer3Ipv6DnsServerSourceManualSuffix.Lifetime - } - if oLayer3Ipv6DnsServerSourceManualSuffix.Name != "" { - nestedLayer3Ipv6DnsServerSourceManualSuffix.Name = oLayer3Ipv6DnsServerSourceManualSuffix.Name - } - nestedLayer3.Ipv6.DnsServer.Source.Manual.Suffix = append(nestedLayer3.Ipv6.DnsServer.Source.Manual.Suffix, nestedLayer3Ipv6DnsServerSourceManualSuffix) - } - } - } + if o.VirtualWire.Lldp.Enable != nil { + nestedVirtualWire.Lldp.Enable = util.AsBool(o.VirtualWire.Lldp.Enable, nil) } - if o.Layer3.Ipv6.DnsServer.DnsSupport != nil { - nestedLayer3.Ipv6.DnsServer.DnsSupport = &Layer3Ipv6DnsServerDnsSupportXml{} - if _, ok := o.Misc["Layer3Ipv6DnsServerDnsSupport"]; ok { - nestedLayer3.Ipv6.DnsServer.DnsSupport.Misc = o.Misc["Layer3Ipv6DnsServerDnsSupport"] - } - if o.Layer3.Ipv6.DnsServer.DnsSupport.Server != nil { - nestedLayer3.Ipv6.DnsServer.DnsSupport.Server = []Layer3Ipv6DnsServerDnsSupportServerXml{} - for _, oLayer3Ipv6DnsServerDnsSupportServer := range o.Layer3.Ipv6.DnsServer.DnsSupport.Server { - nestedLayer3Ipv6DnsServerDnsSupportServer := Layer3Ipv6DnsServerDnsSupportServerXml{} - if _, ok := o.Misc["Layer3Ipv6DnsServerDnsSupportServer"]; ok { - nestedLayer3Ipv6DnsServerDnsSupportServer.Misc = o.Misc["Layer3Ipv6DnsServerDnsSupportServer"] - } - if oLayer3Ipv6DnsServerDnsSupportServer.Name != "" { - nestedLayer3Ipv6DnsServerDnsSupportServer.Name = oLayer3Ipv6DnsServerDnsSupportServer.Name - } - if oLayer3Ipv6DnsServerDnsSupportServer.Lifetime != nil { - nestedLayer3Ipv6DnsServerDnsSupportServer.Lifetime = oLayer3Ipv6DnsServerDnsSupportServer.Lifetime - } - nestedLayer3.Ipv6.DnsServer.DnsSupport.Server = append(nestedLayer3.Ipv6.DnsServer.DnsSupport.Server, nestedLayer3Ipv6DnsServerDnsSupportServer) - } - } - if o.Layer3.Ipv6.DnsServer.DnsSupport.Suffix != nil { - nestedLayer3.Ipv6.DnsServer.DnsSupport.Suffix = []Layer3Ipv6DnsServerDnsSupportSuffixXml{} - for _, oLayer3Ipv6DnsServerDnsSupportSuffix := range o.Layer3.Ipv6.DnsServer.DnsSupport.Suffix { - nestedLayer3Ipv6DnsServerDnsSupportSuffix := Layer3Ipv6DnsServerDnsSupportSuffixXml{} - if _, ok := o.Misc["Layer3Ipv6DnsServerDnsSupportSuffix"]; ok { - nestedLayer3Ipv6DnsServerDnsSupportSuffix.Misc = o.Misc["Layer3Ipv6DnsServerDnsSupportSuffix"] - } - if oLayer3Ipv6DnsServerDnsSupportSuffix.Lifetime != nil { - nestedLayer3Ipv6DnsServerDnsSupportSuffix.Lifetime = oLayer3Ipv6DnsServerDnsSupportSuffix.Lifetime - } - if oLayer3Ipv6DnsServerDnsSupportSuffix.Name != "" { - nestedLayer3Ipv6DnsServerDnsSupportSuffix.Name = oLayer3Ipv6DnsServerDnsSupportSuffix.Name - } - nestedLayer3.Ipv6.DnsServer.DnsSupport.Suffix = append(nestedLayer3.Ipv6.DnsServer.DnsSupport.Suffix, nestedLayer3Ipv6DnsServerDnsSupportSuffix) - } + if o.VirtualWire.Lldp.HighAvailability != nil { + nestedVirtualWire.Lldp.HighAvailability = &VirtualWireLldpHighAvailability{} + if o.VirtualWire.Lldp.HighAvailability.Misc != nil { + entry.Misc["VirtualWireLldpHighAvailability"] = o.VirtualWire.Lldp.HighAvailability.Misc } - if o.Layer3.Ipv6.DnsServer.DnsSupport.Enable != nil { - nestedLayer3.Ipv6.DnsServer.DnsSupport.Enable = util.YesNo(o.Layer3.Ipv6.DnsServer.DnsSupport.Enable, nil) + if o.VirtualWire.Lldp.HighAvailability.PassivePreNegotiation != nil { + nestedVirtualWire.Lldp.HighAvailability.PassivePreNegotiation = util.AsBool(o.VirtualWire.Lldp.HighAvailability.PassivePreNegotiation, nil) } } } + if o.VirtualWire.NetflowProfile != nil { + nestedVirtualWire.NetflowProfile = o.VirtualWire.NetflowProfile + } } - if o.Layer3.InterfaceManagementProfile != nil { - nestedLayer3.InterfaceManagementProfile = o.Layer3.InterfaceManagementProfile + entry.VirtualWire = nestedVirtualWire + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.StringsMatch(a.Comment, b.Comment) { + return false + } + if !matchLacp(a.Lacp, b.Lacp) { + return false + } + if !util.StringsMatch(a.LinkDuplex, b.LinkDuplex) { + return false + } + if !util.StringsMatch(a.LinkSpeed, b.LinkSpeed) { + return false + } + if !util.StringsMatch(a.LinkState, b.LinkState) { + return false + } + if !matchPoe(a.Poe, b.Poe) { + return false + } + if !util.StringsMatch(a.AggregateGroup, b.AggregateGroup) { + return false + } + if !matchDecryptMirror(a.DecryptMirror, b.DecryptMirror) { + return false + } + if !matchHa(a.Ha, b.Ha) { + return false + } + if !matchLayer2(a.Layer2, b.Layer2) { + return false + } + if !matchLayer3(a.Layer3, b.Layer3) { + return false + } + if !matchLogCard(a.LogCard, b.LogCard) { + return false + } + if !matchTap(a.Tap, b.Tap) { + return false + } + if !matchVirtualWire(a.VirtualWire, b.VirtualWire) { + return false + } + + return true +} + +func matchLacp(a *Lacp, b *Lacp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.PortPriority, b.PortPriority) { + return false + } + return true +} +func matchPoe(a *Poe, b *Poe) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.PoeEnabled, b.PoeEnabled) { + return false + } + if !util.Ints64Match(a.PoeRsvdPwr, b.PoeRsvdPwr) { + return false + } + return true +} +func matchHa(a *Ha, b *Ha) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchLayer2LldpHighAvailability(a *Layer2LldpHighAvailability, b *Layer2LldpHighAvailability) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.PassivePreNegotiation, b.PassivePreNegotiation) { + return false + } + return true +} +func matchLayer2Lldp(a *Layer2Lldp, b *Layer2Lldp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer2LldpHighAvailability(a.HighAvailability, b.HighAvailability) { + return false + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } + return true +} +func matchLayer2(a *Layer2, b *Layer2) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer2Lldp(a.Lldp, b.Lldp) { + return false + } + if !util.StringsMatch(a.NetflowProfile, b.NetflowProfile) { + return false + } + return true +} +func matchLayer3AdjustTcpMss(a *Layer3AdjustTcpMss, b *Layer3AdjustTcpMss) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.Ipv4MssAdjustment, b.Ipv4MssAdjustment) { + return false + } + if !util.Ints64Match(a.Ipv6MssAdjustment, b.Ipv6MssAdjustment) { + return false + } + return true +} +func matchLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer(a []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer, b []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix(a []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix, b []Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } } } - entry.Layer3 = nestedLayer3 - - var nestedTap *TapXml - if o.Tap != nil { - nestedTap = &TapXml{} - if _, ok := o.Misc["Tap"]; ok { - nestedTap.Misc = o.Misc["Tap"] - } - if o.Tap.NetflowProfile != nil { - nestedTap.NetflowProfile = o.Tap.NetflowProfile - } + return true +} +func matchLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport(a *Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport, b *Layer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer(a.Server, b.Server) { + return false + } + if !matchLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix(a.Suffix, b.Suffix) { + return false + } + return true +} +func matchLayer3Ipv6NeighborDiscoveryRouterAdvertisement(a *Layer3Ipv6NeighborDiscoveryRouterAdvertisement, b *Layer3Ipv6NeighborDiscoveryRouterAdvertisement) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.MaxInterval, b.MaxInterval) { + return false + } + if !util.BoolsMatch(a.OtherFlag, b.OtherFlag) { + return false + } + if !util.StringsMatch(a.ReachableTime, b.ReachableTime) { + return false + } + if !matchLayer3Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport(a.DnsSupport, b.DnsSupport) { + return false + } + if !util.BoolsMatch(a.EnableConsistencyCheck, b.EnableConsistencyCheck) { + return false + } + if !util.StringsMatch(a.HopLimit, b.HopLimit) { + return false + } + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.StringsMatch(a.LinkMtu, b.LinkMtu) { + return false + } + if !util.StringsMatch(a.RetransmissionTimer, b.RetransmissionTimer) { + return false } - entry.Tap = nestedTap - - entry.Misc = o.Misc["Entry"] - - return entry, nil + if !util.StringsMatch(a.RouterPreference, b.RouterPreference) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.BoolsMatch(a.ManagedFlag, b.ManagedFlag) { + return false + } + if !util.Ints64Match(a.MinInterval, b.MinInterval) { + return false + } + return true } -func (c *entryXmlContainer) Normalize() ([]*Entry, error) { - entryList := make([]*Entry, 0, len(c.Answer)) - for _, o := range c.Answer { - entry := &Entry{ - Misc: make(map[string][]generic.Xml), - } - entry.Name = o.Name - entry.Comment = o.Comment - entry.LinkDuplex = o.LinkDuplex - entry.LinkSpeed = o.LinkSpeed - entry.LinkState = o.LinkState - var nestedPoe *Poe - if o.Poe != nil { - nestedPoe = &Poe{} - if o.Poe.Misc != nil { - entry.Misc["Poe"] = o.Poe.Misc - } - if o.Poe.ReservedPower != nil { - nestedPoe.ReservedPower = o.Poe.ReservedPower - } - if o.Poe.Enabled != nil { - nestedPoe.Enabled = util.AsBool(o.Poe.Enabled, nil) +func matchLayer3Ipv6NeighborDiscoveryNeighbor(a []Layer3Ipv6NeighborDiscoveryNeighbor, b []Layer3Ipv6NeighborDiscoveryNeighbor) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.HwAddress, b.HwAddress) { + return false } - } - entry.Poe = nestedPoe - - var nestedHa *Ha - if o.Ha != nil { - nestedHa = &Ha{} - if o.Ha.Misc != nil { - entry.Misc["Ha"] = o.Ha.Misc + if !util.StringsEqual(a.Name, b.Name) { + return false } } - entry.Ha = nestedHa - - var nestedLayer3 *Layer3 - if o.Layer3 != nil { - nestedLayer3 = &Layer3{} - if o.Layer3.Misc != nil { - entry.Misc["Layer3"] = o.Layer3.Misc - } - if o.Layer3.Ipv6 != nil { - nestedLayer3.Ipv6 = &Layer3Ipv6{} - if o.Layer3.Ipv6.Misc != nil { - entry.Misc["Layer3Ipv6"] = o.Layer3.Ipv6.Misc - } - if o.Layer3.Ipv6.NeighborDiscovery != nil { - nestedLayer3.Ipv6.NeighborDiscovery = &Layer3Ipv6NeighborDiscovery{} - if o.Layer3.Ipv6.NeighborDiscovery.Misc != nil { - entry.Misc["Layer3Ipv6NeighborDiscovery"] = o.Layer3.Ipv6.NeighborDiscovery.Misc - } - if o.Layer3.Ipv6.NeighborDiscovery.ReachableTime != nil { - nestedLayer3.Ipv6.NeighborDiscovery.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.ReachableTime - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement = &Layer3Ipv6NeighborDiscoveryRouterAdvertisement{} - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Misc != nil { - entry.Misc["Layer3Ipv6NeighborDiscoveryRouterAdvertisement"] = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Misc - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable, nil) - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) - } - if o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { - nestedLayer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) - } - } - if o.Layer3.Ipv6.NeighborDiscovery.Neighbor != nil { - nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = []Layer3Ipv6NeighborDiscoveryNeighbor{} - for _, oLayer3Ipv6NeighborDiscoveryNeighbor := range o.Layer3.Ipv6.NeighborDiscovery.Neighbor { - nestedLayer3Ipv6NeighborDiscoveryNeighbor := Layer3Ipv6NeighborDiscoveryNeighbor{} - if oLayer3Ipv6NeighborDiscoveryNeighbor.Misc != nil { - entry.Misc["Layer3Ipv6NeighborDiscoveryNeighbor"] = oLayer3Ipv6NeighborDiscoveryNeighbor.Misc - } - if oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress != nil { - nestedLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress = oLayer3Ipv6NeighborDiscoveryNeighbor.HwAddress - } - if oLayer3Ipv6NeighborDiscoveryNeighbor.Name != "" { - nestedLayer3Ipv6NeighborDiscoveryNeighbor.Name = oLayer3Ipv6NeighborDiscoveryNeighbor.Name - } - nestedLayer3.Ipv6.NeighborDiscovery.Neighbor = append(nestedLayer3.Ipv6.NeighborDiscovery.Neighbor, nestedLayer3Ipv6NeighborDiscoveryNeighbor) - } - } - if o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor != nil { - nestedLayer3.Ipv6.NeighborDiscovery.EnableNdpMonitor = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.EnableNdpMonitor, nil) - } - if o.Layer3.Ipv6.NeighborDiscovery.EnableDad != nil { - nestedLayer3.Ipv6.NeighborDiscovery.EnableDad = util.AsBool(o.Layer3.Ipv6.NeighborDiscovery.EnableDad, nil) - } - if o.Layer3.Ipv6.NeighborDiscovery.DadAttempts != nil { - nestedLayer3.Ipv6.NeighborDiscovery.DadAttempts = o.Layer3.Ipv6.NeighborDiscovery.DadAttempts - } - if o.Layer3.Ipv6.NeighborDiscovery.NsInterval != nil { - nestedLayer3.Ipv6.NeighborDiscovery.NsInterval = o.Layer3.Ipv6.NeighborDiscovery.NsInterval - } - } - if o.Layer3.Ipv6.DnsServer != nil { - nestedLayer3.Ipv6.DnsServer = &Layer3Ipv6DnsServer{} - if o.Layer3.Ipv6.DnsServer.Misc != nil { - entry.Misc["Layer3Ipv6DnsServer"] = o.Layer3.Ipv6.DnsServer.Misc - } - if o.Layer3.Ipv6.DnsServer.Enable != nil { - nestedLayer3.Ipv6.DnsServer.Enable = util.AsBool(o.Layer3.Ipv6.DnsServer.Enable, nil) - } - if o.Layer3.Ipv6.DnsServer.Source != nil { - nestedLayer3.Ipv6.DnsServer.Source = &Layer3Ipv6DnsServerSource{} - if o.Layer3.Ipv6.DnsServer.Source.Misc != nil { - entry.Misc["Layer3Ipv6DnsServerSource"] = o.Layer3.Ipv6.DnsServer.Source.Misc - } - if o.Layer3.Ipv6.DnsServer.Source.Dhcpv6 != nil { - nestedLayer3.Ipv6.DnsServer.Source.Dhcpv6 = &Layer3Ipv6DnsServerSourceDhcpv6{} - if o.Layer3.Ipv6.DnsServer.Source.Dhcpv6.Misc != nil { - entry.Misc["Layer3Ipv6DnsServerSourceDhcpv6"] = o.Layer3.Ipv6.DnsServer.Source.Dhcpv6.Misc - } - if o.Layer3.Ipv6.DnsServer.Source.Dhcpv6.PrefixPool != nil { - nestedLayer3.Ipv6.DnsServer.Source.Dhcpv6.PrefixPool = o.Layer3.Ipv6.DnsServer.Source.Dhcpv6.PrefixPool - } - } - if o.Layer3.Ipv6.DnsServer.Source.Manual != nil { - nestedLayer3.Ipv6.DnsServer.Source.Manual = &Layer3Ipv6DnsServerSourceManual{} - if o.Layer3.Ipv6.DnsServer.Source.Manual.Misc != nil { - entry.Misc["Layer3Ipv6DnsServerSourceManual"] = o.Layer3.Ipv6.DnsServer.Source.Manual.Misc - } - if o.Layer3.Ipv6.DnsServer.Source.Manual.Suffix != nil { - nestedLayer3.Ipv6.DnsServer.Source.Manual.Suffix = []Layer3Ipv6DnsServerSourceManualSuffix{} - for _, oLayer3Ipv6DnsServerSourceManualSuffix := range o.Layer3.Ipv6.DnsServer.Source.Manual.Suffix { - nestedLayer3Ipv6DnsServerSourceManualSuffix := Layer3Ipv6DnsServerSourceManualSuffix{} - if oLayer3Ipv6DnsServerSourceManualSuffix.Misc != nil { - entry.Misc["Layer3Ipv6DnsServerSourceManualSuffix"] = oLayer3Ipv6DnsServerSourceManualSuffix.Misc - } - if oLayer3Ipv6DnsServerSourceManualSuffix.Lifetime != nil { - nestedLayer3Ipv6DnsServerSourceManualSuffix.Lifetime = oLayer3Ipv6DnsServerSourceManualSuffix.Lifetime - } - if oLayer3Ipv6DnsServerSourceManualSuffix.Name != "" { - nestedLayer3Ipv6DnsServerSourceManualSuffix.Name = oLayer3Ipv6DnsServerSourceManualSuffix.Name - } - nestedLayer3.Ipv6.DnsServer.Source.Manual.Suffix = append(nestedLayer3.Ipv6.DnsServer.Source.Manual.Suffix, nestedLayer3Ipv6DnsServerSourceManualSuffix) - } - } - } - } - if o.Layer3.Ipv6.DnsServer.DnsSupport != nil { - nestedLayer3.Ipv6.DnsServer.DnsSupport = &Layer3Ipv6DnsServerDnsSupport{} - if o.Layer3.Ipv6.DnsServer.DnsSupport.Misc != nil { - entry.Misc["Layer3Ipv6DnsServerDnsSupport"] = o.Layer3.Ipv6.DnsServer.DnsSupport.Misc - } - if o.Layer3.Ipv6.DnsServer.DnsSupport.Suffix != nil { - nestedLayer3.Ipv6.DnsServer.DnsSupport.Suffix = []Layer3Ipv6DnsServerDnsSupportSuffix{} - for _, oLayer3Ipv6DnsServerDnsSupportSuffix := range o.Layer3.Ipv6.DnsServer.DnsSupport.Suffix { - nestedLayer3Ipv6DnsServerDnsSupportSuffix := Layer3Ipv6DnsServerDnsSupportSuffix{} - if oLayer3Ipv6DnsServerDnsSupportSuffix.Misc != nil { - entry.Misc["Layer3Ipv6DnsServerDnsSupportSuffix"] = oLayer3Ipv6DnsServerDnsSupportSuffix.Misc - } - if oLayer3Ipv6DnsServerDnsSupportSuffix.Name != "" { - nestedLayer3Ipv6DnsServerDnsSupportSuffix.Name = oLayer3Ipv6DnsServerDnsSupportSuffix.Name - } - if oLayer3Ipv6DnsServerDnsSupportSuffix.Lifetime != nil { - nestedLayer3Ipv6DnsServerDnsSupportSuffix.Lifetime = oLayer3Ipv6DnsServerDnsSupportSuffix.Lifetime - } - nestedLayer3.Ipv6.DnsServer.DnsSupport.Suffix = append(nestedLayer3.Ipv6.DnsServer.DnsSupport.Suffix, nestedLayer3Ipv6DnsServerDnsSupportSuffix) - } - } - if o.Layer3.Ipv6.DnsServer.DnsSupport.Enable != nil { - nestedLayer3.Ipv6.DnsServer.DnsSupport.Enable = util.AsBool(o.Layer3.Ipv6.DnsServer.DnsSupport.Enable, nil) - } - if o.Layer3.Ipv6.DnsServer.DnsSupport.Server != nil { - nestedLayer3.Ipv6.DnsServer.DnsSupport.Server = []Layer3Ipv6DnsServerDnsSupportServer{} - for _, oLayer3Ipv6DnsServerDnsSupportServer := range o.Layer3.Ipv6.DnsServer.DnsSupport.Server { - nestedLayer3Ipv6DnsServerDnsSupportServer := Layer3Ipv6DnsServerDnsSupportServer{} - if oLayer3Ipv6DnsServerDnsSupportServer.Misc != nil { - entry.Misc["Layer3Ipv6DnsServerDnsSupportServer"] = oLayer3Ipv6DnsServerDnsSupportServer.Misc - } - if oLayer3Ipv6DnsServerDnsSupportServer.Lifetime != nil { - nestedLayer3Ipv6DnsServerDnsSupportServer.Lifetime = oLayer3Ipv6DnsServerDnsSupportServer.Lifetime - } - if oLayer3Ipv6DnsServerDnsSupportServer.Name != "" { - nestedLayer3Ipv6DnsServerDnsSupportServer.Name = oLayer3Ipv6DnsServerDnsSupportServer.Name - } - nestedLayer3.Ipv6.DnsServer.DnsSupport.Server = append(nestedLayer3.Ipv6.DnsServer.DnsSupport.Server, nestedLayer3Ipv6DnsServerDnsSupportServer) - } - } - } - } - if o.Layer3.Ipv6.Enabled != nil { - nestedLayer3.Ipv6.Enabled = util.AsBool(o.Layer3.Ipv6.Enabled, nil) - } - if o.Layer3.Ipv6.InterfaceId != nil { - nestedLayer3.Ipv6.InterfaceId = o.Layer3.Ipv6.InterfaceId - } - if o.Layer3.Ipv6.Addresses != nil { - nestedLayer3.Ipv6.Addresses = []Layer3Ipv6Addresses{} - for _, oLayer3Ipv6Addresses := range o.Layer3.Ipv6.Addresses { - nestedLayer3Ipv6Addresses := Layer3Ipv6Addresses{} - if oLayer3Ipv6Addresses.Misc != nil { - entry.Misc["Layer3Ipv6Addresses"] = oLayer3Ipv6Addresses.Misc - } - if oLayer3Ipv6Addresses.EnableOnInterface != nil { - nestedLayer3Ipv6Addresses.EnableOnInterface = util.AsBool(oLayer3Ipv6Addresses.EnableOnInterface, nil) - } - if oLayer3Ipv6Addresses.Prefix != nil { - nestedLayer3Ipv6Addresses.Prefix = oLayer3Ipv6Addresses.Prefix - } - if oLayer3Ipv6Addresses.Anycast != nil { - nestedLayer3Ipv6Addresses.Anycast = oLayer3Ipv6Addresses.Anycast - } - if oLayer3Ipv6Addresses.Advertise != nil { - nestedLayer3Ipv6Addresses.Advertise = &Layer3Ipv6AddressesAdvertise{} - if oLayer3Ipv6Addresses.Advertise.Misc != nil { - entry.Misc["Layer3Ipv6AddressesAdvertise"] = oLayer3Ipv6Addresses.Advertise.Misc - } - if oLayer3Ipv6Addresses.Advertise.OnlinkFlag != nil { - nestedLayer3Ipv6Addresses.Advertise.OnlinkFlag = util.AsBool(oLayer3Ipv6Addresses.Advertise.OnlinkFlag, nil) - } - if oLayer3Ipv6Addresses.Advertise.AutoConfigFlag != nil { - nestedLayer3Ipv6Addresses.Advertise.AutoConfigFlag = util.AsBool(oLayer3Ipv6Addresses.Advertise.AutoConfigFlag, nil) - } - if oLayer3Ipv6Addresses.Advertise.Enable != nil { - nestedLayer3Ipv6Addresses.Advertise.Enable = util.AsBool(oLayer3Ipv6Addresses.Advertise.Enable, nil) - } - if oLayer3Ipv6Addresses.Advertise.ValidLifetime != nil { - nestedLayer3Ipv6Addresses.Advertise.ValidLifetime = oLayer3Ipv6Addresses.Advertise.ValidLifetime - } - if oLayer3Ipv6Addresses.Advertise.PreferredLifetime != nil { - nestedLayer3Ipv6Addresses.Advertise.PreferredLifetime = oLayer3Ipv6Addresses.Advertise.PreferredLifetime - } - } - if oLayer3Ipv6Addresses.Name != "" { - nestedLayer3Ipv6Addresses.Name = oLayer3Ipv6Addresses.Name - } - nestedLayer3.Ipv6.Addresses = append(nestedLayer3.Ipv6.Addresses, nestedLayer3Ipv6Addresses) - } - } - } - if o.Layer3.InterfaceManagementProfile != nil { - nestedLayer3.InterfaceManagementProfile = o.Layer3.InterfaceManagementProfile + } + return true +} +func matchLayer3Ipv6NeighborDiscovery(a *Layer3Ipv6NeighborDiscovery, b *Layer3Ipv6NeighborDiscovery) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.EnableNdpMonitor, b.EnableNdpMonitor) { + return false + } + if !matchLayer3Ipv6NeighborDiscoveryNeighbor(a.Neighbor, b.Neighbor) { + return false + } + if !util.Ints64Match(a.NsInterval, b.NsInterval) { + return false + } + if !util.Ints64Match(a.ReachableTime, b.ReachableTime) { + return false + } + if !matchLayer3Ipv6NeighborDiscoveryRouterAdvertisement(a.RouterAdvertisement, b.RouterAdvertisement) { + return false + } + if !util.Ints64Match(a.DadAttempts, b.DadAttempts) { + return false + } + if !util.BoolsMatch(a.EnableDad, b.EnableDad) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer(a []Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer, b []Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false } - if o.Layer3.NetflowProfile != nil { - nestedLayer3.NetflowProfile = o.Layer3.NetflowProfile + if !util.StringsEqual(a.Name, b.Name) { + return false } - if o.Layer3.SdwanLinkSettings != nil { - nestedLayer3.SdwanLinkSettings = &Layer3SdwanLinkSettings{} - if o.Layer3.SdwanLinkSettings.Misc != nil { - entry.Misc["Layer3SdwanLinkSettings"] = o.Layer3.SdwanLinkSettings.Misc - } - if o.Layer3.SdwanLinkSettings.Enable != nil { - nestedLayer3.SdwanLinkSettings.Enable = util.AsBool(o.Layer3.SdwanLinkSettings.Enable, nil) - } - if o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile != nil { - nestedLayer3.SdwanLinkSettings.SdwanInterfaceProfile = o.Layer3.SdwanLinkSettings.SdwanInterfaceProfile - } - if o.Layer3.SdwanLinkSettings.UpstreamNat != nil { - nestedLayer3.SdwanLinkSettings.UpstreamNat = &Layer3SdwanLinkSettingsUpstreamNat{} - if o.Layer3.SdwanLinkSettings.UpstreamNat.Misc != nil { - entry.Misc["Layer3SdwanLinkSettingsUpstreamNat"] = o.Layer3.SdwanLinkSettings.UpstreamNat.Misc - } - if o.Layer3.SdwanLinkSettings.UpstreamNat.Enable != nil { - nestedLayer3.SdwanLinkSettings.UpstreamNat.Enable = util.AsBool(o.Layer3.SdwanLinkSettings.UpstreamNat.Enable, nil) - } - if o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp != nil { - nestedLayer3.SdwanLinkSettings.UpstreamNat.StaticIp = o.Layer3.SdwanLinkSettings.UpstreamNat.StaticIp - } - } + } + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer(a.Server, b.Server) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6(a.Dhcpv6, b.Dhcpv6) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual(a.Manual, b.Manual) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServer(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServerSource(a.Source, b.Source) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix(a []Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix, b []Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false } - if o.Layer3.AdjustTcpMss != nil { - nestedLayer3.AdjustTcpMss = &Layer3AdjustTcpMss{} - if o.Layer3.AdjustTcpMss.Misc != nil { - entry.Misc["Layer3AdjustTcpMss"] = o.Layer3.AdjustTcpMss.Misc - } - if o.Layer3.AdjustTcpMss.Ipv4MssAdjustment != nil { - nestedLayer3.AdjustTcpMss.Ipv4MssAdjustment = o.Layer3.AdjustTcpMss.Ipv4MssAdjustment - } - if o.Layer3.AdjustTcpMss.Ipv6MssAdjustment != nil { - nestedLayer3.AdjustTcpMss.Ipv6MssAdjustment = o.Layer3.AdjustTcpMss.Ipv6MssAdjustment - } - if o.Layer3.AdjustTcpMss.Enable != nil { - nestedLayer3.AdjustTcpMss.Enable = util.AsBool(o.Layer3.AdjustTcpMss.Enable, nil) - } + if !util.StringsEqual(a.Name, b.Name) { + return false } - if o.Layer3.Mtu != nil { - nestedLayer3.Mtu = o.Layer3.Mtu + } + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix(a.Suffix, b.Suffix) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6(a.Dhcpv6, b.Dhcpv6) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual(a.Manual, b.Manual) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix(a *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix, b *Layer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource(a.Source, b.Source) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor(a []Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor, b []Layer3Ipv6DhcpClientNeighborDiscoveryNeighbor) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.HwAddress, b.HwAddress) { + return false } - if o.Layer3.Ips != nil { - nestedLayer3.Ips = []Layer3Ips{} - for _, oLayer3Ips := range o.Layer3.Ips { - nestedLayer3Ips := Layer3Ips{} - if oLayer3Ips.Misc != nil { - entry.Misc["Layer3Ips"] = oLayer3Ips.Misc - } - if oLayer3Ips.SdwanGateway != nil { - nestedLayer3Ips.SdwanGateway = oLayer3Ips.SdwanGateway - } - if oLayer3Ips.Name != "" { - nestedLayer3Ips.Name = oLayer3Ips.Name - } - nestedLayer3.Ips = append(nestedLayer3.Ips, nestedLayer3Ips) - } + if !util.StringsEqual(a.Name, b.Name) { + return false } - if o.Layer3.Lldp != nil { - nestedLayer3.Lldp = &Layer3Lldp{} - if o.Layer3.Lldp.Misc != nil { - entry.Misc["Layer3Lldp"] = o.Layer3.Lldp.Misc - } - if o.Layer3.Lldp.Enable != nil { - nestedLayer3.Lldp.Enable = util.AsBool(o.Layer3.Lldp.Enable, nil) - } - if o.Layer3.Lldp.Profile != nil { - nestedLayer3.Lldp.Profile = o.Layer3.Lldp.Profile - } + } + } + return true +} +func matchLayer3Ipv6DhcpClientNeighborDiscovery(a *Layer3Ipv6DhcpClientNeighborDiscovery, b *Layer3Ipv6DhcpClientNeighborDiscovery) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.NsInterval, b.NsInterval) { + return false + } + if !util.Ints64Match(a.ReachableTime, b.ReachableTime) { + return false + } + if !util.Ints64Match(a.DadAttempts, b.DadAttempts) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsServer(a.DnsServer, b.DnsServer) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryDnsSuffix(a.DnsSuffix, b.DnsSuffix) { + return false + } + if !util.BoolsMatch(a.EnableDad, b.EnableDad) { + return false + } + if !util.BoolsMatch(a.EnableNdpMonitor, b.EnableNdpMonitor) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscoveryNeighbor(a.Neighbor, b.Neighbor) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientPrefixDelegationEnableNo(a *Layer3Ipv6DhcpClientPrefixDelegationEnableNo, b *Layer3Ipv6DhcpClientPrefixDelegationEnableNo) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchLayer3Ipv6DhcpClientPrefixDelegationEnableYes(a *Layer3Ipv6DhcpClientPrefixDelegationEnableYes, b *Layer3Ipv6DhcpClientPrefixDelegationEnableYes) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.PfxPoolName, b.PfxPoolName) { + return false + } + if !util.Ints64Match(a.PrefixLen, b.PrefixLen) { + return false + } + if !util.BoolsMatch(a.PrefixLenHint, b.PrefixLenHint) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientPrefixDelegationEnable(a *Layer3Ipv6DhcpClientPrefixDelegationEnable, b *Layer3Ipv6DhcpClientPrefixDelegationEnable) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6DhcpClientPrefixDelegationEnableNo(a.No, b.No) { + return false + } + if !matchLayer3Ipv6DhcpClientPrefixDelegationEnableYes(a.Yes, b.Yes) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientPrefixDelegation(a *Layer3Ipv6DhcpClientPrefixDelegation, b *Layer3Ipv6DhcpClientPrefixDelegation) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6DhcpClientPrefixDelegationEnable(a.Enable, b.Enable) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientV6OptionsEnableNo(a *Layer3Ipv6DhcpClientV6OptionsEnableNo, b *Layer3Ipv6DhcpClientV6OptionsEnableNo) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchLayer3Ipv6DhcpClientV6OptionsEnableYes(a *Layer3Ipv6DhcpClientV6OptionsEnableYes, b *Layer3Ipv6DhcpClientV6OptionsEnableYes) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.TempAddr, b.TempAddr) { + return false + } + if !util.BoolsMatch(a.NonTempAddr, b.NonTempAddr) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientV6OptionsEnable(a *Layer3Ipv6DhcpClientV6OptionsEnable, b *Layer3Ipv6DhcpClientV6OptionsEnable) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6DhcpClientV6OptionsEnableYes(a.Yes, b.Yes) { + return false + } + if !matchLayer3Ipv6DhcpClientV6OptionsEnableNo(a.No, b.No) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClientV6Options(a *Layer3Ipv6DhcpClientV6Options, b *Layer3Ipv6DhcpClientV6Options) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.DuidType, b.DuidType) { + return false + } + if !matchLayer3Ipv6DhcpClientV6OptionsEnable(a.Enable, b.Enable) { + return false + } + if !util.BoolsMatch(a.RapidCommit, b.RapidCommit) { + return false + } + if !util.BoolsMatch(a.SupportSrvrReconfig, b.SupportSrvrReconfig) { + return false + } + return true +} +func matchLayer3Ipv6DhcpClient(a *Layer3Ipv6DhcpClient, b *Layer3Ipv6DhcpClient) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6DhcpClientPrefixDelegation(a.PrefixDelegation, b.PrefixDelegation) { + return false + } + if !matchLayer3Ipv6DhcpClientV6Options(a.V6Options, b.V6Options) { + return false + } + if !util.BoolsMatch(a.AcceptRaRoute, b.AcceptRaRoute) { + return false + } + if !util.Ints64Match(a.DefaultRouteMetric, b.DefaultRouteMetric) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3Ipv6DhcpClientNeighborDiscovery(a.NeighborDiscovery, b.NeighborDiscovery) { + return false + } + if !util.StringsMatch(a.Preference, b.Preference) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryNeighbor(a []Layer3Ipv6InheritedNeighborDiscoveryNeighbor, b []Layer3Ipv6InheritedNeighborDiscoveryNeighbor) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false } - if o.Layer3.DhcpClient != nil { - nestedLayer3.DhcpClient = &Layer3DhcpClient{} - if o.Layer3.DhcpClient.Misc != nil { - entry.Misc["Layer3DhcpClient"] = o.Layer3.DhcpClient.Misc - } - if o.Layer3.DhcpClient.DefaultRouteMetric != nil { - nestedLayer3.DhcpClient.DefaultRouteMetric = o.Layer3.DhcpClient.DefaultRouteMetric - } - if o.Layer3.DhcpClient.SendHostname != nil { - nestedLayer3.DhcpClient.SendHostname = &Layer3DhcpClientSendHostname{} - if o.Layer3.DhcpClient.SendHostname.Misc != nil { - entry.Misc["Layer3DhcpClientSendHostname"] = o.Layer3.DhcpClient.SendHostname.Misc - } - if o.Layer3.DhcpClient.SendHostname.Enable != nil { - nestedLayer3.DhcpClient.SendHostname.Enable = util.AsBool(o.Layer3.DhcpClient.SendHostname.Enable, nil) - } - if o.Layer3.DhcpClient.SendHostname.Hostname != nil { - nestedLayer3.DhcpClient.SendHostname.Hostname = o.Layer3.DhcpClient.SendHostname.Hostname - } - } - if o.Layer3.DhcpClient.Enable != nil { - nestedLayer3.DhcpClient.Enable = util.AsBool(o.Layer3.DhcpClient.Enable, nil) - } - if o.Layer3.DhcpClient.CreateDefaultRoute != nil { - nestedLayer3.DhcpClient.CreateDefaultRoute = util.AsBool(o.Layer3.DhcpClient.CreateDefaultRoute, nil) - } + if !util.StringsMatch(a.HwAddress, b.HwAddress) { + return false } - if o.Layer3.Bonjour != nil { - nestedLayer3.Bonjour = &Layer3Bonjour{} - if o.Layer3.Bonjour.Misc != nil { - entry.Misc["Layer3Bonjour"] = o.Layer3.Bonjour.Misc - } - if o.Layer3.Bonjour.Enable != nil { - nestedLayer3.Bonjour.Enable = util.AsBool(o.Layer3.Bonjour.Enable, nil) - } + } + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6(a *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6, b *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.PrefixPool, b.PrefixPool) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer(a []Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer, b []Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false } - if o.Layer3.UntaggedSubInterface != nil { - nestedLayer3.UntaggedSubInterface = util.AsBool(o.Layer3.UntaggedSubInterface, nil) + if !util.StringsEqual(a.Name, b.Name) { + return false } - if o.Layer3.Arp != nil { - nestedLayer3.Arp = []Layer3Arp{} - for _, oLayer3Arp := range o.Layer3.Arp { - nestedLayer3Arp := Layer3Arp{} - if oLayer3Arp.Misc != nil { - entry.Misc["Layer3Arp"] = oLayer3Arp.Misc - } - if oLayer3Arp.HwAddress != nil { - nestedLayer3Arp.HwAddress = oLayer3Arp.HwAddress - } - if oLayer3Arp.Name != "" { - nestedLayer3Arp.Name = oLayer3Arp.Name - } - nestedLayer3.Arp = append(nestedLayer3.Arp, nestedLayer3Arp) - } + } + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual(a *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual, b *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer(a.Server, b.Server) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSource(a *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource, b *Layer3Ipv6InheritedNeighborDiscoveryDnsServerSource) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6(a.Dhcpv6, b.Dhcpv6) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSourceManual(a.Manual, b.Manual) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsServer(a *Layer3Ipv6InheritedNeighborDiscoveryDnsServer, b *Layer3Ipv6InheritedNeighborDiscoveryDnsServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsServerSource(a.Source, b.Source) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6(a *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6, b *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.PrefixPool, b.PrefixPool) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix(a []Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix, b []Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false } - if o.Layer3.NdpProxy != nil { - nestedLayer3.NdpProxy = util.AsBool(o.Layer3.NdpProxy, nil) + if !util.StringsEqual(a.Name, b.Name) { + return false } } - entry.Layer3 = nestedLayer3 - - var nestedTap *Tap - if o.Tap != nil { - nestedTap = &Tap{} - if o.Tap.Misc != nil { - entry.Misc["Tap"] = o.Tap.Misc + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual(a *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual, b *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix(a.Suffix, b.Suffix) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource(a *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource, b *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6(a.Dhcpv6, b.Dhcpv6) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual(a.Manual, b.Manual) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffix(a *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix, b *Layer3Ipv6InheritedNeighborDiscoveryDnsSuffix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffixSource(a.Source, b.Source) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement(a *Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement, b *Layer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.EnableConsistencyCheck, b.EnableConsistencyCheck) { + return false + } + if !util.StringsMatch(a.HopLimit, b.HopLimit) { + return false + } + if !util.StringsMatch(a.LinkMtu, b.LinkMtu) { + return false + } + if !util.Ints64Match(a.MinInterval, b.MinInterval) { + return false + } + if !util.StringsMatch(a.RouterPreference, b.RouterPreference) { + return false + } + if !util.StringsMatch(a.ReachableTime, b.ReachableTime) { + return false + } + if !util.StringsMatch(a.RetransmissionTimer, b.RetransmissionTimer) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.BoolsMatch(a.ManagedFlag, b.ManagedFlag) { + return false + } + if !util.Ints64Match(a.MaxInterval, b.MaxInterval) { + return false + } + if !util.BoolsMatch(a.OtherFlag, b.OtherFlag) { + return false + } + return true +} +func matchLayer3Ipv6InheritedNeighborDiscovery(a *Layer3Ipv6InheritedNeighborDiscovery, b *Layer3Ipv6InheritedNeighborDiscovery) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.DadAttempts, b.DadAttempts) { + return false + } + if !util.BoolsMatch(a.EnableDad, b.EnableDad) { + return false + } + if !util.BoolsMatch(a.EnableNdpMonitor, b.EnableNdpMonitor) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryNeighbor(a.Neighbor, b.Neighbor) { + return false + } + if !util.Ints64Match(a.ReachableTime, b.ReachableTime) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsServer(a.DnsServer, b.DnsServer) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryDnsSuffix(a.DnsSuffix, b.DnsSuffix) { + return false + } + if !util.Ints64Match(a.NsInterval, b.NsInterval) { + return false + } + if !matchLayer3Ipv6InheritedNeighborDiscoveryRouterAdvertisement(a.RouterAdvertisement, b.RouterAdvertisement) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic(a *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic, b *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId(a *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId, b *Layer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Identifier, b.Identifier) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrTypeGuaPoolType(a *Layer3Ipv6InheritedAssignAddrTypeGuaPoolType, b *Layer3Ipv6InheritedAssignAddrTypeGuaPoolType) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId(a.DynamicId, b.DynamicId) { + return false + } + if !matchLayer3Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic(a.Dynamic, b.Dynamic) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrTypeGuaAdvertise(a *Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise, b *Layer3Ipv6InheritedAssignAddrTypeGuaAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.BoolsMatch(a.OnlinkFlag, b.OnlinkFlag) { + return false + } + if !util.BoolsMatch(a.AutoConfigFlag, b.AutoConfigFlag) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrTypeGua(a *Layer3Ipv6InheritedAssignAddrTypeGua, b *Layer3Ipv6InheritedAssignAddrTypeGua) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.EnableOnInterface, b.EnableOnInterface) { + return false + } + if !util.StringsMatch(a.PrefixPool, b.PrefixPool) { + return false + } + if !matchLayer3Ipv6InheritedAssignAddrTypeGuaPoolType(a.PoolType, b.PoolType) { + return false + } + if !matchLayer3Ipv6InheritedAssignAddrTypeGuaAdvertise(a.Advertise, b.Advertise) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrTypeUlaAdvertise(a *Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise, b *Layer3Ipv6InheritedAssignAddrTypeUlaAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.StringsMatch(a.ValidLifetime, b.ValidLifetime) { + return false + } + if !util.StringsMatch(a.PreferredLifetime, b.PreferredLifetime) { + return false + } + if !util.BoolsMatch(a.OnlinkFlag, b.OnlinkFlag) { + return false + } + if !util.BoolsMatch(a.AutoConfigFlag, b.AutoConfigFlag) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrTypeUla(a *Layer3Ipv6InheritedAssignAddrTypeUla, b *Layer3Ipv6InheritedAssignAddrTypeUla) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.EnableOnInterface, b.EnableOnInterface) { + return false + } + if !util.StringsMatch(a.Address, b.Address) { + return false + } + if !util.BoolsMatch(a.Prefix, b.Prefix) { + return false + } + if !util.BoolsMatch(a.Anycast, b.Anycast) { + return false + } + if !matchLayer3Ipv6InheritedAssignAddrTypeUlaAdvertise(a.Advertise, b.Advertise) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddrType(a *Layer3Ipv6InheritedAssignAddrType, b *Layer3Ipv6InheritedAssignAddrType) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchLayer3Ipv6InheritedAssignAddrTypeGua(a.Gua, b.Gua) { + return false + } + if !matchLayer3Ipv6InheritedAssignAddrTypeUla(a.Ula, b.Ula) { + return false + } + return true +} +func matchLayer3Ipv6InheritedAssignAddr(a []Layer3Ipv6InheritedAssignAddr, b []Layer3Ipv6InheritedAssignAddr) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !matchLayer3Ipv6InheritedAssignAddrType(a.Type, b.Type) { + return false } - if o.Tap.NetflowProfile != nil { - nestedTap.NetflowProfile = o.Tap.NetflowProfile + if !util.StringsEqual(a.Name, b.Name) { + return false } } - entry.Tap = nestedTap - - entry.Misc["Entry"] = o.Misc - - entryList = append(entryList, entry) } - - return entryList, nil + return true } - -func SpecMatches(a, b *Entry) bool { +func matchLayer3Ipv6Inherited(a *Layer3Ipv6Inherited, b *Layer3Ipv6Inherited) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - - // Don't compare Name. - if !util.StringsMatch(a.Comment, b.Comment) { + if !matchLayer3Ipv6InheritedAssignAddr(a.AssignAddr, b.AssignAddr) { return false } - if !util.StringsMatch(a.LinkDuplex, b.LinkDuplex) { + if !util.BoolsMatch(a.Enable, b.Enable) { return false } - if !util.StringsMatch(a.LinkSpeed, b.LinkSpeed) { + if !matchLayer3Ipv6InheritedNeighborDiscovery(a.NeighborDiscovery, b.NeighborDiscovery) { return false } - if !util.StringsMatch(a.LinkState, b.LinkState) { + return true +} +func matchLayer3Ipv6AddressPrefix(a *Layer3Ipv6AddressPrefix, b *Layer3Ipv6AddressPrefix) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !matchPoe(a.Poe, b.Poe) { + return true +} +func matchLayer3Ipv6AddressAnycast(a *Layer3Ipv6AddressAnycast, b *Layer3Ipv6AddressAnycast) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !matchHa(a.Ha, b.Ha) { + return true +} +func matchLayer3Ipv6AddressAdvertise(a *Layer3Ipv6AddressAdvertise, b *Layer3Ipv6AddressAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !matchLayer3(a.Layer3, b.Layer3) { + if !util.StringsMatch(a.ValidLifetime, b.ValidLifetime) { return false } - if !matchTap(a.Tap, b.Tap) { + if !util.StringsMatch(a.PreferredLifetime, b.PreferredLifetime) { + return false + } + if !util.BoolsMatch(a.OnlinkFlag, b.OnlinkFlag) { + return false + } + if !util.BoolsMatch(a.AutoConfigFlag, b.AutoConfigFlag) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { return false } - return true } - -func matchPoe(a *Poe, b *Poe) bool { +func matchLayer3Ipv6Address(a []Layer3Ipv6Address, b []Layer3Ipv6Address) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !matchLayer3Ipv6AddressPrefix(a.Prefix, b.Prefix) { + return false + } + if !matchLayer3Ipv6AddressAnycast(a.Anycast, b.Anycast) { + return false + } + if !matchLayer3Ipv6AddressAdvertise(a.Advertise, b.Advertise) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.BoolsMatch(a.EnableOnInterface, b.EnableOnInterface) { + return false + } + } + } + return true +} +func matchLayer3Ipv6(a *Layer3Ipv6, b *Layer3Ipv6) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.BoolsMatch(a.Enabled, b.Enabled) { + if !util.BoolsMatch(a.Enabled, b.Enabled) { + return false + } + if !util.StringsMatch(a.InterfaceId, b.InterfaceId) { + return false + } + if !matchLayer3Ipv6NeighborDiscovery(a.NeighborDiscovery, b.NeighborDiscovery) { + return false + } + if !matchLayer3Ipv6DhcpClient(a.DhcpClient, b.DhcpClient) { + return false + } + if !matchLayer3Ipv6Inherited(a.Inherited, b.Inherited) { return false } - if !util.Ints64Match(a.ReservedPower, b.ReservedPower) { + if !matchLayer3Ipv6Address(a.Address, b.Address) { return false } return true } -func matchTap(a *Tap, b *Tap) bool { +func matchLayer3LldpHighAvailability(a *Layer3LldpHighAvailability, b *Layer3LldpHighAvailability) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.StringsMatch(a.NetflowProfile, b.NetflowProfile) { + if !util.BoolsMatch(a.PassivePreNegotiation, b.PassivePreNegotiation) { return false } return true } -func matchHa(a *Ha, b *Ha) bool { +func matchLayer3Lldp(a *Layer3Lldp, b *Layer3Lldp) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchLayer3LldpHighAvailability(a.HighAvailability, b.HighAvailability) { + return false + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } return true } -func matchLayer3Arp(a []Layer3Arp, b []Layer3Arp) bool { +func matchLayer3SdwanLinkSettingsUpstreamNatDdns(a *Layer3SdwanLinkSettingsUpstreamNatDdns, b *Layer3SdwanLinkSettingsUpstreamNatDdns) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - for _, a := range a { - for _, b := range b { - if !util.StringsMatch(a.HwAddress, b.HwAddress) { - return false - } - if !util.StringsEqual(a.Name, b.Name) { - return false - } - } - } return true } -func matchLayer3Lldp(a *Layer3Lldp, b *Layer3Lldp) bool { +func matchLayer3SdwanLinkSettingsUpstreamNatStaticIp(a *Layer3SdwanLinkSettingsUpstreamNatStaticIp, b *Layer3SdwanLinkSettingsUpstreamNatStaticIp) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.BoolsMatch(a.Enable, b.Enable) { + if !util.StringsMatch(a.Fqdn, b.Fqdn) { return false } - if !util.StringsMatch(a.Profile, b.Profile) { + if !util.StringsMatch(a.IpAddress, b.IpAddress) { return false } return true } -func matchLayer3DhcpClientSendHostname(a *Layer3DhcpClientSendHostname, b *Layer3DhcpClientSendHostname) bool { +func matchLayer3SdwanLinkSettingsUpstreamNat(a *Layer3SdwanLinkSettingsUpstreamNat, b *Layer3SdwanLinkSettingsUpstreamNat) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { @@ -1376,27 +7586,27 @@ func matchLayer3DhcpClientSendHostname(a *Layer3DhcpClientSendHostname, b *Layer if !util.BoolsMatch(a.Enable, b.Enable) { return false } - if !util.StringsMatch(a.Hostname, b.Hostname) { + if !matchLayer3SdwanLinkSettingsUpstreamNatDdns(a.Ddns, b.Ddns) { + return false + } + if !matchLayer3SdwanLinkSettingsUpstreamNatStaticIp(a.StaticIp, b.StaticIp) { return false } return true } -func matchLayer3DhcpClient(a *Layer3DhcpClient, b *Layer3DhcpClient) bool { +func matchLayer3SdwanLinkSettings(a *Layer3SdwanLinkSettings, b *Layer3SdwanLinkSettings) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.Ints64Match(a.DefaultRouteMetric, b.DefaultRouteMetric) { - return false - } - if !matchLayer3DhcpClientSendHostname(a.SendHostname, b.SendHostname) { + if !util.BoolsMatch(a.Enable, b.Enable) { return false } - if !util.BoolsMatch(a.Enable, b.Enable) { + if !util.StringsMatch(a.SdwanInterfaceProfile, b.SdwanInterfaceProfile) { return false } - if !util.BoolsMatch(a.CreateDefaultRoute, b.CreateDefaultRoute) { + if !matchLayer3SdwanLinkSettingsUpstreamNat(a.UpstreamNat, b.UpstreamNat) { return false } return true @@ -1407,12 +7617,18 @@ func matchLayer3Bonjour(a *Layer3Bonjour, b *Layer3Bonjour) bool { } else if a == nil && b == nil { return true } + if !util.Ints64Match(a.GroupId, b.GroupId) { + return false + } + if !util.BoolsMatch(a.TtlCheck, b.TtlCheck) { + return false + } if !util.BoolsMatch(a.Enable, b.Enable) { return false } return true } -func matchLayer3Ips(a []Layer3Ips, b []Layer3Ips) bool { +func matchLayer3DdnsConfigDdnsVendorConfig(a []Layer3DdnsConfigDdnsVendorConfig, b []Layer3DdnsConfigDdnsVendorConfig) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { @@ -1420,7 +7636,7 @@ func matchLayer3Ips(a []Layer3Ips, b []Layer3Ips) bool { } for _, a := range a { for _, b := range b { - if !util.StringsMatch(a.SdwanGateway, b.SdwanGateway) { + if !util.StringsMatch(a.Value, b.Value) { return false } if !util.StringsEqual(a.Name, b.Name) { @@ -1430,159 +7646,133 @@ func matchLayer3Ips(a []Layer3Ips, b []Layer3Ips) bool { } return true } -func matchLayer3Ipv6AddressesAdvertise(a *Layer3Ipv6AddressesAdvertise, b *Layer3Ipv6AddressesAdvertise) bool { +func matchLayer3DdnsConfig(a *Layer3DdnsConfig, b *Layer3DdnsConfig) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.BoolsMatch(a.AutoConfigFlag, b.AutoConfigFlag) { + if !util.OrderedListsMatch(a.DdnsIpv6, b.DdnsIpv6) { return false } - if !util.BoolsMatch(a.Enable, b.Enable) { + if !util.Ints64Match(a.DdnsUpdateInterval, b.DdnsUpdateInterval) { return false } - if !util.StringsMatch(a.ValidLifetime, b.ValidLifetime) { + if !util.StringsMatch(a.DdnsVendor, b.DdnsVendor) { return false } - if !util.StringsMatch(a.PreferredLifetime, b.PreferredLifetime) { + if !matchLayer3DdnsConfigDdnsVendorConfig(a.DdnsVendorConfig, b.DdnsVendorConfig) { return false } - if !util.BoolsMatch(a.OnlinkFlag, b.OnlinkFlag) { + if !util.StringsMatch(a.DdnsCertProfile, b.DdnsCertProfile) { + return false + } + if !util.BoolsMatch(a.DdnsEnabled, b.DdnsEnabled) { + return false + } + if !util.StringsMatch(a.DdnsHostname, b.DdnsHostname) { + return false + } + if !util.OrderedListsMatch(a.DdnsIp, b.DdnsIp) { return false } return true } -func matchLayer3Ipv6Addresses(a []Layer3Ipv6Addresses, b []Layer3Ipv6Addresses) bool { +func matchLayer3PppoeStaticAddress(a *Layer3PppoeStaticAddress, b *Layer3PppoeStaticAddress) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - for _, a := range a { - for _, b := range b { - if !util.StringsMatch(a.Anycast, b.Anycast) { - return false - } - if !matchLayer3Ipv6AddressesAdvertise(a.Advertise, b.Advertise) { - return false - } - if !util.StringsEqual(a.Name, b.Name) { - return false - } - if !util.BoolsMatch(a.EnableOnInterface, b.EnableOnInterface) { - return false - } - if !util.StringsMatch(a.Prefix, b.Prefix) { - return false - } - } + if !util.StringsMatch(a.Ip, b.Ip) { + return false } return true } -func matchLayer3Ipv6NeighborDiscoveryRouterAdvertisement(a *Layer3Ipv6NeighborDiscoveryRouterAdvertisement, b *Layer3Ipv6NeighborDiscoveryRouterAdvertisement) bool { +func matchLayer3PppoePassive(a *Layer3PppoePassive, b *Layer3PppoePassive) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.Ints64Match(a.MaxInterval, b.MaxInterval) { + if !util.BoolsMatch(a.Enable, b.Enable) { return false } - if !util.StringsMatch(a.LinkMtu, b.LinkMtu) { + return true +} +func matchLayer3Pppoe(a *Layer3Pppoe, b *Layer3Pppoe) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !util.Ints64Match(a.Lifetime, b.Lifetime) { + if !util.StringsMatch(a.Password, b.Password) { return false } - if !util.BoolsMatch(a.Enable, b.Enable) { + if !matchLayer3PppoeStaticAddress(a.StaticAddress, b.StaticAddress) { return false } - if !util.StringsMatch(a.ReachableTime, b.ReachableTime) { + if !util.StringsMatch(a.AccessConcentrator, b.AccessConcentrator) { return false } - if !util.StringsMatch(a.RetransmissionTimer, b.RetransmissionTimer) { + if !util.BoolsMatch(a.CreateDefaultRoute, b.CreateDefaultRoute) { return false } - if !util.StringsMatch(a.HopLimit, b.HopLimit) { + if !util.Ints64Match(a.DefaultRouteMetric, b.DefaultRouteMetric) { return false } - if !util.StringsMatch(a.RouterPreference, b.RouterPreference) { + if !util.BoolsMatch(a.Enable, b.Enable) { return false } - if !util.BoolsMatch(a.ManagedFlag, b.ManagedFlag) { + if !util.StringsMatch(a.Authentication, b.Authentication) { return false } - if !util.BoolsMatch(a.OtherFlag, b.OtherFlag) { + if !matchLayer3PppoePassive(a.Passive, b.Passive) { return false } - if !util.BoolsMatch(a.EnableConsistencyCheck, b.EnableConsistencyCheck) { + if !util.StringsMatch(a.Service, b.Service) { return false } - if !util.Ints64Match(a.MinInterval, b.MinInterval) { + if !util.StringsMatch(a.Username, b.Username) { return false } return true } -func matchLayer3Ipv6NeighborDiscoveryNeighbor(a []Layer3Ipv6NeighborDiscoveryNeighbor, b []Layer3Ipv6NeighborDiscoveryNeighbor) bool { +func matchLayer3DhcpClientSendHostname(a *Layer3DhcpClientSendHostname, b *Layer3DhcpClientSendHostname) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - for _, a := range a { - for _, b := range b { - if !util.StringsMatch(a.HwAddress, b.HwAddress) { - return false - } - if !util.StringsEqual(a.Name, b.Name) { - return false - } - } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.StringsMatch(a.Hostname, b.Hostname) { + return false } return true } -func matchLayer3Ipv6NeighborDiscovery(a *Layer3Ipv6NeighborDiscovery, b *Layer3Ipv6NeighborDiscovery) bool { +func matchLayer3DhcpClient(a *Layer3DhcpClient, b *Layer3DhcpClient) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.Ints64Match(a.ReachableTime, b.ReachableTime) { - return false - } - if !matchLayer3Ipv6NeighborDiscoveryRouterAdvertisement(a.RouterAdvertisement, b.RouterAdvertisement) { - return false - } - if !matchLayer3Ipv6NeighborDiscoveryNeighbor(a.Neighbor, b.Neighbor) { - return false - } - if !util.BoolsMatch(a.EnableNdpMonitor, b.EnableNdpMonitor) { - return false - } - if !util.BoolsMatch(a.EnableDad, b.EnableDad) { - return false - } - if !util.Ints64Match(a.DadAttempts, b.DadAttempts) { + if !util.BoolsMatch(a.CreateDefaultRoute, b.CreateDefaultRoute) { return false } - if !util.Ints64Match(a.NsInterval, b.NsInterval) { + if !util.Ints64Match(a.DefaultRouteMetric, b.DefaultRouteMetric) { return false } - return true -} -func matchLayer3Ipv6DnsServerSourceDhcpv6(a *Layer3Ipv6DnsServerSourceDhcpv6, b *Layer3Ipv6DnsServerSourceDhcpv6) bool { - if a == nil && b != nil || a != nil && b == nil { + if !util.BoolsMatch(a.Enable, b.Enable) { return false - } else if a == nil && b == nil { - return true } - if !util.StringsMatch(a.PrefixPool, b.PrefixPool) { + if !matchLayer3DhcpClientSendHostname(a.SendHostname, b.SendHostname) { return false } return true } -func matchLayer3Ipv6DnsServerSourceManualSuffix(a []Layer3Ipv6DnsServerSourceManualSuffix, b []Layer3Ipv6DnsServerSourceManualSuffix) bool { +func matchLayer3NdpProxyAddress(a []Layer3NdpProxyAddress, b []Layer3NdpProxyAddress) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { @@ -1590,7 +7780,7 @@ func matchLayer3Ipv6DnsServerSourceManualSuffix(a []Layer3Ipv6DnsServerSourceMan } for _, a := range a { for _, b := range b { - if !util.Ints64Match(a.Lifetime, b.Lifetime) { + if !util.BoolsMatch(a.Negate, b.Negate) { return false } if !util.StringsEqual(a.Name, b.Name) { @@ -1600,32 +7790,21 @@ func matchLayer3Ipv6DnsServerSourceManualSuffix(a []Layer3Ipv6DnsServerSourceMan } return true } -func matchLayer3Ipv6DnsServerSourceManual(a *Layer3Ipv6DnsServerSourceManual, b *Layer3Ipv6DnsServerSourceManual) bool { +func matchLayer3NdpProxy(a *Layer3NdpProxy, b *Layer3NdpProxy) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !matchLayer3Ipv6DnsServerSourceManualSuffix(a.Suffix, b.Suffix) { + if !matchLayer3NdpProxyAddress(a.Address, b.Address) { return false } - return true -} -func matchLayer3Ipv6DnsServerSource(a *Layer3Ipv6DnsServerSource, b *Layer3Ipv6DnsServerSource) bool { - if a == nil && b != nil || a != nil && b == nil { - return false - } else if a == nil && b == nil { - return true - } - if !matchLayer3Ipv6DnsServerSourceDhcpv6(a.Dhcpv6, b.Dhcpv6) { - return false - } - if !matchLayer3Ipv6DnsServerSourceManual(a.Manual, b.Manual) { + if !util.BoolsMatch(a.Enabled, b.Enabled) { return false } return true } -func matchLayer3Ipv6DnsServerDnsSupportServer(a []Layer3Ipv6DnsServerDnsSupportServer, b []Layer3Ipv6DnsServerDnsSupportServer) bool { +func matchLayer3Arp(a []Layer3Arp, b []Layer3Arp) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { @@ -1633,7 +7812,7 @@ func matchLayer3Ipv6DnsServerDnsSupportServer(a []Layer3Ipv6DnsServerDnsSupportS } for _, a := range a { for _, b := range b { - if !util.Ints64Match(a.Lifetime, b.Lifetime) { + if !util.StringsMatch(a.HwAddress, b.HwAddress) { return false } if !util.StringsEqual(a.Name, b.Name) { @@ -1643,7 +7822,7 @@ func matchLayer3Ipv6DnsServerDnsSupportServer(a []Layer3Ipv6DnsServerDnsSupportS } return true } -func matchLayer3Ipv6DnsServerDnsSupportSuffix(a []Layer3Ipv6DnsServerDnsSupportSuffix, b []Layer3Ipv6DnsServerDnsSupportSuffix) bool { +func matchLayer3Ip(a []Layer3Ip, b []Layer3Ip) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { @@ -1651,7 +7830,7 @@ func matchLayer3Ipv6DnsServerDnsSupportSuffix(a []Layer3Ipv6DnsServerDnsSupportS } for _, a := range a { for _, b := range b { - if !util.Ints64Match(a.Lifetime, b.Lifetime) { + if !util.StringsMatch(a.SdwanGateway, b.SdwanGateway) { return false } if !util.StringsEqual(a.Name, b.Name) { @@ -1661,155 +7840,177 @@ func matchLayer3Ipv6DnsServerDnsSupportSuffix(a []Layer3Ipv6DnsServerDnsSupportS } return true } -func matchLayer3Ipv6DnsServerDnsSupport(a *Layer3Ipv6DnsServerDnsSupport, b *Layer3Ipv6DnsServerDnsSupport) bool { +func matchLayer3(a *Layer3, b *Layer3) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.BoolsMatch(a.Enable, b.Enable) { + if !matchLayer3Bonjour(a.Bonjour, b.Bonjour) { return false } - if !matchLayer3Ipv6DnsServerDnsSupportServer(a.Server, b.Server) { + if !matchLayer3DdnsConfig(a.DdnsConfig, b.DdnsConfig) { return false } - if !matchLayer3Ipv6DnsServerDnsSupportSuffix(a.Suffix, b.Suffix) { + if !util.BoolsMatch(a.DfIgnore, b.DfIgnore) { return false } - return true -} -func matchLayer3Ipv6DnsServer(a *Layer3Ipv6DnsServer, b *Layer3Ipv6DnsServer) bool { - if a == nil && b != nil || a != nil && b == nil { + if !matchLayer3Pppoe(a.Pppoe, b.Pppoe) { return false - } else if a == nil && b == nil { - return true } - if !util.BoolsMatch(a.Enable, b.Enable) { + if !util.BoolsMatch(a.DecryptForward, b.DecryptForward) { return false } - if !matchLayer3Ipv6DnsServerSource(a.Source, b.Source) { + if !matchLayer3DhcpClient(a.DhcpClient, b.DhcpClient) { return false } - if !matchLayer3Ipv6DnsServerDnsSupport(a.DnsSupport, b.DnsSupport) { + if !matchLayer3NdpProxy(a.NdpProxy, b.NdpProxy) { return false } - return true -} -func matchLayer3Ipv6(a *Layer3Ipv6, b *Layer3Ipv6) bool { - if a == nil && b != nil || a != nil && b == nil { + if !util.StringsMatch(a.NetflowProfile, b.NetflowProfile) { return false - } else if a == nil && b == nil { - return true } - if !util.BoolsMatch(a.Enabled, b.Enabled) { + if !util.BoolsMatch(a.ClusterInterconnect, b.ClusterInterconnect) { return false } - if !util.StringsMatch(a.InterfaceId, b.InterfaceId) { + if !matchLayer3Arp(a.Arp, b.Arp) { return false } - if !matchLayer3Ipv6Addresses(a.Addresses, b.Addresses) { + if !matchLayer3Ip(a.Ip, b.Ip) { return false } - if !matchLayer3Ipv6NeighborDiscovery(a.NeighborDiscovery, b.NeighborDiscovery) { + if !util.Ints64Match(a.Mtu, b.Mtu) { return false } - if !matchLayer3Ipv6DnsServer(a.DnsServer, b.DnsServer) { + if !util.BoolsMatch(a.TrafficInterconnect, b.TrafficInterconnect) { return false } - return true -} -func matchLayer3SdwanLinkSettingsUpstreamNat(a *Layer3SdwanLinkSettingsUpstreamNat, b *Layer3SdwanLinkSettingsUpstreamNat) bool { - if a == nil && b != nil || a != nil && b == nil { + if !matchLayer3AdjustTcpMss(a.AdjustTcpMss, b.AdjustTcpMss) { return false - } else if a == nil && b == nil { - return true } - if !util.BoolsMatch(a.Enable, b.Enable) { + if !util.StringsMatch(a.InterfaceManagementProfile, b.InterfaceManagementProfile) { + return false + } + if !matchLayer3Ipv6(a.Ipv6, b.Ipv6) { + return false + } + if !matchLayer3Lldp(a.Lldp, b.Lldp) { return false } - if !util.StringsMatch(a.StaticIp, b.StaticIp) { + if !matchLayer3SdwanLinkSettings(a.SdwanLinkSettings, b.SdwanLinkSettings) { + return false + } + if !util.BoolsMatch(a.UntaggedSubInterface, b.UntaggedSubInterface) { return false } return true } -func matchLayer3SdwanLinkSettings(a *Layer3SdwanLinkSettings, b *Layer3SdwanLinkSettings) bool { +func matchLogCard(a *LogCard, b *LogCard) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.BoolsMatch(a.Enable, b.Enable) { + if !util.StringsMatch(a.Ipv6Address, b.Ipv6Address) { return false } - if !util.StringsMatch(a.SdwanInterfaceProfile, b.SdwanInterfaceProfile) { + if !util.StringsMatch(a.Ipv6DefaultGateway, b.Ipv6DefaultGateway) { return false } - if !matchLayer3SdwanLinkSettingsUpstreamNat(a.UpstreamNat, b.UpstreamNat) { + if !util.StringsMatch(a.Netmask, b.Netmask) { + return false + } + if !util.StringsMatch(a.DefaultGateway, b.DefaultGateway) { + return false + } + if !util.StringsMatch(a.IpAddress, b.IpAddress) { return false } return true } -func matchLayer3AdjustTcpMss(a *Layer3AdjustTcpMss, b *Layer3AdjustTcpMss) bool { +func matchTap(a *Tap, b *Tap) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.BoolsMatch(a.Enable, b.Enable) { + if !util.StringsMatch(a.NetflowProfile, b.NetflowProfile) { return false } - if !util.Ints64Match(a.Ipv4MssAdjustment, b.Ipv4MssAdjustment) { + return true +} +func matchVirtualWireLacpHighAvailability(a *VirtualWireLacpHighAvailability, b *VirtualWireLacpHighAvailability) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !util.Ints64Match(a.Ipv6MssAdjustment, b.Ipv6MssAdjustment) { + if !util.BoolsMatch(a.PassivePreNegotiation, b.PassivePreNegotiation) { return false } return true } -func matchLayer3(a *Layer3, b *Layer3) bool { +func matchVirtualWireLacp(a *VirtualWireLacp, b *VirtualWireLacp) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !matchLayer3SdwanLinkSettings(a.SdwanLinkSettings, b.SdwanLinkSettings) { - return false - } - if !matchLayer3AdjustTcpMss(a.AdjustTcpMss, b.AdjustTcpMss) { + if !matchVirtualWireLacpHighAvailability(a.HighAvailability, b.HighAvailability) { return false } - if !util.Ints64Match(a.Mtu, b.Mtu) { + return true +} +func matchVirtualWireLldpHighAvailability(a *VirtualWireLldpHighAvailability, b *VirtualWireLldpHighAvailability) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !matchLayer3Ips(a.Ips, b.Ips) { + if !util.BoolsMatch(a.PassivePreNegotiation, b.PassivePreNegotiation) { return false } - if !matchLayer3Ipv6(a.Ipv6, b.Ipv6) { + return true +} +func matchVirtualWireLldp(a *VirtualWireLldp, b *VirtualWireLldp) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !util.StringsMatch(a.InterfaceManagementProfile, b.InterfaceManagementProfile) { + if !util.BoolsMatch(a.Enable, b.Enable) { return false } - if !util.StringsMatch(a.NetflowProfile, b.NetflowProfile) { + if !matchVirtualWireLldpHighAvailability(a.HighAvailability, b.HighAvailability) { return false } - if !util.BoolsMatch(a.UntaggedSubInterface, b.UntaggedSubInterface) { + if !util.StringsMatch(a.Profile, b.Profile) { return false } - if !matchLayer3Arp(a.Arp, b.Arp) { + return true +} +func matchVirtualWire(a *VirtualWire, b *VirtualWire) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !util.BoolsMatch(a.NdpProxy, b.NdpProxy) { + if !matchVirtualWireLacp(a.Lacp, b.Lacp) { return false } - if !matchLayer3Lldp(a.Lldp, b.Lldp) { + if !matchVirtualWireLldp(a.Lldp, b.Lldp) { return false } - if !matchLayer3DhcpClient(a.DhcpClient, b.DhcpClient) { + if !util.StringsMatch(a.NetflowProfile, b.NetflowProfile) { return false } - if !matchLayer3Bonjour(a.Bonjour, b.Bonjour) { + return true +} +func matchDecryptMirror(a *DecryptMirror, b *DecryptMirror) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } return true } diff --git a/network/interface/ethernet/location.go b/network/interface/ethernet/location.go index 5b535aaf..855a7f54 100644 --- a/network/interface/ethernet/location.go +++ b/network/interface/ethernet/location.go @@ -17,68 +17,66 @@ type ImportLocation interface { type Layer3TemplateType int const ( - layer3TemplateZone Layer3TemplateType = iota layer3TemplateVirtualRouter Layer3TemplateType = iota layer3TemplateLogicalRouter Layer3TemplateType = iota layer3TemplateVsys Layer3TemplateType = iota + layer3TemplateZone Layer3TemplateType = iota ) type Layer3TemplateImportLocation struct { typ Layer3TemplateType - zone *Layer3TemplateZoneImportLocation virtualRouter *Layer3TemplateVirtualRouterImportLocation logicalRouter *Layer3TemplateLogicalRouterImportLocation vsys *Layer3TemplateVsysImportLocation + zone *Layer3TemplateZoneImportLocation } -type Layer3TemplateZoneImportLocation struct { - xpath []string - zone string - vsys string +type Layer3TemplateVirtualRouterImportLocation struct { + xpath []string + router string + vsys string } -type Layer3TemplateZoneImportLocationSpec struct { - Zone string - Vsys string +type Layer3TemplateVirtualRouterImportLocationSpec struct { + Router string + Vsys string } -func NewLayer3TemplateZoneImportLocation(spec Layer3TemplateZoneImportLocationSpec) *Layer3TemplateImportLocation { - location := &Layer3TemplateZoneImportLocation{ - zone: spec.Zone, - vsys: spec.Vsys, +func NewLayer3TemplateVirtualRouterImportLocation(spec Layer3TemplateVirtualRouterImportLocationSpec) *Layer3TemplateImportLocation { + location := &Layer3TemplateVirtualRouterImportLocation{ + router: spec.Router, + vsys: spec.Vsys, } return &Layer3TemplateImportLocation{ - typ: layer3TemplateZone, - zone: location, + typ: layer3TemplateVirtualRouter, + virtualRouter: location, } } -func (o *Layer3TemplateZoneImportLocation) XpathForLocation(vn version.Number, loc util.ILocation) ([]string, error) { +func (o *Layer3TemplateVirtualRouterImportLocation) XpathForLocation(vn version.Number, loc util.ILocation) ([]string, error) { ans, err := loc.XpathPrefix(vn) if err != nil { return nil, err } importAns := []string{ - "vsys", - util.AsEntryXpath([]string{o.vsys}), - "zone", - util.AsEntryXpath([]string{o.zone}), "network", - "layer3", + "virtual-router", + util.AsEntryXpath([]string{o.router}), + "interface", } return append(ans, importAns...), nil } -func (o *Layer3TemplateZoneImportLocation) MarshalPangoXML(interfaces []string) (string, error) { +func (o *Layer3TemplateVirtualRouterImportLocation) MarshalPangoXML(interfaces []string) (string, error) { type member struct { Name string `xml:",chardata"` } type request struct { - XMLName xml.Name `xml:"layer3"` + XMLName xml.Name `xml:"interface"` Members []member `xml:"member"` } @@ -98,13 +96,13 @@ func (o *Layer3TemplateZoneImportLocation) MarshalPangoXML(interfaces []string) return string(bytes), nil } -func (o *Layer3TemplateZoneImportLocation) UnmarshalPangoXML(bytes []byte) ([]string, error) { +func (o *Layer3TemplateVirtualRouterImportLocation) UnmarshalPangoXML(bytes []byte) ([]string, error) { type member struct { Name string `xml:",chardata"` } type response struct { - Members []member `xml:"result>layer3>member"` + Members []member `xml:"result>interface>member"` } var existing response @@ -121,30 +119,33 @@ func (o *Layer3TemplateZoneImportLocation) UnmarshalPangoXML(bytes []byte) ([]st return interfaces, nil } -type Layer3TemplateVirtualRouterImportLocation struct { +type Layer3TemplateLogicalRouterImportLocation struct { xpath []string vsys string router string + vrf string } -type Layer3TemplateVirtualRouterImportLocationSpec struct { +type Layer3TemplateLogicalRouterImportLocationSpec struct { Vsys string Router string + Vrf string } -func NewLayer3TemplateVirtualRouterImportLocation(spec Layer3TemplateVirtualRouterImportLocationSpec) *Layer3TemplateImportLocation { - location := &Layer3TemplateVirtualRouterImportLocation{ +func NewLayer3TemplateLogicalRouterImportLocation(spec Layer3TemplateLogicalRouterImportLocationSpec) *Layer3TemplateImportLocation { + location := &Layer3TemplateLogicalRouterImportLocation{ vsys: spec.Vsys, router: spec.Router, + vrf: spec.Vrf, } return &Layer3TemplateImportLocation{ - typ: layer3TemplateVirtualRouter, - virtualRouter: location, + typ: layer3TemplateLogicalRouter, + logicalRouter: location, } } -func (o *Layer3TemplateVirtualRouterImportLocation) XpathForLocation(vn version.Number, loc util.ILocation) ([]string, error) { +func (o *Layer3TemplateLogicalRouterImportLocation) XpathForLocation(vn version.Number, loc util.ILocation) ([]string, error) { ans, err := loc.XpathPrefix(vn) if err != nil { return nil, err @@ -152,15 +153,17 @@ func (o *Layer3TemplateVirtualRouterImportLocation) XpathForLocation(vn version. importAns := []string{ "network", - "virtual-router", + "logical-router", util.AsEntryXpath([]string{o.router}), + "vrf", + util.AsEntryXpath([]string{o.vrf}), "interface", } return append(ans, importAns...), nil } -func (o *Layer3TemplateVirtualRouterImportLocation) MarshalPangoXML(interfaces []string) (string, error) { +func (o *Layer3TemplateLogicalRouterImportLocation) MarshalPangoXML(interfaces []string) (string, error) { type member struct { Name string `xml:",chardata"` } @@ -186,7 +189,7 @@ func (o *Layer3TemplateVirtualRouterImportLocation) MarshalPangoXML(interfaces [ return string(bytes), nil } -func (o *Layer3TemplateVirtualRouterImportLocation) UnmarshalPangoXML(bytes []byte) ([]string, error) { +func (o *Layer3TemplateLogicalRouterImportLocation) UnmarshalPangoXML(bytes []byte) ([]string, error) { type member struct { Name string `xml:",chardata"` } @@ -209,51 +212,44 @@ func (o *Layer3TemplateVirtualRouterImportLocation) UnmarshalPangoXML(bytes []by return interfaces, nil } -type Layer3TemplateLogicalRouterImportLocation struct { - xpath []string - router string - vrf string - vsys string +type Layer3TemplateVsysImportLocation struct { + xpath []string + vsys string } -type Layer3TemplateLogicalRouterImportLocationSpec struct { - Router string - Vrf string - Vsys string +type Layer3TemplateVsysImportLocationSpec struct { + Vsys string } -func NewLayer3TemplateLogicalRouterImportLocation(spec Layer3TemplateLogicalRouterImportLocationSpec) *Layer3TemplateImportLocation { - location := &Layer3TemplateLogicalRouterImportLocation{ - router: spec.Router, - vrf: spec.Vrf, - vsys: spec.Vsys, +func NewLayer3TemplateVsysImportLocation(spec Layer3TemplateVsysImportLocationSpec) *Layer3TemplateImportLocation { + location := &Layer3TemplateVsysImportLocation{ + vsys: spec.Vsys, } return &Layer3TemplateImportLocation{ - typ: layer3TemplateLogicalRouter, - logicalRouter: location, + typ: layer3TemplateVsys, + vsys: location, } } -func (o *Layer3TemplateLogicalRouterImportLocation) XpathForLocation(vn version.Number, loc util.ILocation) ([]string, error) { +func (o *Layer3TemplateVsysImportLocation) XpathForLocation(vn version.Number, loc util.ILocation) ([]string, error) { ans, err := loc.XpathPrefix(vn) if err != nil { return nil, err } importAns := []string{ + "vsys", + util.AsEntryXpath([]string{o.vsys}), + "import", "network", - "logical-router", - util.AsEntryXpath([]string{o.router}), - "vrf", - util.AsEntryXpath([]string{o.vrf}), "interface", } return append(ans, importAns...), nil } -func (o *Layer3TemplateLogicalRouterImportLocation) MarshalPangoXML(interfaces []string) (string, error) { +func (o *Layer3TemplateVsysImportLocation) MarshalPangoXML(interfaces []string) (string, error) { type member struct { Name string `xml:",chardata"` } @@ -279,7 +275,7 @@ func (o *Layer3TemplateLogicalRouterImportLocation) MarshalPangoXML(interfaces [ return string(bytes), nil } -func (o *Layer3TemplateLogicalRouterImportLocation) UnmarshalPangoXML(bytes []byte) ([]string, error) { +func (o *Layer3TemplateVsysImportLocation) UnmarshalPangoXML(bytes []byte) ([]string, error) { type member struct { Name string `xml:",chardata"` } @@ -302,27 +298,30 @@ func (o *Layer3TemplateLogicalRouterImportLocation) UnmarshalPangoXML(bytes []by return interfaces, nil } -type Layer3TemplateVsysImportLocation struct { +type Layer3TemplateZoneImportLocation struct { xpath []string vsys string + zone string } -type Layer3TemplateVsysImportLocationSpec struct { +type Layer3TemplateZoneImportLocationSpec struct { Vsys string + Zone string } -func NewLayer3TemplateVsysImportLocation(spec Layer3TemplateVsysImportLocationSpec) *Layer3TemplateImportLocation { - location := &Layer3TemplateVsysImportLocation{ +func NewLayer3TemplateZoneImportLocation(spec Layer3TemplateZoneImportLocationSpec) *Layer3TemplateImportLocation { + location := &Layer3TemplateZoneImportLocation{ vsys: spec.Vsys, + zone: spec.Zone, } return &Layer3TemplateImportLocation{ - typ: layer3TemplateVsys, - vsys: location, + typ: layer3TemplateZone, + zone: location, } } -func (o *Layer3TemplateVsysImportLocation) XpathForLocation(vn version.Number, loc util.ILocation) ([]string, error) { +func (o *Layer3TemplateZoneImportLocation) XpathForLocation(vn version.Number, loc util.ILocation) ([]string, error) { ans, err := loc.XpathPrefix(vn) if err != nil { return nil, err @@ -331,21 +330,22 @@ func (o *Layer3TemplateVsysImportLocation) XpathForLocation(vn version.Number, l importAns := []string{ "vsys", util.AsEntryXpath([]string{o.vsys}), - "import", + "zone", + util.AsEntryXpath([]string{o.zone}), "network", - "interface", + "layer3", } return append(ans, importAns...), nil } -func (o *Layer3TemplateVsysImportLocation) MarshalPangoXML(interfaces []string) (string, error) { +func (o *Layer3TemplateZoneImportLocation) MarshalPangoXML(interfaces []string) (string, error) { type member struct { Name string `xml:",chardata"` } type request struct { - XMLName xml.Name `xml:"interface"` + XMLName xml.Name `xml:"layer3"` Members []member `xml:"member"` } @@ -365,13 +365,13 @@ func (o *Layer3TemplateVsysImportLocation) MarshalPangoXML(interfaces []string) return string(bytes), nil } -func (o *Layer3TemplateVsysImportLocation) UnmarshalPangoXML(bytes []byte) ([]string, error) { +func (o *Layer3TemplateZoneImportLocation) UnmarshalPangoXML(bytes []byte) ([]string, error) { type member struct { Name string `xml:",chardata"` } type response struct { - Members []member `xml:"result>interface>member"` + Members []member `xml:"result>layer3>member"` } var existing response @@ -390,14 +390,14 @@ func (o *Layer3TemplateVsysImportLocation) UnmarshalPangoXML(bytes []byte) ([]st func (o *Layer3TemplateImportLocation) MarshalPangoXML(interfaces []string) (string, error) { switch o.typ { - case layer3TemplateZone: - return o.zone.MarshalPangoXML(interfaces) case layer3TemplateVirtualRouter: return o.virtualRouter.MarshalPangoXML(interfaces) case layer3TemplateLogicalRouter: return o.logicalRouter.MarshalPangoXML(interfaces) case layer3TemplateVsys: return o.vsys.MarshalPangoXML(interfaces) + case layer3TemplateZone: + return o.zone.MarshalPangoXML(interfaces) default: return "", fmt.Errorf("invalid import location") } @@ -405,14 +405,14 @@ func (o *Layer3TemplateImportLocation) MarshalPangoXML(interfaces []string) (str func (o *Layer3TemplateImportLocation) UnmarshalPangoXML(bytes []byte) ([]string, error) { switch o.typ { - case layer3TemplateZone: - return o.zone.UnmarshalPangoXML(bytes) case layer3TemplateVirtualRouter: return o.virtualRouter.UnmarshalPangoXML(bytes) case layer3TemplateLogicalRouter: return o.logicalRouter.UnmarshalPangoXML(bytes) case layer3TemplateVsys: return o.vsys.UnmarshalPangoXML(bytes) + case layer3TemplateZone: + return o.zone.UnmarshalPangoXML(bytes) default: return nil, fmt.Errorf("invalid import location") } @@ -420,14 +420,14 @@ func (o *Layer3TemplateImportLocation) UnmarshalPangoXML(bytes []byte) ([]string func (o *Layer3TemplateImportLocation) XpathForLocation(vn version.Number, loc util.ILocation) ([]string, error) { switch o.typ { - case layer3TemplateZone: - return o.zone.XpathForLocation(vn, loc) case layer3TemplateVirtualRouter: return o.virtualRouter.XpathForLocation(vn, loc) case layer3TemplateLogicalRouter: return o.logicalRouter.XpathForLocation(vn, loc) case layer3TemplateVsys: return o.vsys.XpathForLocation(vn, loc) + case layer3TemplateZone: + return o.zone.XpathForLocation(vn, loc) default: return nil, fmt.Errorf("invalid import location") } @@ -435,6 +435,7 @@ func (o *Layer3TemplateImportLocation) XpathForLocation(vn version.Number, loc u type Location struct { Ngfw *NgfwLocation `json:"ngfw,omitempty"` + Shared bool `json:"shared"` Template *TemplateLocation `json:"template,omitempty"` TemplateStack *TemplateStackLocation `json:"template_stack,omitempty"` } @@ -461,6 +462,11 @@ func NewNgfwLocation() *Location { }, } } +func NewSharedLocation() *Location { + return &Location{ + Shared: true, + } +} func NewTemplateLocation() *Location { return &Location{Template: &TemplateLocation{ NgfwDevice: "localhost.localdomain", @@ -487,6 +493,8 @@ func (o Location) IsValid() error { return fmt.Errorf("NgfwDevice is unspecified") } count++ + case o.Shared: + count++ case o.Template != nil: if o.Template.NgfwDevice == "" { return fmt.Errorf("NgfwDevice is unspecified") @@ -536,6 +544,11 @@ func (o Location) XpathPrefix(vn version.Number) ([]string, error) { "devices", util.AsEntryXpath([]string{o.Ngfw.NgfwDevice}), } + case o.Shared: + ans = []string{ + "config", + "shared", + } case o.Template != nil: if o.Template.NgfwDevice == "" { return nil, fmt.Errorf("NgfwDevice is unspecified") diff --git a/network/interface/ethernet/service.go b/network/interface/ethernet/service.go index 7ad26bb2..a7d010e3 100644 --- a/network/interface/ethernet/service.go +++ b/network/interface/ethernet/service.go @@ -3,6 +3,7 @@ package ethernet import ( "context" "fmt" + "sync" "github.com/PaloAltoNetworks/pango/errors" "github.com/PaloAltoNetworks/pango/filtering" @@ -10,6 +11,26 @@ import ( "github.com/PaloAltoNetworks/pango/xmlapi" ) +var ( + importsMutexMap = make(map[string]*sync.Mutex) + importsMutexMapLock = sync.Mutex{} +) + +func (s *Service) getImportMutex(xpath string) *sync.Mutex { + importsMutexMapLock.Lock() + defer importsMutexMapLock.Unlock() + + var importMutex *sync.Mutex + var ok bool + importMutex, ok = importsMutexMap[xpath] + if !ok { + importMutex = &sync.Mutex{} + importsMutexMap[xpath] = importMutex + } + + return importMutex +} + type Service struct { client util.PangoClient } @@ -60,8 +81,16 @@ func (s *Service) Create(ctx context.Context, loc Location, importLocations []Im func (s *Service) importToLocations(ctx context.Context, loc Location, importLocations []ImportLocation, entryName string) error { vn := s.client.Versioning() - for _, elt := range importLocations { - xpath, err := elt.XpathForLocation(vn, loc) + + importToLocation := func(il ImportLocation) error { + xpath, err := il.XpathForLocation(vn, loc) + if err != nil { + return err + } + + mutex := s.getImportMutex(util.AsXpath(xpath)) + mutex.Lock() + defer mutex.Unlock() cmd := &xmlapi.Config{ Action: "get", @@ -73,7 +102,7 @@ func (s *Service) importToLocations(ctx context.Context, loc Location, importLoc return err } - existing, err := elt.UnmarshalPangoXML(bytes) + existing, err := il.UnmarshalPangoXML(bytes) if err != nil { return err } @@ -86,7 +115,7 @@ func (s *Service) importToLocations(ctx context.Context, loc Location, importLoc existing = append(existing, entryName) - element, err := elt.MarshalPangoXML(existing) + element, err := il.MarshalPangoXML(existing) if err != nil { return err } @@ -101,19 +130,36 @@ func (s *Service) importToLocations(ctx context.Context, loc Location, importLoc if err != nil { return err } + + return err + } + + for _, elt := range importLocations { + err := importToLocation(elt) + if err != nil { + return err + } } return nil } -func (s *Service) unimportFromLocations(ctx context.Context, updates *xmlapi.MultiConfig, loc Location, importLocations []ImportLocation, values []string) error { +func (s *Service) unimportFromLocations(ctx context.Context, loc Location, importLocations []ImportLocation, values []string) error { vn := s.client.Versioning() valuesByName := make(map[string]bool) for _, elt := range values { valuesByName[elt] = true } - for _, elt := range importLocations { - xpath, err := elt.XpathForLocation(vn, loc) + + unimportFromLocation := func(il ImportLocation) error { + xpath, err := il.XpathForLocation(vn, loc) + if err != nil { + return err + } + + mutex := s.getImportMutex(util.AsXpath(xpath)) + mutex.Lock() + defer mutex.Unlock() cmd := &xmlapi.Config{ Action: "get", @@ -125,7 +171,7 @@ func (s *Service) unimportFromLocations(ctx context.Context, updates *xmlapi.Mul return err } - existing, err := elt.UnmarshalPangoXML(bytes) + existing, err := il.UnmarshalPangoXML(bytes) if err != nil { return err } @@ -137,7 +183,7 @@ func (s *Service) unimportFromLocations(ctx context.Context, updates *xmlapi.Mul } } - element, err := elt.MarshalPangoXML(filtered) + element, err := il.MarshalPangoXML(filtered) if err != nil { return err } @@ -152,6 +198,15 @@ func (s *Service) unimportFromLocations(ctx context.Context, updates *xmlapi.Mul if err != nil { return err } + + return err + } + + for _, elt := range importLocations { + err := unimportFromLocation(elt) + if err != nil { + return err + } } return nil @@ -291,7 +346,7 @@ func (s *Service) delete(ctx context.Context, loc Location, importLocations []Im vn := s.client.Versioning() var err error deletes := xmlapi.NewMultiConfig(len(values)) - err = s.unimportFromLocations(ctx, deletes, loc, importLocations, values) + err = s.unimportFromLocations(ctx, loc, importLocations, values) if err != nil { return err } diff --git a/network/interface/loopback/entry.go b/network/interface/loopback/entry.go index f7eac0b1..0ef53c5c 100644 --- a/network/interface/loopback/entry.go +++ b/network/interface/loopback/entry.go @@ -23,7 +23,7 @@ type Entry struct { AdjustTcpMss *AdjustTcpMss Comment *string InterfaceManagementProfile *string - Ips []string + Ip []Ip Ipv6 *Ipv6 Mtu *int64 NetflowProfile *string @@ -36,13 +36,23 @@ type AdjustTcpMss struct { Ipv4MssAdjustment *int64 Ipv6MssAdjustment *int64 } +type Ip struct { + Name string +} type Ipv6 struct { - Addresses []Ipv6Addresses - Enabled *bool + Address []Ipv6Address + Enabled *bool + InterfaceId *string } -type Ipv6Addresses struct { +type Ipv6Address struct { + Anycast *Ipv6AddressAnycast EnableOnInterface *bool Name string + Prefix *Ipv6AddressPrefix +} +type Ipv6AddressAnycast struct { +} +type Ipv6AddressPrefix struct { } type entryXmlContainer struct { @@ -55,14 +65,13 @@ type entryXml struct { AdjustTcpMss *AdjustTcpMssXml `xml:"adjust-tcp-mss,omitempty"` Comment *string `xml:"comment,omitempty"` InterfaceManagementProfile *string `xml:"interface-management-profile,omitempty"` - Ips *util.EntryType `xml:"ip,omitempty"` + Ip []IpXml `xml:"ip>entry,omitempty"` Ipv6 *Ipv6Xml `xml:"ipv6,omitempty"` Mtu *int64 `xml:"mtu,omitempty"` NetflowProfile *string `xml:"netflow-profile,omitempty"` Misc []generic.Xml `xml:",any"` } - type AdjustTcpMssXml struct { Enable *string `xml:"enable,omitempty"` Ipv4MssAdjustment *int64 `xml:"ipv4-mss-adjustment,omitempty"` @@ -70,19 +79,34 @@ type AdjustTcpMssXml struct { Misc []generic.Xml `xml:",any"` } +type IpXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} type Ipv6Xml struct { - Addresses []Ipv6AddressesXml `xml:"address>entry,omitempty"` - Enabled *string `xml:"enabled,omitempty"` + Address []Ipv6AddressXml `xml:"address>entry,omitempty"` + Enabled *string `xml:"enabled,omitempty"` + InterfaceId *string `xml:"interface-id,omitempty"` Misc []generic.Xml `xml:",any"` } -type Ipv6AddressesXml struct { - EnableOnInterface *string `xml:"enable-on-interface,omitempty"` - XMLName xml.Name `xml:"entry"` - Name string `xml:"name,attr"` +type Ipv6AddressXml struct { + Anycast *Ipv6AddressAnycastXml `xml:"anycast,omitempty"` + EnableOnInterface *string `xml:"enable-on-interface,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Prefix *Ipv6AddressPrefixXml `xml:"prefix,omitempty"` Misc []generic.Xml `xml:",any"` } +type Ipv6AddressAnycastXml struct { + Misc []generic.Xml `xml:",any"` +} +type Ipv6AddressPrefixXml struct { + Misc []generic.Xml `xml:",any"` +} func (e *Entry) Field(v string) (any, error) { if v == "name" || v == "Name" { @@ -97,11 +121,11 @@ func (e *Entry) Field(v string) (any, error) { if v == "interface_management_profile" || v == "InterfaceManagementProfile" { return e.InterfaceManagementProfile, nil } - if v == "ips" || v == "Ips" { - return e.Ips, nil + if v == "ip" || v == "Ip" { + return e.Ip, nil } - if v == "ips|LENGTH" || v == "Ips|LENGTH" { - return int64(len(e.Ips)), nil + if v == "ip|LENGTH" || v == "Ip|LENGTH" { + return int64(len(e.Ip)), nil } if v == "ipv6" || v == "Ipv6" { return e.Ipv6, nil @@ -117,12 +141,11 @@ func (e *Entry) Field(v string) (any, error) { } func Versioning(vn version.Number) (Specifier, Normalizer, error) { + return specifyEntry, &entryXmlContainer{}, nil } - func specifyEntry(o *Entry) (any, error) { entry := entryXml{} - entry.Name = o.Name var nestedAdjustTcpMss *AdjustTcpMssXml if o.AdjustTcpMss != nil { @@ -144,32 +167,62 @@ func specifyEntry(o *Entry) (any, error) { entry.Comment = o.Comment entry.InterfaceManagementProfile = o.InterfaceManagementProfile - entry.Ips = util.StrToEnt(o.Ips) + var nestedIpCol []IpXml + if o.Ip != nil { + nestedIpCol = []IpXml{} + for _, oIp := range o.Ip { + nestedIp := IpXml{} + if _, ok := o.Misc["Ip"]; ok { + nestedIp.Misc = o.Misc["Ip"] + } + if oIp.Name != "" { + nestedIp.Name = oIp.Name + } + nestedIpCol = append(nestedIpCol, nestedIp) + } + entry.Ip = nestedIpCol + } + var nestedIpv6 *Ipv6Xml if o.Ipv6 != nil { nestedIpv6 = &Ipv6Xml{} if _, ok := o.Misc["Ipv6"]; ok { nestedIpv6.Misc = o.Misc["Ipv6"] } - if o.Ipv6.Enabled != nil { - nestedIpv6.Enabled = util.YesNo(o.Ipv6.Enabled, nil) + if o.Ipv6.InterfaceId != nil { + nestedIpv6.InterfaceId = o.Ipv6.InterfaceId } - if o.Ipv6.Addresses != nil { - nestedIpv6.Addresses = []Ipv6AddressesXml{} - for _, oIpv6Addresses := range o.Ipv6.Addresses { - nestedIpv6Addresses := Ipv6AddressesXml{} - if _, ok := o.Misc["Ipv6Addresses"]; ok { - nestedIpv6Addresses.Misc = o.Misc["Ipv6Addresses"] + if o.Ipv6.Address != nil { + nestedIpv6.Address = []Ipv6AddressXml{} + for _, oIpv6Address := range o.Ipv6.Address { + nestedIpv6Address := Ipv6AddressXml{} + if _, ok := o.Misc["Ipv6Address"]; ok { + nestedIpv6Address.Misc = o.Misc["Ipv6Address"] + } + if oIpv6Address.Anycast != nil { + nestedIpv6Address.Anycast = &Ipv6AddressAnycastXml{} + if _, ok := o.Misc["Ipv6AddressAnycast"]; ok { + nestedIpv6Address.Anycast.Misc = o.Misc["Ipv6AddressAnycast"] + } } - if oIpv6Addresses.EnableOnInterface != nil { - nestedIpv6Addresses.EnableOnInterface = util.YesNo(oIpv6Addresses.EnableOnInterface, nil) + if oIpv6Address.Name != "" { + nestedIpv6Address.Name = oIpv6Address.Name } - if oIpv6Addresses.Name != "" { - nestedIpv6Addresses.Name = oIpv6Addresses.Name + if oIpv6Address.EnableOnInterface != nil { + nestedIpv6Address.EnableOnInterface = util.YesNo(oIpv6Address.EnableOnInterface, nil) } - nestedIpv6.Addresses = append(nestedIpv6.Addresses, nestedIpv6Addresses) + if oIpv6Address.Prefix != nil { + nestedIpv6Address.Prefix = &Ipv6AddressPrefixXml{} + if _, ok := o.Misc["Ipv6AddressPrefix"]; ok { + nestedIpv6Address.Prefix.Misc = o.Misc["Ipv6AddressPrefix"] + } + } + nestedIpv6.Address = append(nestedIpv6.Address, nestedIpv6Address) } } + if o.Ipv6.Enabled != nil { + nestedIpv6.Enabled = util.YesNo(o.Ipv6.Enabled, nil) + } } entry.Ipv6 = nestedIpv6 @@ -180,6 +233,7 @@ func specifyEntry(o *Entry) (any, error) { return entry, nil } + func (c *entryXmlContainer) Normalize() ([]*Entry, error) { entryList := make([]*Entry, 0, len(c.Answer)) for _, o := range c.Answer { @@ -207,32 +261,62 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { entry.Comment = o.Comment entry.InterfaceManagementProfile = o.InterfaceManagementProfile - entry.Ips = util.EntToStr(o.Ips) + var nestedIpCol []Ip + if o.Ip != nil { + nestedIpCol = []Ip{} + for _, oIp := range o.Ip { + nestedIp := Ip{} + if oIp.Misc != nil { + entry.Misc["Ip"] = oIp.Misc + } + if oIp.Name != "" { + nestedIp.Name = oIp.Name + } + nestedIpCol = append(nestedIpCol, nestedIp) + } + entry.Ip = nestedIpCol + } + var nestedIpv6 *Ipv6 if o.Ipv6 != nil { nestedIpv6 = &Ipv6{} if o.Ipv6.Misc != nil { entry.Misc["Ipv6"] = o.Ipv6.Misc } - if o.Ipv6.Addresses != nil { - nestedIpv6.Addresses = []Ipv6Addresses{} - for _, oIpv6Addresses := range o.Ipv6.Addresses { - nestedIpv6Addresses := Ipv6Addresses{} - if oIpv6Addresses.Misc != nil { - entry.Misc["Ipv6Addresses"] = oIpv6Addresses.Misc + if o.Ipv6.Address != nil { + nestedIpv6.Address = []Ipv6Address{} + for _, oIpv6Address := range o.Ipv6.Address { + nestedIpv6Address := Ipv6Address{} + if oIpv6Address.Misc != nil { + entry.Misc["Ipv6Address"] = oIpv6Address.Misc } - if oIpv6Addresses.EnableOnInterface != nil { - nestedIpv6Addresses.EnableOnInterface = util.AsBool(oIpv6Addresses.EnableOnInterface, nil) + if oIpv6Address.EnableOnInterface != nil { + nestedIpv6Address.EnableOnInterface = util.AsBool(oIpv6Address.EnableOnInterface, nil) } - if oIpv6Addresses.Name != "" { - nestedIpv6Addresses.Name = oIpv6Addresses.Name + if oIpv6Address.Prefix != nil { + nestedIpv6Address.Prefix = &Ipv6AddressPrefix{} + if oIpv6Address.Prefix.Misc != nil { + entry.Misc["Ipv6AddressPrefix"] = oIpv6Address.Prefix.Misc + } } - nestedIpv6.Addresses = append(nestedIpv6.Addresses, nestedIpv6Addresses) + if oIpv6Address.Anycast != nil { + nestedIpv6Address.Anycast = &Ipv6AddressAnycast{} + if oIpv6Address.Anycast.Misc != nil { + entry.Misc["Ipv6AddressAnycast"] = oIpv6Address.Anycast.Misc + } + } + if oIpv6Address.Name != "" { + nestedIpv6Address.Name = oIpv6Address.Name + } + nestedIpv6.Address = append(nestedIpv6.Address, nestedIpv6Address) } } if o.Ipv6.Enabled != nil { nestedIpv6.Enabled = util.AsBool(o.Ipv6.Enabled, nil) } + if o.Ipv6.InterfaceId != nil { + nestedIpv6.InterfaceId = o.Ipv6.InterfaceId + } } entry.Ipv6 = nestedIpv6 @@ -264,7 +348,7 @@ func SpecMatches(a, b *Entry) bool { if !util.StringsMatch(a.InterfaceManagementProfile, b.InterfaceManagementProfile) { return false } - if !util.OrderedListsMatch(a.Ips, b.Ips) { + if !matchIp(a.Ip, b.Ip) { return false } if !matchIpv6(a.Ipv6, b.Ipv6) { @@ -280,7 +364,24 @@ func SpecMatches(a, b *Entry) bool { return true } -func matchIpv6Addresses(a []Ipv6Addresses, b []Ipv6Addresses) bool { +func matchAdjustTcpMss(a *AdjustTcpMss, b *AdjustTcpMss) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Ipv4MssAdjustment, b.Ipv4MssAdjustment) { + return false + } + if !util.Ints64Match(a.Ipv6MssAdjustment, b.Ipv6MssAdjustment) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + return true +} +func matchIp(a []Ip, b []Ip) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { @@ -288,9 +389,6 @@ func matchIpv6Addresses(a []Ipv6Addresses, b []Ipv6Addresses) bool { } for _, a := range a { for _, b := range b { - if !util.BoolsMatch(a.EnableOnInterface, b.EnableOnInterface) { - return false - } if !util.StringsEqual(a.Name, b.Name) { return false } @@ -298,33 +396,59 @@ func matchIpv6Addresses(a []Ipv6Addresses, b []Ipv6Addresses) bool { } return true } -func matchIpv6(a *Ipv6, b *Ipv6) bool { +func matchIpv6AddressPrefix(a *Ipv6AddressPrefix, b *Ipv6AddressPrefix) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.BoolsMatch(a.Enabled, b.Enabled) { + return true +} +func matchIpv6AddressAnycast(a *Ipv6AddressAnycast, b *Ipv6AddressAnycast) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !matchIpv6Addresses(a.Addresses, b.Addresses) { + return true +} +func matchIpv6Address(a []Ipv6Address, b []Ipv6Address) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.EnableOnInterface, b.EnableOnInterface) { + return false + } + if !matchIpv6AddressPrefix(a.Prefix, b.Prefix) { + return false + } + if !matchIpv6AddressAnycast(a.Anycast, b.Anycast) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } } return true } -func matchAdjustTcpMss(a *AdjustTcpMss, b *AdjustTcpMss) bool { +func matchIpv6(a *Ipv6, b *Ipv6) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.BoolsMatch(a.Enable, b.Enable) { + if !matchIpv6Address(a.Address, b.Address) { return false } - if !util.Ints64Match(a.Ipv4MssAdjustment, b.Ipv4MssAdjustment) { + if !util.BoolsMatch(a.Enabled, b.Enabled) { return false } - if !util.Ints64Match(a.Ipv6MssAdjustment, b.Ipv6MssAdjustment) { + if !util.StringsMatch(a.InterfaceId, b.InterfaceId) { return false } return true diff --git a/network/interface/tunnel/entry.go b/network/interface/tunnel/entry.go new file mode 100644 index 00000000..132d3c56 --- /dev/null +++ b/network/interface/tunnel/entry.go @@ -0,0 +1,483 @@ +package tunnel + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"network", "interface", "tunnel", "units"} +) + +type Entry struct { + Name string + Bonjour *Bonjour + Comment *string + DfIgnore *bool + InterfaceManagementProfile *string + Ip []Ip + Ipv6 *Ipv6 + LinkTag *string + Mtu *int64 + NetflowProfile *string + + Misc map[string][]generic.Xml +} + +type Bonjour struct { + Enable *bool + GroupId *int64 + TtlCheck *bool +} +type Ip struct { + Name string +} +type Ipv6 struct { + Address []Ipv6Address + Enabled *bool + InterfaceId *string +} +type Ipv6Address struct { + Anycast *Ipv6AddressAnycast + EnableOnInterface *bool + Name string + Prefix *Ipv6AddressPrefix +} +type Ipv6AddressAnycast struct { +} +type Ipv6AddressPrefix struct { +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Bonjour *BonjourXml `xml:"bonjour,omitempty"` + Comment *string `xml:"comment,omitempty"` + DfIgnore *string `xml:"df-ignore,omitempty"` + InterfaceManagementProfile *string `xml:"interface-management-profile,omitempty"` + Ip []IpXml `xml:"ip>entry,omitempty"` + Ipv6 *Ipv6Xml `xml:"ipv6,omitempty"` + LinkTag *string `xml:"link-tag,omitempty"` + Mtu *int64 `xml:"mtu,omitempty"` + NetflowProfile *string `xml:"netflow-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type BonjourXml struct { + Enable *string `xml:"enable,omitempty"` + GroupId *int64 `xml:"group-id,omitempty"` + TtlCheck *string `xml:"ttl-check,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type IpXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6Xml struct { + Address []Ipv6AddressXml `xml:"address>entry,omitempty"` + Enabled *string `xml:"enabled,omitempty"` + InterfaceId *string `xml:"interface-id,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6AddressXml struct { + Anycast *Ipv6AddressAnycastXml `xml:"anycast,omitempty"` + EnableOnInterface *string `xml:"enable-on-interface,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Prefix *Ipv6AddressPrefixXml `xml:"prefix,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6AddressAnycastXml struct { + Misc []generic.Xml `xml:",any"` +} +type Ipv6AddressPrefixXml struct { + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "bonjour" || v == "Bonjour" { + return e.Bonjour, nil + } + if v == "comment" || v == "Comment" { + return e.Comment, nil + } + if v == "df_ignore" || v == "DfIgnore" { + return e.DfIgnore, nil + } + if v == "interface_management_profile" || v == "InterfaceManagementProfile" { + return e.InterfaceManagementProfile, nil + } + if v == "ip" || v == "Ip" { + return e.Ip, nil + } + if v == "ip|LENGTH" || v == "Ip|LENGTH" { + return int64(len(e.Ip)), nil + } + if v == "ipv6" || v == "Ipv6" { + return e.Ipv6, nil + } + if v == "link_tag" || v == "LinkTag" { + return e.LinkTag, nil + } + if v == "mtu" || v == "Mtu" { + return e.Mtu, nil + } + if v == "netflow_profile" || v == "NetflowProfile" { + return e.NetflowProfile, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + var nestedBonjour *BonjourXml + if o.Bonjour != nil { + nestedBonjour = &BonjourXml{} + if _, ok := o.Misc["Bonjour"]; ok { + nestedBonjour.Misc = o.Misc["Bonjour"] + } + if o.Bonjour.Enable != nil { + nestedBonjour.Enable = util.YesNo(o.Bonjour.Enable, nil) + } + if o.Bonjour.GroupId != nil { + nestedBonjour.GroupId = o.Bonjour.GroupId + } + if o.Bonjour.TtlCheck != nil { + nestedBonjour.TtlCheck = util.YesNo(o.Bonjour.TtlCheck, nil) + } + } + entry.Bonjour = nestedBonjour + + entry.Comment = o.Comment + entry.DfIgnore = util.YesNo(o.DfIgnore, nil) + entry.InterfaceManagementProfile = o.InterfaceManagementProfile + var nestedIpCol []IpXml + if o.Ip != nil { + nestedIpCol = []IpXml{} + for _, oIp := range o.Ip { + nestedIp := IpXml{} + if _, ok := o.Misc["Ip"]; ok { + nestedIp.Misc = o.Misc["Ip"] + } + if oIp.Name != "" { + nestedIp.Name = oIp.Name + } + nestedIpCol = append(nestedIpCol, nestedIp) + } + entry.Ip = nestedIpCol + } + + var nestedIpv6 *Ipv6Xml + if o.Ipv6 != nil { + nestedIpv6 = &Ipv6Xml{} + if _, ok := o.Misc["Ipv6"]; ok { + nestedIpv6.Misc = o.Misc["Ipv6"] + } + if o.Ipv6.InterfaceId != nil { + nestedIpv6.InterfaceId = o.Ipv6.InterfaceId + } + if o.Ipv6.Address != nil { + nestedIpv6.Address = []Ipv6AddressXml{} + for _, oIpv6Address := range o.Ipv6.Address { + nestedIpv6Address := Ipv6AddressXml{} + if _, ok := o.Misc["Ipv6Address"]; ok { + nestedIpv6Address.Misc = o.Misc["Ipv6Address"] + } + if oIpv6Address.Prefix != nil { + nestedIpv6Address.Prefix = &Ipv6AddressPrefixXml{} + if _, ok := o.Misc["Ipv6AddressPrefix"]; ok { + nestedIpv6Address.Prefix.Misc = o.Misc["Ipv6AddressPrefix"] + } + } + if oIpv6Address.Anycast != nil { + nestedIpv6Address.Anycast = &Ipv6AddressAnycastXml{} + if _, ok := o.Misc["Ipv6AddressAnycast"]; ok { + nestedIpv6Address.Anycast.Misc = o.Misc["Ipv6AddressAnycast"] + } + } + if oIpv6Address.Name != "" { + nestedIpv6Address.Name = oIpv6Address.Name + } + if oIpv6Address.EnableOnInterface != nil { + nestedIpv6Address.EnableOnInterface = util.YesNo(oIpv6Address.EnableOnInterface, nil) + } + nestedIpv6.Address = append(nestedIpv6.Address, nestedIpv6Address) + } + } + if o.Ipv6.Enabled != nil { + nestedIpv6.Enabled = util.YesNo(o.Ipv6.Enabled, nil) + } + } + entry.Ipv6 = nestedIpv6 + + entry.LinkTag = o.LinkTag + entry.Mtu = o.Mtu + entry.NetflowProfile = o.NetflowProfile + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + var nestedBonjour *Bonjour + if o.Bonjour != nil { + nestedBonjour = &Bonjour{} + if o.Bonjour.Misc != nil { + entry.Misc["Bonjour"] = o.Bonjour.Misc + } + if o.Bonjour.TtlCheck != nil { + nestedBonjour.TtlCheck = util.AsBool(o.Bonjour.TtlCheck, nil) + } + if o.Bonjour.Enable != nil { + nestedBonjour.Enable = util.AsBool(o.Bonjour.Enable, nil) + } + if o.Bonjour.GroupId != nil { + nestedBonjour.GroupId = o.Bonjour.GroupId + } + } + entry.Bonjour = nestedBonjour + + entry.Comment = o.Comment + entry.DfIgnore = util.AsBool(o.DfIgnore, nil) + entry.InterfaceManagementProfile = o.InterfaceManagementProfile + var nestedIpCol []Ip + if o.Ip != nil { + nestedIpCol = []Ip{} + for _, oIp := range o.Ip { + nestedIp := Ip{} + if oIp.Misc != nil { + entry.Misc["Ip"] = oIp.Misc + } + if oIp.Name != "" { + nestedIp.Name = oIp.Name + } + nestedIpCol = append(nestedIpCol, nestedIp) + } + entry.Ip = nestedIpCol + } + + var nestedIpv6 *Ipv6 + if o.Ipv6 != nil { + nestedIpv6 = &Ipv6{} + if o.Ipv6.Misc != nil { + entry.Misc["Ipv6"] = o.Ipv6.Misc + } + if o.Ipv6.Address != nil { + nestedIpv6.Address = []Ipv6Address{} + for _, oIpv6Address := range o.Ipv6.Address { + nestedIpv6Address := Ipv6Address{} + if oIpv6Address.Misc != nil { + entry.Misc["Ipv6Address"] = oIpv6Address.Misc + } + if oIpv6Address.Anycast != nil { + nestedIpv6Address.Anycast = &Ipv6AddressAnycast{} + if oIpv6Address.Anycast.Misc != nil { + entry.Misc["Ipv6AddressAnycast"] = oIpv6Address.Anycast.Misc + } + } + if oIpv6Address.Name != "" { + nestedIpv6Address.Name = oIpv6Address.Name + } + if oIpv6Address.EnableOnInterface != nil { + nestedIpv6Address.EnableOnInterface = util.AsBool(oIpv6Address.EnableOnInterface, nil) + } + if oIpv6Address.Prefix != nil { + nestedIpv6Address.Prefix = &Ipv6AddressPrefix{} + if oIpv6Address.Prefix.Misc != nil { + entry.Misc["Ipv6AddressPrefix"] = oIpv6Address.Prefix.Misc + } + } + nestedIpv6.Address = append(nestedIpv6.Address, nestedIpv6Address) + } + } + if o.Ipv6.Enabled != nil { + nestedIpv6.Enabled = util.AsBool(o.Ipv6.Enabled, nil) + } + if o.Ipv6.InterfaceId != nil { + nestedIpv6.InterfaceId = o.Ipv6.InterfaceId + } + } + entry.Ipv6 = nestedIpv6 + + entry.LinkTag = o.LinkTag + entry.Mtu = o.Mtu + entry.NetflowProfile = o.NetflowProfile + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !matchBonjour(a.Bonjour, b.Bonjour) { + return false + } + if !util.StringsMatch(a.Comment, b.Comment) { + return false + } + if !util.BoolsMatch(a.DfIgnore, b.DfIgnore) { + return false + } + if !util.StringsMatch(a.InterfaceManagementProfile, b.InterfaceManagementProfile) { + return false + } + if !matchIp(a.Ip, b.Ip) { + return false + } + if !matchIpv6(a.Ipv6, b.Ipv6) { + return false + } + if !util.StringsMatch(a.LinkTag, b.LinkTag) { + return false + } + if !util.Ints64Match(a.Mtu, b.Mtu) { + return false + } + if !util.StringsMatch(a.NetflowProfile, b.NetflowProfile) { + return false + } + + return true +} + +func matchBonjour(a *Bonjour, b *Bonjour) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.GroupId, b.GroupId) { + return false + } + if !util.BoolsMatch(a.TtlCheck, b.TtlCheck) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + return true +} +func matchIp(a []Ip, b []Ip) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchIpv6AddressPrefix(a *Ipv6AddressPrefix, b *Ipv6AddressPrefix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchIpv6AddressAnycast(a *Ipv6AddressAnycast, b *Ipv6AddressAnycast) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchIpv6Address(a []Ipv6Address, b []Ipv6Address) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.BoolsMatch(a.EnableOnInterface, b.EnableOnInterface) { + return false + } + if !matchIpv6AddressPrefix(a.Prefix, b.Prefix) { + return false + } + if !matchIpv6AddressAnycast(a.Anycast, b.Anycast) { + return false + } + } + } + return true +} +func matchIpv6(a *Ipv6, b *Ipv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.InterfaceId, b.InterfaceId) { + return false + } + if !matchIpv6Address(a.Address, b.Address) { + return false + } + if !util.BoolsMatch(a.Enabled, b.Enabled) { + return false + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/network/interface/tunnel/interfaces.go b/network/interface/tunnel/interfaces.go new file mode 100644 index 00000000..1530310b --- /dev/null +++ b/network/interface/tunnel/interfaces.go @@ -0,0 +1,7 @@ +package tunnel + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/network/interface/tunnel/location.go b/network/interface/tunnel/location.go new file mode 100644 index 00000000..8b51737d --- /dev/null +++ b/network/interface/tunnel/location.go @@ -0,0 +1,200 @@ +package tunnel + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + Ngfw *NgfwLocation `json:"ngfw,omitempty"` + Shared bool `json:"shared"` + Template *TemplateLocation `json:"template,omitempty"` + TemplateStack *TemplateStackLocation `json:"template_stack,omitempty"` +} + +type NgfwLocation struct { + NgfwDevice string `json:"ngfw_device"` +} + +type TemplateLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + Template string `json:"template"` +} + +type TemplateStackLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + TemplateStack string `json:"template_stack"` +} + +func NewNgfwLocation() *Location { + return &Location{Ngfw: &NgfwLocation{ + NgfwDevice: "localhost.localdomain", + }, + } +} +func NewSharedLocation() *Location { + return &Location{ + Shared: true, + } +} +func NewTemplateLocation() *Location { + return &Location{Template: &TemplateLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + Template: "", + }, + } +} +func NewTemplateStackLocation() *Location { + return &Location{TemplateStack: &TemplateStackLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + TemplateStack: "", + }, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.Ngfw != nil: + if o.Ngfw.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + count++ + case o.Shared: + count++ + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return fmt.Errorf("Template is unspecified") + } + count++ + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return fmt.Errorf("TemplateStack is unspecified") + } + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.Ngfw != nil: + if o.Ngfw.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Ngfw.NgfwDevice}), + } + case o.Shared: + ans = []string{ + "config", + "shared", + } + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return nil, fmt.Errorf("Template is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Template.PanoramaDevice}), + "template", + util.AsEntryXpath([]string{o.Template.Template}), + "config", + "devices", + util.AsEntryXpath([]string{o.Template.NgfwDevice}), + } + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return nil, fmt.Errorf("TemplateStack is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.PanoramaDevice}), + "template-stack", + util.AsEntryXpath([]string{o.TemplateStack.TemplateStack}), + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.NgfwDevice}), + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/network/interface/tunnel/service.go b/network/interface/tunnel/service.go new file mode 100644 index 00000000..3e487171 --- /dev/null +++ b/network/interface/tunnel/service.go @@ -0,0 +1,281 @@ +package tunnel + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/network/interface/vlan/entry.go b/network/interface/vlan/entry.go new file mode 100644 index 00000000..18074904 --- /dev/null +++ b/network/interface/vlan/entry.go @@ -0,0 +1,3845 @@ +package vlan + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"network", "interface", "vlan", "units"} +) + +type Entry struct { + Name string + AdjustTcpMss *AdjustTcpMss + Arp []Arp + Bonjour *Bonjour + Comment *string + DdnsConfig *DdnsConfig + DfIgnore *bool + DhcpClient *DhcpClient + InterfaceManagementProfile *string + Ip []Ip + Ipv6 *Ipv6 + Mtu *int64 + NdpProxy *NdpProxy + NetflowProfile *string + + Misc map[string][]generic.Xml +} + +type AdjustTcpMss struct { + Enable *bool + Ipv4MssAdjustment *int64 + Ipv6MssAdjustment *int64 +} +type Arp struct { + HwAddress *string + Interface *string + Name string +} +type Bonjour struct { + Enable *bool + GroupId *int64 + TtlCheck *bool +} +type DdnsConfig struct { + DdnsCertProfile *string + DdnsEnabled *bool + DdnsHostname *string + DdnsIp []string + DdnsIpv6 []string + DdnsUpdateInterval *int64 + DdnsVendor *string + DdnsVendorConfig []DdnsConfigDdnsVendorConfig +} +type DdnsConfigDdnsVendorConfig struct { + Name string + Value *string +} +type DhcpClient struct { + CreateDefaultRoute *bool + DefaultRouteMetric *int64 + Enable *bool + SendHostname *DhcpClientSendHostname +} +type DhcpClientSendHostname struct { + Enable *bool + Hostname *string +} +type Ip struct { + Name string +} +type Ipv6 struct { + Address []Ipv6Address + DhcpClient *Ipv6DhcpClient + Enabled *bool + Inherited *Ipv6Inherited + InterfaceId *string + NeighborDiscovery *Ipv6NeighborDiscovery +} +type Ipv6Address struct { + Advertise *Ipv6AddressAdvertise + Anycast *Ipv6AddressAnycast + EnableOnInterface *bool + Name string + Prefix *Ipv6AddressPrefix +} +type Ipv6AddressAdvertise struct { + AutoConfigFlag *bool + Enable *bool + OnlinkFlag *bool + PreferredLifetime *string + ValidLifetime *string +} +type Ipv6AddressAnycast struct { +} +type Ipv6AddressPrefix struct { +} +type Ipv6DhcpClient struct { + AcceptRaRoute *bool + DefaultRouteMetric *int64 + Enable *bool + NeighborDiscovery *Ipv6DhcpClientNeighborDiscovery + Preference *string + PrefixDelegation *Ipv6DhcpClientPrefixDelegation + V6Options *Ipv6DhcpClientV6Options +} +type Ipv6DhcpClientNeighborDiscovery struct { + DadAttempts *int64 + DnsServer *Ipv6DhcpClientNeighborDiscoveryDnsServer + DnsSuffix *Ipv6DhcpClientNeighborDiscoveryDnsSuffix + EnableDad *bool + EnableNdpMonitor *bool + Neighbor []Ipv6DhcpClientNeighborDiscoveryNeighbor + NsInterval *int64 + ReachableTime *int64 +} +type Ipv6DhcpClientNeighborDiscoveryDnsServer struct { + Enable *bool + Source *Ipv6DhcpClientNeighborDiscoveryDnsServerSource +} +type Ipv6DhcpClientNeighborDiscoveryDnsServerSource struct { + Dhcpv6 *Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6 + Manual *Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual +} +type Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6 struct { +} +type Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual struct { + Server []Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer +} +type Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer struct { + Lifetime *int64 + Name string +} +type Ipv6DhcpClientNeighborDiscoveryDnsSuffix struct { + Enable *bool + Source *Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource +} +type Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource struct { + Dhcpv6 *Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6 + Manual *Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual +} +type Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6 struct { +} +type Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual struct { + Suffix []Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix +} +type Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix struct { + Lifetime *int64 + Name string +} +type Ipv6DhcpClientNeighborDiscoveryNeighbor struct { + HwAddress *string + Name string +} +type Ipv6DhcpClientPrefixDelegation struct { + Enable *Ipv6DhcpClientPrefixDelegationEnable +} +type Ipv6DhcpClientPrefixDelegationEnable struct { + No *Ipv6DhcpClientPrefixDelegationEnableNo + Yes *Ipv6DhcpClientPrefixDelegationEnableYes +} +type Ipv6DhcpClientPrefixDelegationEnableNo struct { +} +type Ipv6DhcpClientPrefixDelegationEnableYes struct { + PfxPoolName *string + PrefixLen *int64 + PrefixLenHint *bool +} +type Ipv6DhcpClientV6Options struct { + DuidType *string + Enable *Ipv6DhcpClientV6OptionsEnable + RapidCommit *bool + SupportSrvrReconfig *bool +} +type Ipv6DhcpClientV6OptionsEnable struct { + No *Ipv6DhcpClientV6OptionsEnableNo + Yes *Ipv6DhcpClientV6OptionsEnableYes +} +type Ipv6DhcpClientV6OptionsEnableNo struct { +} +type Ipv6DhcpClientV6OptionsEnableYes struct { + NonTempAddr *bool + TempAddr *bool +} +type Ipv6Inherited struct { + AssignAddr []Ipv6InheritedAssignAddr + Enable *bool + NeighborDiscovery *Ipv6InheritedNeighborDiscovery +} +type Ipv6InheritedAssignAddr struct { + Name string + Type *Ipv6InheritedAssignAddrType +} +type Ipv6InheritedAssignAddrType struct { + Gua *Ipv6InheritedAssignAddrTypeGua + Ula *Ipv6InheritedAssignAddrTypeUla +} +type Ipv6InheritedAssignAddrTypeGua struct { + Advertise *Ipv6InheritedAssignAddrTypeGuaAdvertise + EnableOnInterface *bool + PoolType *Ipv6InheritedAssignAddrTypeGuaPoolType + PrefixPool *string +} +type Ipv6InheritedAssignAddrTypeGuaAdvertise struct { + AutoConfigFlag *bool + Enable *bool + OnlinkFlag *bool +} +type Ipv6InheritedAssignAddrTypeGuaPoolType struct { + Dynamic *Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic + DynamicId *Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId +} +type Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic struct { +} +type Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId struct { + Identifier *int64 +} +type Ipv6InheritedAssignAddrTypeUla struct { + Address *string + Advertise *Ipv6InheritedAssignAddrTypeUlaAdvertise + Anycast *bool + EnableOnInterface *bool + Prefix *bool +} +type Ipv6InheritedAssignAddrTypeUlaAdvertise struct { + AutoConfigFlag *bool + Enable *bool + OnlinkFlag *bool + PreferredLifetime *string + ValidLifetime *string +} +type Ipv6InheritedNeighborDiscovery struct { + DadAttempts *int64 + DnsServer *Ipv6InheritedNeighborDiscoveryDnsServer + DnsSuffix *Ipv6InheritedNeighborDiscoveryDnsSuffix + EnableDad *bool + EnableNdpMonitor *bool + Neighbor []Ipv6InheritedNeighborDiscoveryNeighbor + NsInterval *int64 + ReachableTime *int64 + RouterAdvertisement *Ipv6InheritedNeighborDiscoveryRouterAdvertisement +} +type Ipv6InheritedNeighborDiscoveryDnsServer struct { + Enable *bool + Source *Ipv6InheritedNeighborDiscoveryDnsServerSource +} +type Ipv6InheritedNeighborDiscoveryDnsServerSource struct { + Dhcpv6 *Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6 + Manual *Ipv6InheritedNeighborDiscoveryDnsServerSourceManual +} +type Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6 struct { + PrefixPool *string +} +type Ipv6InheritedNeighborDiscoveryDnsServerSourceManual struct { + Server []Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer +} +type Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer struct { + Lifetime *int64 + Name string +} +type Ipv6InheritedNeighborDiscoveryDnsSuffix struct { + Enable *bool + Source *Ipv6InheritedNeighborDiscoveryDnsSuffixSource +} +type Ipv6InheritedNeighborDiscoveryDnsSuffixSource struct { + Dhcpv6 *Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6 + Manual *Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual +} +type Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6 struct { + PrefixPool *string +} +type Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual struct { + Suffix []Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix +} +type Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix struct { + Lifetime *int64 + Name string +} +type Ipv6InheritedNeighborDiscoveryNeighbor struct { + HwAddress *string + Name string +} +type Ipv6InheritedNeighborDiscoveryRouterAdvertisement struct { + Enable *bool + EnableConsistencyCheck *bool + HopLimit *string + Lifetime *int64 + LinkMtu *string + ManagedFlag *bool + MaxInterval *int64 + MinInterval *int64 + OtherFlag *bool + ReachableTime *string + RetransmissionTimer *string + RouterPreference *string +} +type Ipv6NeighborDiscovery struct { + DadAttempts *int64 + EnableDad *bool + EnableNdpMonitor *bool + Neighbor []Ipv6NeighborDiscoveryNeighbor + NsInterval *int64 + ReachableTime *int64 + RouterAdvertisement *Ipv6NeighborDiscoveryRouterAdvertisement +} +type Ipv6NeighborDiscoveryNeighbor struct { + HwAddress *string + Name string +} +type Ipv6NeighborDiscoveryRouterAdvertisement struct { + DnsSupport *Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport + Enable *bool + EnableConsistencyCheck *bool + HopLimit *string + Lifetime *int64 + LinkMtu *string + ManagedFlag *bool + MaxInterval *int64 + MinInterval *int64 + OtherFlag *bool + ReachableTime *string + RetransmissionTimer *string + RouterPreference *string +} +type Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport struct { + Enable *bool + Server []Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer + Suffix []Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix +} +type Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer struct { + Lifetime *int64 + Name string +} +type Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix struct { + Lifetime *int64 + Name string +} +type NdpProxy struct { + Address []NdpProxyAddress + Enabled *bool +} +type NdpProxyAddress struct { + Name string + Negate *bool +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + AdjustTcpMss *AdjustTcpMssXml `xml:"adjust-tcp-mss,omitempty"` + Arp []ArpXml `xml:"arp>entry,omitempty"` + Bonjour *BonjourXml `xml:"bonjour,omitempty"` + Comment *string `xml:"comment,omitempty"` + DdnsConfig *DdnsConfigXml `xml:"ddns-config,omitempty"` + DfIgnore *string `xml:"df-ignore,omitempty"` + DhcpClient *DhcpClientXml `xml:"dhcp-client,omitempty"` + InterfaceManagementProfile *string `xml:"interface-management-profile,omitempty"` + Ip []IpXml `xml:"ip>entry,omitempty"` + Ipv6 *Ipv6Xml `xml:"ipv6,omitempty"` + Mtu *int64 `xml:"mtu,omitempty"` + NdpProxy *NdpProxyXml `xml:"ndp-proxy,omitempty"` + NetflowProfile *string `xml:"netflow-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AdjustTcpMssXml struct { + Enable *string `xml:"enable,omitempty"` + Ipv4MssAdjustment *int64 `xml:"ipv4-mss-adjustment,omitempty"` + Ipv6MssAdjustment *int64 `xml:"ipv6-mss-adjustment,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ArpXml struct { + HwAddress *string `xml:"hw-address,omitempty"` + Interface *string `xml:"interface,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type BonjourXml struct { + Enable *string `xml:"enable,omitempty"` + GroupId *int64 `xml:"group-id,omitempty"` + TtlCheck *string `xml:"ttl-check,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type DdnsConfigXml struct { + DdnsCertProfile *string `xml:"ddns-cert-profile,omitempty"` + DdnsEnabled *string `xml:"ddns-enabled,omitempty"` + DdnsHostname *string `xml:"ddns-hostname,omitempty"` + DdnsIp *util.MemberType `xml:"ddns-ip,omitempty"` + DdnsIpv6 *util.MemberType `xml:"ddns-ipv6,omitempty"` + DdnsUpdateInterval *int64 `xml:"ddns-update-interval,omitempty"` + DdnsVendor *string `xml:"ddns-vendor,omitempty"` + DdnsVendorConfig []DdnsConfigDdnsVendorConfigXml `xml:"ddns-vendor-config>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type DdnsConfigDdnsVendorConfigXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Value *string `xml:"value,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type DhcpClientXml struct { + CreateDefaultRoute *string `xml:"create-default-route,omitempty"` + DefaultRouteMetric *int64 `xml:"default-route-metric,omitempty"` + Enable *string `xml:"enable,omitempty"` + SendHostname *DhcpClientSendHostnameXml `xml:"send-hostname,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type DhcpClientSendHostnameXml struct { + Enable *string `xml:"enable,omitempty"` + Hostname *string `xml:"hostname,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type IpXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6Xml struct { + Address []Ipv6AddressXml `xml:"address>entry,omitempty"` + DhcpClient *Ipv6DhcpClientXml `xml:"dhcp-client,omitempty"` + Enabled *string `xml:"enabled,omitempty"` + Inherited *Ipv6InheritedXml `xml:"inherited,omitempty"` + InterfaceId *string `xml:"interface-id,omitempty"` + NeighborDiscovery *Ipv6NeighborDiscoveryXml `xml:"neighbor-discovery,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6AddressXml struct { + Advertise *Ipv6AddressAdvertiseXml `xml:"advertise,omitempty"` + Anycast *Ipv6AddressAnycastXml `xml:"anycast,omitempty"` + EnableOnInterface *string `xml:"enable-on-interface,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Prefix *Ipv6AddressPrefixXml `xml:"prefix,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6AddressAdvertiseXml struct { + AutoConfigFlag *string `xml:"auto-config-flag,omitempty"` + Enable *string `xml:"enable,omitempty"` + OnlinkFlag *string `xml:"onlink-flag,omitempty"` + PreferredLifetime *string `xml:"preferred-lifetime,omitempty"` + ValidLifetime *string `xml:"valid-lifetime,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6AddressAnycastXml struct { + Misc []generic.Xml `xml:",any"` +} +type Ipv6AddressPrefixXml struct { + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientXml struct { + AcceptRaRoute *string `xml:"accept-ra-route,omitempty"` + DefaultRouteMetric *int64 `xml:"default-route-metric,omitempty"` + Enable *string `xml:"enable,omitempty"` + NeighborDiscovery *Ipv6DhcpClientNeighborDiscoveryXml `xml:"neighbor-discovery,omitempty"` + Preference *string `xml:"preference,omitempty"` + PrefixDelegation *Ipv6DhcpClientPrefixDelegationXml `xml:"prefix-delegation,omitempty"` + V6Options *Ipv6DhcpClientV6OptionsXml `xml:"v6-options,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientNeighborDiscoveryXml struct { + DadAttempts *int64 `xml:"dad-attempts,omitempty"` + DnsServer *Ipv6DhcpClientNeighborDiscoveryDnsServerXml `xml:"dns-server,omitempty"` + DnsSuffix *Ipv6DhcpClientNeighborDiscoveryDnsSuffixXml `xml:"dns-suffix,omitempty"` + EnableDad *string `xml:"enable-dad,omitempty"` + EnableNdpMonitor *string `xml:"enable-ndp-monitor,omitempty"` + Neighbor []Ipv6DhcpClientNeighborDiscoveryNeighborXml `xml:"neighbor>entry,omitempty"` + NsInterval *int64 `xml:"ns-interval,omitempty"` + ReachableTime *int64 `xml:"reachable-time,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientNeighborDiscoveryDnsServerXml struct { + Enable *string `xml:"enable,omitempty"` + Source *Ipv6DhcpClientNeighborDiscoveryDnsServerSourceXml `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientNeighborDiscoveryDnsServerSourceXml struct { + Dhcpv6 *Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6Xml `xml:"dhcpv6,omitempty"` + Manual *Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualXml `xml:"manual,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6Xml struct { + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualXml struct { + Server []Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml `xml:"server>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientNeighborDiscoveryDnsSuffixXml struct { + Enable *string `xml:"enable,omitempty"` + Source *Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceXml `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceXml struct { + Dhcpv6 *Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6Xml `xml:"dhcpv6,omitempty"` + Manual *Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualXml `xml:"manual,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6Xml struct { + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualXml struct { + Suffix []Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml `xml:"suffix>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientNeighborDiscoveryNeighborXml struct { + HwAddress *string `xml:"hw-address,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientPrefixDelegationXml struct { + Enable *Ipv6DhcpClientPrefixDelegationEnableXml `xml:"enable,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientPrefixDelegationEnableXml struct { + No *Ipv6DhcpClientPrefixDelegationEnableNoXml `xml:"no,omitempty"` + Yes *Ipv6DhcpClientPrefixDelegationEnableYesXml `xml:"yes,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientPrefixDelegationEnableNoXml struct { + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientPrefixDelegationEnableYesXml struct { + PfxPoolName *string `xml:"pfx-pool-name,omitempty"` + PrefixLen *int64 `xml:"prefix-len,omitempty"` + PrefixLenHint *string `xml:"prefix-len-hint,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientV6OptionsXml struct { + DuidType *string `xml:"duid-type,omitempty"` + Enable *Ipv6DhcpClientV6OptionsEnableXml `xml:"enable,omitempty"` + RapidCommit *string `xml:"rapid-commit,omitempty"` + SupportSrvrReconfig *string `xml:"support-srvr-reconfig,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientV6OptionsEnableXml struct { + No *Ipv6DhcpClientV6OptionsEnableNoXml `xml:"no,omitempty"` + Yes *Ipv6DhcpClientV6OptionsEnableYesXml `xml:"yes,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientV6OptionsEnableNoXml struct { + Misc []generic.Xml `xml:",any"` +} +type Ipv6DhcpClientV6OptionsEnableYesXml struct { + NonTempAddr *string `xml:"non-temp-addr,omitempty"` + TempAddr *string `xml:"temp-addr,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedXml struct { + AssignAddr []Ipv6InheritedAssignAddrXml `xml:"assign-addr>entry,omitempty"` + Enable *string `xml:"enable,omitempty"` + NeighborDiscovery *Ipv6InheritedNeighborDiscoveryXml `xml:"neighbor-discovery,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedAssignAddrXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Type *Ipv6InheritedAssignAddrTypeXml `xml:"type,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedAssignAddrTypeXml struct { + Gua *Ipv6InheritedAssignAddrTypeGuaXml `xml:"gua,omitempty"` + Ula *Ipv6InheritedAssignAddrTypeUlaXml `xml:"ula,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedAssignAddrTypeGuaXml struct { + Advertise *Ipv6InheritedAssignAddrTypeGuaAdvertiseXml `xml:"advertise,omitempty"` + EnableOnInterface *string `xml:"enable-on-interface,omitempty"` + PoolType *Ipv6InheritedAssignAddrTypeGuaPoolTypeXml `xml:"pool-type,omitempty"` + PrefixPool *string `xml:"prefix-pool,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedAssignAddrTypeGuaAdvertiseXml struct { + AutoConfigFlag *string `xml:"auto-config-flag,omitempty"` + Enable *string `xml:"enable,omitempty"` + OnlinkFlag *string `xml:"onlink-flag,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedAssignAddrTypeGuaPoolTypeXml struct { + Dynamic *Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicXml `xml:"dynamic,omitempty"` + DynamicId *Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicIdXml `xml:"dynamic-id,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicXml struct { + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicIdXml struct { + Identifier *int64 `xml:"identifier,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedAssignAddrTypeUlaXml struct { + Address *string `xml:"address,omitempty"` + Advertise *Ipv6InheritedAssignAddrTypeUlaAdvertiseXml `xml:"advertise,omitempty"` + Anycast *string `xml:"anycast,omitempty"` + EnableOnInterface *string `xml:"enable-on-interface,omitempty"` + Prefix *string `xml:"prefix,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedAssignAddrTypeUlaAdvertiseXml struct { + AutoConfigFlag *string `xml:"auto-config-flag,omitempty"` + Enable *string `xml:"enable,omitempty"` + OnlinkFlag *string `xml:"onlink-flag,omitempty"` + PreferredLifetime *string `xml:"preferred-lifetime,omitempty"` + ValidLifetime *string `xml:"valid-lifetime,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedNeighborDiscoveryXml struct { + DadAttempts *int64 `xml:"dad-attempts,omitempty"` + DnsServer *Ipv6InheritedNeighborDiscoveryDnsServerXml `xml:"dns-server,omitempty"` + DnsSuffix *Ipv6InheritedNeighborDiscoveryDnsSuffixXml `xml:"dns-suffix,omitempty"` + EnableDad *string `xml:"enable-dad,omitempty"` + EnableNdpMonitor *string `xml:"enable-ndp-monitor,omitempty"` + Neighbor []Ipv6InheritedNeighborDiscoveryNeighborXml `xml:"neighbor>entry,omitempty"` + NsInterval *int64 `xml:"ns-interval,omitempty"` + ReachableTime *int64 `xml:"reachable-time,omitempty"` + RouterAdvertisement *Ipv6InheritedNeighborDiscoveryRouterAdvertisementXml `xml:"router-advertisement,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedNeighborDiscoveryDnsServerXml struct { + Enable *string `xml:"enable,omitempty"` + Source *Ipv6InheritedNeighborDiscoveryDnsServerSourceXml `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedNeighborDiscoveryDnsServerSourceXml struct { + Dhcpv6 *Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6Xml `xml:"dhcpv6,omitempty"` + Manual *Ipv6InheritedNeighborDiscoveryDnsServerSourceManualXml `xml:"manual,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6Xml struct { + PrefixPool *string `xml:"prefix-pool,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedNeighborDiscoveryDnsServerSourceManualXml struct { + Server []Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml `xml:"server>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedNeighborDiscoveryDnsSuffixXml struct { + Enable *string `xml:"enable,omitempty"` + Source *Ipv6InheritedNeighborDiscoveryDnsSuffixSourceXml `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedNeighborDiscoveryDnsSuffixSourceXml struct { + Dhcpv6 *Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6Xml `xml:"dhcpv6,omitempty"` + Manual *Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualXml `xml:"manual,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6Xml struct { + PrefixPool *string `xml:"prefix-pool,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualXml struct { + Suffix []Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml `xml:"suffix>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedNeighborDiscoveryNeighborXml struct { + HwAddress *string `xml:"hw-address,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6InheritedNeighborDiscoveryRouterAdvertisementXml struct { + Enable *string `xml:"enable,omitempty"` + EnableConsistencyCheck *string `xml:"enable-consistency-check,omitempty"` + HopLimit *string `xml:"hop-limit,omitempty"` + Lifetime *int64 `xml:"lifetime,omitempty"` + LinkMtu *string `xml:"link-mtu,omitempty"` + ManagedFlag *string `xml:"managed-flag,omitempty"` + MaxInterval *int64 `xml:"max-interval,omitempty"` + MinInterval *int64 `xml:"min-interval,omitempty"` + OtherFlag *string `xml:"other-flag,omitempty"` + ReachableTime *string `xml:"reachable-time,omitempty"` + RetransmissionTimer *string `xml:"retransmission-timer,omitempty"` + RouterPreference *string `xml:"router-preference,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6NeighborDiscoveryXml struct { + DadAttempts *int64 `xml:"dad-attempts,omitempty"` + EnableDad *string `xml:"enable-dad,omitempty"` + EnableNdpMonitor *string `xml:"enable-ndp-monitor,omitempty"` + Neighbor []Ipv6NeighborDiscoveryNeighborXml `xml:"neighbor>entry,omitempty"` + NsInterval *int64 `xml:"ns-interval,omitempty"` + ReachableTime *int64 `xml:"reachable-time,omitempty"` + RouterAdvertisement *Ipv6NeighborDiscoveryRouterAdvertisementXml `xml:"router-advertisement,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6NeighborDiscoveryNeighborXml struct { + HwAddress *string `xml:"hw-address,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6NeighborDiscoveryRouterAdvertisementXml struct { + DnsSupport *Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportXml `xml:"dns-support,omitempty"` + Enable *string `xml:"enable,omitempty"` + EnableConsistencyCheck *string `xml:"enable-consistency-check,omitempty"` + HopLimit *string `xml:"hop-limit,omitempty"` + Lifetime *int64 `xml:"lifetime,omitempty"` + LinkMtu *string `xml:"link-mtu,omitempty"` + ManagedFlag *string `xml:"managed-flag,omitempty"` + MaxInterval *int64 `xml:"max-interval,omitempty"` + MinInterval *int64 `xml:"min-interval,omitempty"` + OtherFlag *string `xml:"other-flag,omitempty"` + ReachableTime *string `xml:"reachable-time,omitempty"` + RetransmissionTimer *string `xml:"retransmission-timer,omitempty"` + RouterPreference *string `xml:"router-preference,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportXml struct { + Enable *string `xml:"enable,omitempty"` + Server []Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml `xml:"server>entry,omitempty"` + Suffix []Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml `xml:"suffix>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml struct { + Lifetime *int64 `xml:"lifetime,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type NdpProxyXml struct { + Address []NdpProxyAddressXml `xml:"address>entry,omitempty"` + Enabled *string `xml:"enabled,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type NdpProxyAddressXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Negate *string `xml:"negate,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "adjust_tcp_mss" || v == "AdjustTcpMss" { + return e.AdjustTcpMss, nil + } + if v == "arp" || v == "Arp" { + return e.Arp, nil + } + if v == "arp|LENGTH" || v == "Arp|LENGTH" { + return int64(len(e.Arp)), nil + } + if v == "bonjour" || v == "Bonjour" { + return e.Bonjour, nil + } + if v == "comment" || v == "Comment" { + return e.Comment, nil + } + if v == "ddns_config" || v == "DdnsConfig" { + return e.DdnsConfig, nil + } + if v == "df_ignore" || v == "DfIgnore" { + return e.DfIgnore, nil + } + if v == "dhcp_client" || v == "DhcpClient" { + return e.DhcpClient, nil + } + if v == "interface_management_profile" || v == "InterfaceManagementProfile" { + return e.InterfaceManagementProfile, nil + } + if v == "ip" || v == "Ip" { + return e.Ip, nil + } + if v == "ip|LENGTH" || v == "Ip|LENGTH" { + return int64(len(e.Ip)), nil + } + if v == "ipv6" || v == "Ipv6" { + return e.Ipv6, nil + } + if v == "mtu" || v == "Mtu" { + return e.Mtu, nil + } + if v == "ndp_proxy" || v == "NdpProxy" { + return e.NdpProxy, nil + } + if v == "netflow_profile" || v == "NetflowProfile" { + return e.NetflowProfile, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + var nestedAdjustTcpMss *AdjustTcpMssXml + if o.AdjustTcpMss != nil { + nestedAdjustTcpMss = &AdjustTcpMssXml{} + if _, ok := o.Misc["AdjustTcpMss"]; ok { + nestedAdjustTcpMss.Misc = o.Misc["AdjustTcpMss"] + } + if o.AdjustTcpMss.Enable != nil { + nestedAdjustTcpMss.Enable = util.YesNo(o.AdjustTcpMss.Enable, nil) + } + if o.AdjustTcpMss.Ipv4MssAdjustment != nil { + nestedAdjustTcpMss.Ipv4MssAdjustment = o.AdjustTcpMss.Ipv4MssAdjustment + } + if o.AdjustTcpMss.Ipv6MssAdjustment != nil { + nestedAdjustTcpMss.Ipv6MssAdjustment = o.AdjustTcpMss.Ipv6MssAdjustment + } + } + entry.AdjustTcpMss = nestedAdjustTcpMss + + var nestedArpCol []ArpXml + if o.Arp != nil { + nestedArpCol = []ArpXml{} + for _, oArp := range o.Arp { + nestedArp := ArpXml{} + if _, ok := o.Misc["Arp"]; ok { + nestedArp.Misc = o.Misc["Arp"] + } + if oArp.HwAddress != nil { + nestedArp.HwAddress = oArp.HwAddress + } + if oArp.Interface != nil { + nestedArp.Interface = oArp.Interface + } + if oArp.Name != "" { + nestedArp.Name = oArp.Name + } + nestedArpCol = append(nestedArpCol, nestedArp) + } + entry.Arp = nestedArpCol + } + + var nestedBonjour *BonjourXml + if o.Bonjour != nil { + nestedBonjour = &BonjourXml{} + if _, ok := o.Misc["Bonjour"]; ok { + nestedBonjour.Misc = o.Misc["Bonjour"] + } + if o.Bonjour.Enable != nil { + nestedBonjour.Enable = util.YesNo(o.Bonjour.Enable, nil) + } + if o.Bonjour.GroupId != nil { + nestedBonjour.GroupId = o.Bonjour.GroupId + } + if o.Bonjour.TtlCheck != nil { + nestedBonjour.TtlCheck = util.YesNo(o.Bonjour.TtlCheck, nil) + } + } + entry.Bonjour = nestedBonjour + + entry.Comment = o.Comment + var nestedDdnsConfig *DdnsConfigXml + if o.DdnsConfig != nil { + nestedDdnsConfig = &DdnsConfigXml{} + if _, ok := o.Misc["DdnsConfig"]; ok { + nestedDdnsConfig.Misc = o.Misc["DdnsConfig"] + } + if o.DdnsConfig.DdnsHostname != nil { + nestedDdnsConfig.DdnsHostname = o.DdnsConfig.DdnsHostname + } + if o.DdnsConfig.DdnsIp != nil { + nestedDdnsConfig.DdnsIp = util.StrToMem(o.DdnsConfig.DdnsIp) + } + if o.DdnsConfig.DdnsIpv6 != nil { + nestedDdnsConfig.DdnsIpv6 = util.StrToMem(o.DdnsConfig.DdnsIpv6) + } + if o.DdnsConfig.DdnsUpdateInterval != nil { + nestedDdnsConfig.DdnsUpdateInterval = o.DdnsConfig.DdnsUpdateInterval + } + if o.DdnsConfig.DdnsVendor != nil { + nestedDdnsConfig.DdnsVendor = o.DdnsConfig.DdnsVendor + } + if o.DdnsConfig.DdnsVendorConfig != nil { + nestedDdnsConfig.DdnsVendorConfig = []DdnsConfigDdnsVendorConfigXml{} + for _, oDdnsConfigDdnsVendorConfig := range o.DdnsConfig.DdnsVendorConfig { + nestedDdnsConfigDdnsVendorConfig := DdnsConfigDdnsVendorConfigXml{} + if _, ok := o.Misc["DdnsConfigDdnsVendorConfig"]; ok { + nestedDdnsConfigDdnsVendorConfig.Misc = o.Misc["DdnsConfigDdnsVendorConfig"] + } + if oDdnsConfigDdnsVendorConfig.Name != "" { + nestedDdnsConfigDdnsVendorConfig.Name = oDdnsConfigDdnsVendorConfig.Name + } + if oDdnsConfigDdnsVendorConfig.Value != nil { + nestedDdnsConfigDdnsVendorConfig.Value = oDdnsConfigDdnsVendorConfig.Value + } + nestedDdnsConfig.DdnsVendorConfig = append(nestedDdnsConfig.DdnsVendorConfig, nestedDdnsConfigDdnsVendorConfig) + } + } + if o.DdnsConfig.DdnsCertProfile != nil { + nestedDdnsConfig.DdnsCertProfile = o.DdnsConfig.DdnsCertProfile + } + if o.DdnsConfig.DdnsEnabled != nil { + nestedDdnsConfig.DdnsEnabled = util.YesNo(o.DdnsConfig.DdnsEnabled, nil) + } + } + entry.DdnsConfig = nestedDdnsConfig + + entry.DfIgnore = util.YesNo(o.DfIgnore, nil) + var nestedDhcpClient *DhcpClientXml + if o.DhcpClient != nil { + nestedDhcpClient = &DhcpClientXml{} + if _, ok := o.Misc["DhcpClient"]; ok { + nestedDhcpClient.Misc = o.Misc["DhcpClient"] + } + if o.DhcpClient.Enable != nil { + nestedDhcpClient.Enable = util.YesNo(o.DhcpClient.Enable, nil) + } + if o.DhcpClient.SendHostname != nil { + nestedDhcpClient.SendHostname = &DhcpClientSendHostnameXml{} + if _, ok := o.Misc["DhcpClientSendHostname"]; ok { + nestedDhcpClient.SendHostname.Misc = o.Misc["DhcpClientSendHostname"] + } + if o.DhcpClient.SendHostname.Hostname != nil { + nestedDhcpClient.SendHostname.Hostname = o.DhcpClient.SendHostname.Hostname + } + if o.DhcpClient.SendHostname.Enable != nil { + nestedDhcpClient.SendHostname.Enable = util.YesNo(o.DhcpClient.SendHostname.Enable, nil) + } + } + if o.DhcpClient.CreateDefaultRoute != nil { + nestedDhcpClient.CreateDefaultRoute = util.YesNo(o.DhcpClient.CreateDefaultRoute, nil) + } + if o.DhcpClient.DefaultRouteMetric != nil { + nestedDhcpClient.DefaultRouteMetric = o.DhcpClient.DefaultRouteMetric + } + } + entry.DhcpClient = nestedDhcpClient + + entry.InterfaceManagementProfile = o.InterfaceManagementProfile + var nestedIpCol []IpXml + if o.Ip != nil { + nestedIpCol = []IpXml{} + for _, oIp := range o.Ip { + nestedIp := IpXml{} + if _, ok := o.Misc["Ip"]; ok { + nestedIp.Misc = o.Misc["Ip"] + } + if oIp.Name != "" { + nestedIp.Name = oIp.Name + } + nestedIpCol = append(nestedIpCol, nestedIp) + } + entry.Ip = nestedIpCol + } + + var nestedIpv6 *Ipv6Xml + if o.Ipv6 != nil { + nestedIpv6 = &Ipv6Xml{} + if _, ok := o.Misc["Ipv6"]; ok { + nestedIpv6.Misc = o.Misc["Ipv6"] + } + if o.Ipv6.DhcpClient != nil { + nestedIpv6.DhcpClient = &Ipv6DhcpClientXml{} + if _, ok := o.Misc["Ipv6DhcpClient"]; ok { + nestedIpv6.DhcpClient.Misc = o.Misc["Ipv6DhcpClient"] + } + if o.Ipv6.DhcpClient.AcceptRaRoute != nil { + nestedIpv6.DhcpClient.AcceptRaRoute = util.YesNo(o.Ipv6.DhcpClient.AcceptRaRoute, nil) + } + if o.Ipv6.DhcpClient.DefaultRouteMetric != nil { + nestedIpv6.DhcpClient.DefaultRouteMetric = o.Ipv6.DhcpClient.DefaultRouteMetric + } + if o.Ipv6.DhcpClient.Enable != nil { + nestedIpv6.DhcpClient.Enable = util.YesNo(o.Ipv6.DhcpClient.Enable, nil) + } + if o.Ipv6.DhcpClient.NeighborDiscovery != nil { + nestedIpv6.DhcpClient.NeighborDiscovery = &Ipv6DhcpClientNeighborDiscoveryXml{} + if _, ok := o.Misc["Ipv6DhcpClientNeighborDiscovery"]; ok { + nestedIpv6.DhcpClient.NeighborDiscovery.Misc = o.Misc["Ipv6DhcpClientNeighborDiscovery"] + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix = &Ipv6DhcpClientNeighborDiscoveryDnsSuffixXml{} + if _, ok := o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsSuffix"]; ok { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Misc = o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsSuffix"] + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable = util.YesNo(o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable, nil) + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source = &Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceXml{} + if _, ok := o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource"]; ok { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Misc = o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource"] + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6Xml{} + if _, ok := o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6"]; ok { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc = o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6"] + } + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual = &Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualXml{} + if _, ok := o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual"]; ok { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Misc = o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual"] + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml{} + for _, oIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffixXml{} + if _, ok := o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix"]; ok { + nestedIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc = o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix"] + } + if oIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + if oIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + } + if o.Ipv6.DhcpClient.NeighborDiscovery.EnableDad != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.EnableDad = util.YesNo(o.Ipv6.DhcpClient.NeighborDiscovery.EnableDad, nil) + } + if o.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor = util.YesNo(o.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Ipv6.DhcpClient.NeighborDiscovery.Neighbor != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.Neighbor = []Ipv6DhcpClientNeighborDiscoveryNeighborXml{} + for _, oIpv6DhcpClientNeighborDiscoveryNeighbor := range o.Ipv6.DhcpClient.NeighborDiscovery.Neighbor { + nestedIpv6DhcpClientNeighborDiscoveryNeighbor := Ipv6DhcpClientNeighborDiscoveryNeighborXml{} + if _, ok := o.Misc["Ipv6DhcpClientNeighborDiscoveryNeighbor"]; ok { + nestedIpv6DhcpClientNeighborDiscoveryNeighbor.Misc = o.Misc["Ipv6DhcpClientNeighborDiscoveryNeighbor"] + } + if oIpv6DhcpClientNeighborDiscoveryNeighbor.HwAddress != nil { + nestedIpv6DhcpClientNeighborDiscoveryNeighbor.HwAddress = oIpv6DhcpClientNeighborDiscoveryNeighbor.HwAddress + } + if oIpv6DhcpClientNeighborDiscoveryNeighbor.Name != "" { + nestedIpv6DhcpClientNeighborDiscoveryNeighbor.Name = oIpv6DhcpClientNeighborDiscoveryNeighbor.Name + } + nestedIpv6.DhcpClient.NeighborDiscovery.Neighbor = append(nestedIpv6.DhcpClient.NeighborDiscovery.Neighbor, nestedIpv6DhcpClientNeighborDiscoveryNeighbor) + } + } + if o.Ipv6.DhcpClient.NeighborDiscovery.NsInterval != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.NsInterval = o.Ipv6.DhcpClient.NeighborDiscovery.NsInterval + } + if o.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.ReachableTime = o.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DadAttempts = o.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer = &Ipv6DhcpClientNeighborDiscoveryDnsServerXml{} + if _, ok := o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsServer"]; ok { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Misc = o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsServer"] + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Enable = util.YesNo(o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable, nil) + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Source = &Ipv6DhcpClientNeighborDiscoveryDnsServerSourceXml{} + if _, ok := o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsServerSource"]; ok { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Misc = o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsServerSource"] + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6Xml{} + if _, ok := o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6"]; ok { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc = o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6"] + } + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual = &Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualXml{} + if _, ok := o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual"]; ok { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Misc = o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual"] + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = []Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml{} + for _, oIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := range o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServerXml{} + if _, ok := o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer"]; ok { + nestedIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Misc = o.Misc["Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer"] + } + if oIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + if oIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name = oIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name + } + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + } + } + } + if o.Ipv6.DhcpClient.Preference != nil { + nestedIpv6.DhcpClient.Preference = o.Ipv6.DhcpClient.Preference + } + if o.Ipv6.DhcpClient.PrefixDelegation != nil { + nestedIpv6.DhcpClient.PrefixDelegation = &Ipv6DhcpClientPrefixDelegationXml{} + if _, ok := o.Misc["Ipv6DhcpClientPrefixDelegation"]; ok { + nestedIpv6.DhcpClient.PrefixDelegation.Misc = o.Misc["Ipv6DhcpClientPrefixDelegation"] + } + if o.Ipv6.DhcpClient.PrefixDelegation.Enable != nil { + nestedIpv6.DhcpClient.PrefixDelegation.Enable = &Ipv6DhcpClientPrefixDelegationEnableXml{} + if _, ok := o.Misc["Ipv6DhcpClientPrefixDelegationEnable"]; ok { + nestedIpv6.DhcpClient.PrefixDelegation.Enable.Misc = o.Misc["Ipv6DhcpClientPrefixDelegationEnable"] + } + if o.Ipv6.DhcpClient.PrefixDelegation.Enable.No != nil { + nestedIpv6.DhcpClient.PrefixDelegation.Enable.No = &Ipv6DhcpClientPrefixDelegationEnableNoXml{} + if _, ok := o.Misc["Ipv6DhcpClientPrefixDelegationEnableNo"]; ok { + nestedIpv6.DhcpClient.PrefixDelegation.Enable.No.Misc = o.Misc["Ipv6DhcpClientPrefixDelegationEnableNo"] + } + } + if o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes != nil { + nestedIpv6.DhcpClient.PrefixDelegation.Enable.Yes = &Ipv6DhcpClientPrefixDelegationEnableYesXml{} + if _, ok := o.Misc["Ipv6DhcpClientPrefixDelegationEnableYes"]; ok { + nestedIpv6.DhcpClient.PrefixDelegation.Enable.Yes.Misc = o.Misc["Ipv6DhcpClientPrefixDelegationEnableYes"] + } + if o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName != nil { + nestedIpv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName = o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName + } + if o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen != nil { + nestedIpv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen = o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen + } + if o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint != nil { + nestedIpv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint = util.YesNo(o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint, nil) + } + } + } + } + if o.Ipv6.DhcpClient.V6Options != nil { + nestedIpv6.DhcpClient.V6Options = &Ipv6DhcpClientV6OptionsXml{} + if _, ok := o.Misc["Ipv6DhcpClientV6Options"]; ok { + nestedIpv6.DhcpClient.V6Options.Misc = o.Misc["Ipv6DhcpClientV6Options"] + } + if o.Ipv6.DhcpClient.V6Options.RapidCommit != nil { + nestedIpv6.DhcpClient.V6Options.RapidCommit = util.YesNo(o.Ipv6.DhcpClient.V6Options.RapidCommit, nil) + } + if o.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig != nil { + nestedIpv6.DhcpClient.V6Options.SupportSrvrReconfig = util.YesNo(o.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig, nil) + } + if o.Ipv6.DhcpClient.V6Options.DuidType != nil { + nestedIpv6.DhcpClient.V6Options.DuidType = o.Ipv6.DhcpClient.V6Options.DuidType + } + if o.Ipv6.DhcpClient.V6Options.Enable != nil { + nestedIpv6.DhcpClient.V6Options.Enable = &Ipv6DhcpClientV6OptionsEnableXml{} + if _, ok := o.Misc["Ipv6DhcpClientV6OptionsEnable"]; ok { + nestedIpv6.DhcpClient.V6Options.Enable.Misc = o.Misc["Ipv6DhcpClientV6OptionsEnable"] + } + if o.Ipv6.DhcpClient.V6Options.Enable.Yes != nil { + nestedIpv6.DhcpClient.V6Options.Enable.Yes = &Ipv6DhcpClientV6OptionsEnableYesXml{} + if _, ok := o.Misc["Ipv6DhcpClientV6OptionsEnableYes"]; ok { + nestedIpv6.DhcpClient.V6Options.Enable.Yes.Misc = o.Misc["Ipv6DhcpClientV6OptionsEnableYes"] + } + if o.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr != nil { + nestedIpv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr = util.YesNo(o.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr, nil) + } + if o.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr != nil { + nestedIpv6.DhcpClient.V6Options.Enable.Yes.TempAddr = util.YesNo(o.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr, nil) + } + } + if o.Ipv6.DhcpClient.V6Options.Enable.No != nil { + nestedIpv6.DhcpClient.V6Options.Enable.No = &Ipv6DhcpClientV6OptionsEnableNoXml{} + if _, ok := o.Misc["Ipv6DhcpClientV6OptionsEnableNo"]; ok { + nestedIpv6.DhcpClient.V6Options.Enable.No.Misc = o.Misc["Ipv6DhcpClientV6OptionsEnableNo"] + } + } + } + } + } + if o.Ipv6.Inherited != nil { + nestedIpv6.Inherited = &Ipv6InheritedXml{} + if _, ok := o.Misc["Ipv6Inherited"]; ok { + nestedIpv6.Inherited.Misc = o.Misc["Ipv6Inherited"] + } + if o.Ipv6.Inherited.AssignAddr != nil { + nestedIpv6.Inherited.AssignAddr = []Ipv6InheritedAssignAddrXml{} + for _, oIpv6InheritedAssignAddr := range o.Ipv6.Inherited.AssignAddr { + nestedIpv6InheritedAssignAddr := Ipv6InheritedAssignAddrXml{} + if _, ok := o.Misc["Ipv6InheritedAssignAddr"]; ok { + nestedIpv6InheritedAssignAddr.Misc = o.Misc["Ipv6InheritedAssignAddr"] + } + if oIpv6InheritedAssignAddr.Type != nil { + nestedIpv6InheritedAssignAddr.Type = &Ipv6InheritedAssignAddrTypeXml{} + if _, ok := o.Misc["Ipv6InheritedAssignAddrType"]; ok { + nestedIpv6InheritedAssignAddr.Type.Misc = o.Misc["Ipv6InheritedAssignAddrType"] + } + if oIpv6InheritedAssignAddr.Type.Gua != nil { + nestedIpv6InheritedAssignAddr.Type.Gua = &Ipv6InheritedAssignAddrTypeGuaXml{} + if _, ok := o.Misc["Ipv6InheritedAssignAddrTypeGua"]; ok { + nestedIpv6InheritedAssignAddr.Type.Gua.Misc = o.Misc["Ipv6InheritedAssignAddrTypeGua"] + } + if oIpv6InheritedAssignAddr.Type.Gua.PoolType != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.PoolType = &Ipv6InheritedAssignAddrTypeGuaPoolTypeXml{} + if _, ok := o.Misc["Ipv6InheritedAssignAddrTypeGuaPoolType"]; ok { + nestedIpv6InheritedAssignAddr.Type.Gua.PoolType.Misc = o.Misc["Ipv6InheritedAssignAddrTypeGuaPoolType"] + } + if oIpv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic = &Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicXml{} + if _, ok := o.Misc["Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic"]; ok { + nestedIpv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic.Misc = o.Misc["Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic"] + } + } + if oIpv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId = &Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicIdXml{} + if _, ok := o.Misc["Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId"]; ok { + nestedIpv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Misc = o.Misc["Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId"] + } + if oIpv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier = oIpv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier + } + } + } + if oIpv6InheritedAssignAddr.Type.Gua.Advertise != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.Advertise = &Ipv6InheritedAssignAddrTypeGuaAdvertiseXml{} + if _, ok := o.Misc["Ipv6InheritedAssignAddrTypeGuaAdvertise"]; ok { + nestedIpv6InheritedAssignAddr.Type.Gua.Advertise.Misc = o.Misc["Ipv6InheritedAssignAddrTypeGuaAdvertise"] + } + if oIpv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag = util.YesNo(oIpv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag, nil) + } + if oIpv6InheritedAssignAddr.Type.Gua.Advertise.Enable != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.Advertise.Enable = util.YesNo(oIpv6InheritedAssignAddr.Type.Gua.Advertise.Enable, nil) + } + if oIpv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag = util.YesNo(oIpv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag, nil) + } + } + if oIpv6InheritedAssignAddr.Type.Gua.EnableOnInterface != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.EnableOnInterface = util.YesNo(oIpv6InheritedAssignAddr.Type.Gua.EnableOnInterface, nil) + } + if oIpv6InheritedAssignAddr.Type.Gua.PrefixPool != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.PrefixPool = oIpv6InheritedAssignAddr.Type.Gua.PrefixPool + } + } + if oIpv6InheritedAssignAddr.Type.Ula != nil { + nestedIpv6InheritedAssignAddr.Type.Ula = &Ipv6InheritedAssignAddrTypeUlaXml{} + if _, ok := o.Misc["Ipv6InheritedAssignAddrTypeUla"]; ok { + nestedIpv6InheritedAssignAddr.Type.Ula.Misc = o.Misc["Ipv6InheritedAssignAddrTypeUla"] + } + if oIpv6InheritedAssignAddr.Type.Ula.EnableOnInterface != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.EnableOnInterface = util.YesNo(oIpv6InheritedAssignAddr.Type.Ula.EnableOnInterface, nil) + } + if oIpv6InheritedAssignAddr.Type.Ula.Address != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Address = oIpv6InheritedAssignAddr.Type.Ula.Address + } + if oIpv6InheritedAssignAddr.Type.Ula.Prefix != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Prefix = util.YesNo(oIpv6InheritedAssignAddr.Type.Ula.Prefix, nil) + } + if oIpv6InheritedAssignAddr.Type.Ula.Anycast != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Anycast = util.YesNo(oIpv6InheritedAssignAddr.Type.Ula.Anycast, nil) + } + if oIpv6InheritedAssignAddr.Type.Ula.Advertise != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Advertise = &Ipv6InheritedAssignAddrTypeUlaAdvertiseXml{} + if _, ok := o.Misc["Ipv6InheritedAssignAddrTypeUlaAdvertise"]; ok { + nestedIpv6InheritedAssignAddr.Type.Ula.Advertise.Misc = o.Misc["Ipv6InheritedAssignAddrTypeUlaAdvertise"] + } + if oIpv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag = util.YesNo(oIpv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag, nil) + } + if oIpv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag = util.YesNo(oIpv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag, nil) + } + if oIpv6InheritedAssignAddr.Type.Ula.Advertise.Enable != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Advertise.Enable = util.YesNo(oIpv6InheritedAssignAddr.Type.Ula.Advertise.Enable, nil) + } + if oIpv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime = oIpv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime + } + if oIpv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime = oIpv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime + } + } + } + } + if oIpv6InheritedAssignAddr.Name != "" { + nestedIpv6InheritedAssignAddr.Name = oIpv6InheritedAssignAddr.Name + } + nestedIpv6.Inherited.AssignAddr = append(nestedIpv6.Inherited.AssignAddr, nestedIpv6InheritedAssignAddr) + } + } + if o.Ipv6.Inherited.Enable != nil { + nestedIpv6.Inherited.Enable = util.YesNo(o.Ipv6.Inherited.Enable, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery != nil { + nestedIpv6.Inherited.NeighborDiscovery = &Ipv6InheritedNeighborDiscoveryXml{} + if _, ok := o.Misc["Ipv6InheritedNeighborDiscovery"]; ok { + nestedIpv6.Inherited.NeighborDiscovery.Misc = o.Misc["Ipv6InheritedNeighborDiscovery"] + } + if o.Ipv6.Inherited.NeighborDiscovery.DadAttempts != nil { + nestedIpv6.Inherited.NeighborDiscovery.DadAttempts = o.Ipv6.Inherited.NeighborDiscovery.DadAttempts + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer = &Ipv6InheritedNeighborDiscoveryDnsServerXml{} + if _, ok := o.Misc["Ipv6InheritedNeighborDiscoveryDnsServer"]; ok { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Misc = o.Misc["Ipv6InheritedNeighborDiscoveryDnsServer"] + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Enable = util.YesNo(o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source = &Ipv6InheritedNeighborDiscoveryDnsServerSourceXml{} + if _, ok := o.Misc["Ipv6InheritedNeighborDiscoveryDnsServerSource"]; ok { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source.Misc = o.Misc["Ipv6InheritedNeighborDiscoveryDnsServerSource"] + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6Xml{} + if _, ok := o.Misc["Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6"]; ok { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc = o.Misc["Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6"] + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool = o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool + } + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual = &Ipv6InheritedNeighborDiscoveryDnsServerSourceManualXml{} + if _, ok := o.Misc["Ipv6InheritedNeighborDiscoveryDnsServerSourceManual"]; ok { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Misc = o.Misc["Ipv6InheritedNeighborDiscoveryDnsServerSourceManual"] + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = []Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml{} + for _, oIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer := range o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer := Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServerXml{} + if _, ok := o.Misc["Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer"]; ok { + nestedIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Misc = o.Misc["Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer"] + } + if oIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + if oIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name = oIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name + } + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + } + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix = &Ipv6InheritedNeighborDiscoveryDnsSuffixXml{} + if _, ok := o.Misc["Ipv6InheritedNeighborDiscoveryDnsSuffix"]; ok { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Misc = o.Misc["Ipv6InheritedNeighborDiscoveryDnsSuffix"] + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Enable = util.YesNo(o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source = &Ipv6InheritedNeighborDiscoveryDnsSuffixSourceXml{} + if _, ok := o.Misc["Ipv6InheritedNeighborDiscoveryDnsSuffixSource"]; ok { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Misc = o.Misc["Ipv6InheritedNeighborDiscoveryDnsSuffixSource"] + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6Xml{} + if _, ok := o.Misc["Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6"]; ok { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc = o.Misc["Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6"] + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool = o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool + } + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual = &Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualXml{} + if _, ok := o.Misc["Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual"]; ok { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Misc = o.Misc["Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual"] + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml{} + for _, oIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffixXml{} + if _, ok := o.Misc["Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix"]; ok { + nestedIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc = o.Misc["Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix"] + } + if oIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + if oIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + } + if o.Ipv6.Inherited.NeighborDiscovery.EnableDad != nil { + nestedIpv6.Inherited.NeighborDiscovery.EnableDad = util.YesNo(o.Ipv6.Inherited.NeighborDiscovery.EnableDad, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery.Neighbor != nil { + nestedIpv6.Inherited.NeighborDiscovery.Neighbor = []Ipv6InheritedNeighborDiscoveryNeighborXml{} + for _, oIpv6InheritedNeighborDiscoveryNeighbor := range o.Ipv6.Inherited.NeighborDiscovery.Neighbor { + nestedIpv6InheritedNeighborDiscoveryNeighbor := Ipv6InheritedNeighborDiscoveryNeighborXml{} + if _, ok := o.Misc["Ipv6InheritedNeighborDiscoveryNeighbor"]; ok { + nestedIpv6InheritedNeighborDiscoveryNeighbor.Misc = o.Misc["Ipv6InheritedNeighborDiscoveryNeighbor"] + } + if oIpv6InheritedNeighborDiscoveryNeighbor.HwAddress != nil { + nestedIpv6InheritedNeighborDiscoveryNeighbor.HwAddress = oIpv6InheritedNeighborDiscoveryNeighbor.HwAddress + } + if oIpv6InheritedNeighborDiscoveryNeighbor.Name != "" { + nestedIpv6InheritedNeighborDiscoveryNeighbor.Name = oIpv6InheritedNeighborDiscoveryNeighbor.Name + } + nestedIpv6.Inherited.NeighborDiscovery.Neighbor = append(nestedIpv6.Inherited.NeighborDiscovery.Neighbor, nestedIpv6InheritedNeighborDiscoveryNeighbor) + } + } + if o.Ipv6.Inherited.NeighborDiscovery.NsInterval != nil { + nestedIpv6.Inherited.NeighborDiscovery.NsInterval = o.Ipv6.Inherited.NeighborDiscovery.NsInterval + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement = &Ipv6InheritedNeighborDiscoveryRouterAdvertisementXml{} + if _, ok := o.Misc["Ipv6InheritedNeighborDiscoveryRouterAdvertisement"]; ok { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.Misc = o.Misc["Ipv6InheritedNeighborDiscoveryRouterAdvertisement"] + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable = util.YesNo(o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.YesNo(o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.YesNo(o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.YesNo(o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + } + if o.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor != nil { + nestedIpv6.Inherited.NeighborDiscovery.EnableNdpMonitor = util.YesNo(o.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery.ReachableTime != nil { + nestedIpv6.Inherited.NeighborDiscovery.ReachableTime = o.Ipv6.Inherited.NeighborDiscovery.ReachableTime + } + } + } + if o.Ipv6.Address != nil { + nestedIpv6.Address = []Ipv6AddressXml{} + for _, oIpv6Address := range o.Ipv6.Address { + nestedIpv6Address := Ipv6AddressXml{} + if _, ok := o.Misc["Ipv6Address"]; ok { + nestedIpv6Address.Misc = o.Misc["Ipv6Address"] + } + if oIpv6Address.Anycast != nil { + nestedIpv6Address.Anycast = &Ipv6AddressAnycastXml{} + if _, ok := o.Misc["Ipv6AddressAnycast"]; ok { + nestedIpv6Address.Anycast.Misc = o.Misc["Ipv6AddressAnycast"] + } + } + if oIpv6Address.Advertise != nil { + nestedIpv6Address.Advertise = &Ipv6AddressAdvertiseXml{} + if _, ok := o.Misc["Ipv6AddressAdvertise"]; ok { + nestedIpv6Address.Advertise.Misc = o.Misc["Ipv6AddressAdvertise"] + } + if oIpv6Address.Advertise.AutoConfigFlag != nil { + nestedIpv6Address.Advertise.AutoConfigFlag = util.YesNo(oIpv6Address.Advertise.AutoConfigFlag, nil) + } + if oIpv6Address.Advertise.Enable != nil { + nestedIpv6Address.Advertise.Enable = util.YesNo(oIpv6Address.Advertise.Enable, nil) + } + if oIpv6Address.Advertise.ValidLifetime != nil { + nestedIpv6Address.Advertise.ValidLifetime = oIpv6Address.Advertise.ValidLifetime + } + if oIpv6Address.Advertise.PreferredLifetime != nil { + nestedIpv6Address.Advertise.PreferredLifetime = oIpv6Address.Advertise.PreferredLifetime + } + if oIpv6Address.Advertise.OnlinkFlag != nil { + nestedIpv6Address.Advertise.OnlinkFlag = util.YesNo(oIpv6Address.Advertise.OnlinkFlag, nil) + } + } + if oIpv6Address.Name != "" { + nestedIpv6Address.Name = oIpv6Address.Name + } + if oIpv6Address.EnableOnInterface != nil { + nestedIpv6Address.EnableOnInterface = util.YesNo(oIpv6Address.EnableOnInterface, nil) + } + if oIpv6Address.Prefix != nil { + nestedIpv6Address.Prefix = &Ipv6AddressPrefixXml{} + if _, ok := o.Misc["Ipv6AddressPrefix"]; ok { + nestedIpv6Address.Prefix.Misc = o.Misc["Ipv6AddressPrefix"] + } + } + nestedIpv6.Address = append(nestedIpv6.Address, nestedIpv6Address) + } + } + if o.Ipv6.Enabled != nil { + nestedIpv6.Enabled = util.YesNo(o.Ipv6.Enabled, nil) + } + if o.Ipv6.InterfaceId != nil { + nestedIpv6.InterfaceId = o.Ipv6.InterfaceId + } + if o.Ipv6.NeighborDiscovery != nil { + nestedIpv6.NeighborDiscovery = &Ipv6NeighborDiscoveryXml{} + if _, ok := o.Misc["Ipv6NeighborDiscovery"]; ok { + nestedIpv6.NeighborDiscovery.Misc = o.Misc["Ipv6NeighborDiscovery"] + } + if o.Ipv6.NeighborDiscovery.DadAttempts != nil { + nestedIpv6.NeighborDiscovery.DadAttempts = o.Ipv6.NeighborDiscovery.DadAttempts + } + if o.Ipv6.NeighborDiscovery.EnableDad != nil { + nestedIpv6.NeighborDiscovery.EnableDad = util.YesNo(o.Ipv6.NeighborDiscovery.EnableDad, nil) + } + if o.Ipv6.NeighborDiscovery.EnableNdpMonitor != nil { + nestedIpv6.NeighborDiscovery.EnableNdpMonitor = util.YesNo(o.Ipv6.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Ipv6.NeighborDiscovery.Neighbor != nil { + nestedIpv6.NeighborDiscovery.Neighbor = []Ipv6NeighborDiscoveryNeighborXml{} + for _, oIpv6NeighborDiscoveryNeighbor := range o.Ipv6.NeighborDiscovery.Neighbor { + nestedIpv6NeighborDiscoveryNeighbor := Ipv6NeighborDiscoveryNeighborXml{} + if _, ok := o.Misc["Ipv6NeighborDiscoveryNeighbor"]; ok { + nestedIpv6NeighborDiscoveryNeighbor.Misc = o.Misc["Ipv6NeighborDiscoveryNeighbor"] + } + if oIpv6NeighborDiscoveryNeighbor.HwAddress != nil { + nestedIpv6NeighborDiscoveryNeighbor.HwAddress = oIpv6NeighborDiscoveryNeighbor.HwAddress + } + if oIpv6NeighborDiscoveryNeighbor.Name != "" { + nestedIpv6NeighborDiscoveryNeighbor.Name = oIpv6NeighborDiscoveryNeighbor.Name + } + nestedIpv6.NeighborDiscovery.Neighbor = append(nestedIpv6.NeighborDiscovery.Neighbor, nestedIpv6NeighborDiscoveryNeighbor) + } + } + if o.Ipv6.NeighborDiscovery.NsInterval != nil { + nestedIpv6.NeighborDiscovery.NsInterval = o.Ipv6.NeighborDiscovery.NsInterval + } + if o.Ipv6.NeighborDiscovery.ReachableTime != nil { + nestedIpv6.NeighborDiscovery.ReachableTime = o.Ipv6.NeighborDiscovery.ReachableTime + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement = &Ipv6NeighborDiscoveryRouterAdvertisementXml{} + if _, ok := o.Misc["Ipv6NeighborDiscoveryRouterAdvertisement"]; ok { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.Misc = o.Misc["Ipv6NeighborDiscoveryRouterAdvertisement"] + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.YesNo(o.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.YesNo(o.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport = &Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportXml{} + if _, ok := o.Misc["Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport"]; ok { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Misc = o.Misc["Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport"] + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable = util.YesNo(o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable, nil) + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = []Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml{} + for _, oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := range o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server { + nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServerXml{} + if _, ok := o.Misc["Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer"]; ok { + nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Misc = o.Misc["Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer"] + } + if oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime != nil { + nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime = oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime + } + if oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name != "" { + nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name = oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name + } + nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = append(nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server, nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer) + } + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = []Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml{} + for _, oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := range o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix { + nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffixXml{} + if _, ok := o.Misc["Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix"]; ok { + nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Misc = o.Misc["Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix"] + } + if oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name != "" { + nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name = oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name + } + if oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime != nil { + nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime = oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime + } + nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = append(nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix, nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix) + } + } + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.YesNo(o.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.Enable = util.YesNo(o.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + } + } + } + entry.Ipv6 = nestedIpv6 + + entry.Mtu = o.Mtu + var nestedNdpProxy *NdpProxyXml + if o.NdpProxy != nil { + nestedNdpProxy = &NdpProxyXml{} + if _, ok := o.Misc["NdpProxy"]; ok { + nestedNdpProxy.Misc = o.Misc["NdpProxy"] + } + if o.NdpProxy.Address != nil { + nestedNdpProxy.Address = []NdpProxyAddressXml{} + for _, oNdpProxyAddress := range o.NdpProxy.Address { + nestedNdpProxyAddress := NdpProxyAddressXml{} + if _, ok := o.Misc["NdpProxyAddress"]; ok { + nestedNdpProxyAddress.Misc = o.Misc["NdpProxyAddress"] + } + if oNdpProxyAddress.Negate != nil { + nestedNdpProxyAddress.Negate = util.YesNo(oNdpProxyAddress.Negate, nil) + } + if oNdpProxyAddress.Name != "" { + nestedNdpProxyAddress.Name = oNdpProxyAddress.Name + } + nestedNdpProxy.Address = append(nestedNdpProxy.Address, nestedNdpProxyAddress) + } + } + if o.NdpProxy.Enabled != nil { + nestedNdpProxy.Enabled = util.YesNo(o.NdpProxy.Enabled, nil) + } + } + entry.NdpProxy = nestedNdpProxy + + entry.NetflowProfile = o.NetflowProfile + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + var nestedAdjustTcpMss *AdjustTcpMss + if o.AdjustTcpMss != nil { + nestedAdjustTcpMss = &AdjustTcpMss{} + if o.AdjustTcpMss.Misc != nil { + entry.Misc["AdjustTcpMss"] = o.AdjustTcpMss.Misc + } + if o.AdjustTcpMss.Enable != nil { + nestedAdjustTcpMss.Enable = util.AsBool(o.AdjustTcpMss.Enable, nil) + } + if o.AdjustTcpMss.Ipv4MssAdjustment != nil { + nestedAdjustTcpMss.Ipv4MssAdjustment = o.AdjustTcpMss.Ipv4MssAdjustment + } + if o.AdjustTcpMss.Ipv6MssAdjustment != nil { + nestedAdjustTcpMss.Ipv6MssAdjustment = o.AdjustTcpMss.Ipv6MssAdjustment + } + } + entry.AdjustTcpMss = nestedAdjustTcpMss + + var nestedArpCol []Arp + if o.Arp != nil { + nestedArpCol = []Arp{} + for _, oArp := range o.Arp { + nestedArp := Arp{} + if oArp.Misc != nil { + entry.Misc["Arp"] = oArp.Misc + } + if oArp.HwAddress != nil { + nestedArp.HwAddress = oArp.HwAddress + } + if oArp.Interface != nil { + nestedArp.Interface = oArp.Interface + } + if oArp.Name != "" { + nestedArp.Name = oArp.Name + } + nestedArpCol = append(nestedArpCol, nestedArp) + } + entry.Arp = nestedArpCol + } + + var nestedBonjour *Bonjour + if o.Bonjour != nil { + nestedBonjour = &Bonjour{} + if o.Bonjour.Misc != nil { + entry.Misc["Bonjour"] = o.Bonjour.Misc + } + if o.Bonjour.Enable != nil { + nestedBonjour.Enable = util.AsBool(o.Bonjour.Enable, nil) + } + if o.Bonjour.GroupId != nil { + nestedBonjour.GroupId = o.Bonjour.GroupId + } + if o.Bonjour.TtlCheck != nil { + nestedBonjour.TtlCheck = util.AsBool(o.Bonjour.TtlCheck, nil) + } + } + entry.Bonjour = nestedBonjour + + entry.Comment = o.Comment + var nestedDdnsConfig *DdnsConfig + if o.DdnsConfig != nil { + nestedDdnsConfig = &DdnsConfig{} + if o.DdnsConfig.Misc != nil { + entry.Misc["DdnsConfig"] = o.DdnsConfig.Misc + } + if o.DdnsConfig.DdnsHostname != nil { + nestedDdnsConfig.DdnsHostname = o.DdnsConfig.DdnsHostname + } + if o.DdnsConfig.DdnsIp != nil { + nestedDdnsConfig.DdnsIp = util.MemToStr(o.DdnsConfig.DdnsIp) + } + if o.DdnsConfig.DdnsIpv6 != nil { + nestedDdnsConfig.DdnsIpv6 = util.MemToStr(o.DdnsConfig.DdnsIpv6) + } + if o.DdnsConfig.DdnsUpdateInterval != nil { + nestedDdnsConfig.DdnsUpdateInterval = o.DdnsConfig.DdnsUpdateInterval + } + if o.DdnsConfig.DdnsVendor != nil { + nestedDdnsConfig.DdnsVendor = o.DdnsConfig.DdnsVendor + } + if o.DdnsConfig.DdnsVendorConfig != nil { + nestedDdnsConfig.DdnsVendorConfig = []DdnsConfigDdnsVendorConfig{} + for _, oDdnsConfigDdnsVendorConfig := range o.DdnsConfig.DdnsVendorConfig { + nestedDdnsConfigDdnsVendorConfig := DdnsConfigDdnsVendorConfig{} + if oDdnsConfigDdnsVendorConfig.Misc != nil { + entry.Misc["DdnsConfigDdnsVendorConfig"] = oDdnsConfigDdnsVendorConfig.Misc + } + if oDdnsConfigDdnsVendorConfig.Value != nil { + nestedDdnsConfigDdnsVendorConfig.Value = oDdnsConfigDdnsVendorConfig.Value + } + if oDdnsConfigDdnsVendorConfig.Name != "" { + nestedDdnsConfigDdnsVendorConfig.Name = oDdnsConfigDdnsVendorConfig.Name + } + nestedDdnsConfig.DdnsVendorConfig = append(nestedDdnsConfig.DdnsVendorConfig, nestedDdnsConfigDdnsVendorConfig) + } + } + if o.DdnsConfig.DdnsCertProfile != nil { + nestedDdnsConfig.DdnsCertProfile = o.DdnsConfig.DdnsCertProfile + } + if o.DdnsConfig.DdnsEnabled != nil { + nestedDdnsConfig.DdnsEnabled = util.AsBool(o.DdnsConfig.DdnsEnabled, nil) + } + } + entry.DdnsConfig = nestedDdnsConfig + + entry.DfIgnore = util.AsBool(o.DfIgnore, nil) + var nestedDhcpClient *DhcpClient + if o.DhcpClient != nil { + nestedDhcpClient = &DhcpClient{} + if o.DhcpClient.Misc != nil { + entry.Misc["DhcpClient"] = o.DhcpClient.Misc + } + if o.DhcpClient.CreateDefaultRoute != nil { + nestedDhcpClient.CreateDefaultRoute = util.AsBool(o.DhcpClient.CreateDefaultRoute, nil) + } + if o.DhcpClient.DefaultRouteMetric != nil { + nestedDhcpClient.DefaultRouteMetric = o.DhcpClient.DefaultRouteMetric + } + if o.DhcpClient.Enable != nil { + nestedDhcpClient.Enable = util.AsBool(o.DhcpClient.Enable, nil) + } + if o.DhcpClient.SendHostname != nil { + nestedDhcpClient.SendHostname = &DhcpClientSendHostname{} + if o.DhcpClient.SendHostname.Misc != nil { + entry.Misc["DhcpClientSendHostname"] = o.DhcpClient.SendHostname.Misc + } + if o.DhcpClient.SendHostname.Enable != nil { + nestedDhcpClient.SendHostname.Enable = util.AsBool(o.DhcpClient.SendHostname.Enable, nil) + } + if o.DhcpClient.SendHostname.Hostname != nil { + nestedDhcpClient.SendHostname.Hostname = o.DhcpClient.SendHostname.Hostname + } + } + } + entry.DhcpClient = nestedDhcpClient + + entry.InterfaceManagementProfile = o.InterfaceManagementProfile + var nestedIpCol []Ip + if o.Ip != nil { + nestedIpCol = []Ip{} + for _, oIp := range o.Ip { + nestedIp := Ip{} + if oIp.Misc != nil { + entry.Misc["Ip"] = oIp.Misc + } + if oIp.Name != "" { + nestedIp.Name = oIp.Name + } + nestedIpCol = append(nestedIpCol, nestedIp) + } + entry.Ip = nestedIpCol + } + + var nestedIpv6 *Ipv6 + if o.Ipv6 != nil { + nestedIpv6 = &Ipv6{} + if o.Ipv6.Misc != nil { + entry.Misc["Ipv6"] = o.Ipv6.Misc + } + if o.Ipv6.Enabled != nil { + nestedIpv6.Enabled = util.AsBool(o.Ipv6.Enabled, nil) + } + if o.Ipv6.InterfaceId != nil { + nestedIpv6.InterfaceId = o.Ipv6.InterfaceId + } + if o.Ipv6.NeighborDiscovery != nil { + nestedIpv6.NeighborDiscovery = &Ipv6NeighborDiscovery{} + if o.Ipv6.NeighborDiscovery.Misc != nil { + entry.Misc["Ipv6NeighborDiscovery"] = o.Ipv6.NeighborDiscovery.Misc + } + if o.Ipv6.NeighborDiscovery.DadAttempts != nil { + nestedIpv6.NeighborDiscovery.DadAttempts = o.Ipv6.NeighborDiscovery.DadAttempts + } + if o.Ipv6.NeighborDiscovery.EnableDad != nil { + nestedIpv6.NeighborDiscovery.EnableDad = util.AsBool(o.Ipv6.NeighborDiscovery.EnableDad, nil) + } + if o.Ipv6.NeighborDiscovery.EnableNdpMonitor != nil { + nestedIpv6.NeighborDiscovery.EnableNdpMonitor = util.AsBool(o.Ipv6.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Ipv6.NeighborDiscovery.Neighbor != nil { + nestedIpv6.NeighborDiscovery.Neighbor = []Ipv6NeighborDiscoveryNeighbor{} + for _, oIpv6NeighborDiscoveryNeighbor := range o.Ipv6.NeighborDiscovery.Neighbor { + nestedIpv6NeighborDiscoveryNeighbor := Ipv6NeighborDiscoveryNeighbor{} + if oIpv6NeighborDiscoveryNeighbor.Misc != nil { + entry.Misc["Ipv6NeighborDiscoveryNeighbor"] = oIpv6NeighborDiscoveryNeighbor.Misc + } + if oIpv6NeighborDiscoveryNeighbor.HwAddress != nil { + nestedIpv6NeighborDiscoveryNeighbor.HwAddress = oIpv6NeighborDiscoveryNeighbor.HwAddress + } + if oIpv6NeighborDiscoveryNeighbor.Name != "" { + nestedIpv6NeighborDiscoveryNeighbor.Name = oIpv6NeighborDiscoveryNeighbor.Name + } + nestedIpv6.NeighborDiscovery.Neighbor = append(nestedIpv6.NeighborDiscovery.Neighbor, nestedIpv6NeighborDiscoveryNeighbor) + } + } + if o.Ipv6.NeighborDiscovery.NsInterval != nil { + nestedIpv6.NeighborDiscovery.NsInterval = o.Ipv6.NeighborDiscovery.NsInterval + } + if o.Ipv6.NeighborDiscovery.ReachableTime != nil { + nestedIpv6.NeighborDiscovery.ReachableTime = o.Ipv6.NeighborDiscovery.ReachableTime + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement = &Ipv6NeighborDiscoveryRouterAdvertisement{} + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.Misc != nil { + entry.Misc["Ipv6NeighborDiscoveryRouterAdvertisement"] = o.Ipv6.NeighborDiscovery.RouterAdvertisement.Misc + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Ipv6.NeighborDiscovery.RouterAdvertisement.MinInterval + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Ipv6.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport = &Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport{} + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Misc != nil { + entry.Misc["Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport"] = o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Misc + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = []Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer{} + for _, oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := range o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server { + nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer := Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer{} + if oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Misc != nil { + entry.Misc["Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer"] = oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Misc + } + if oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime != nil { + nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime = oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Lifetime + } + if oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name != "" { + nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name = oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer.Name + } + nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server = append(nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Server, nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer) + } + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = []Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix{} + for _, oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := range o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix { + nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix := Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix{} + if oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Misc != nil { + entry.Misc["Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix"] = oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Misc + } + if oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime != nil { + nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime = oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Lifetime + } + if oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name != "" { + nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name = oIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix.Name + } + nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix = append(nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Suffix, nestedIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix) + } + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable = util.AsBool(o.Ipv6.NeighborDiscovery.RouterAdvertisement.DnsSupport.Enable, nil) + } + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.AsBool(o.Ipv6.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Ipv6.NeighborDiscovery.RouterAdvertisement.Lifetime + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.AsBool(o.Ipv6.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.AsBool(o.Ipv6.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Ipv6.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Ipv6.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.Enable = util.AsBool(o.Ipv6.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Ipv6.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Ipv6.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + if o.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedIpv6.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Ipv6.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + } + } + if o.Ipv6.DhcpClient != nil { + nestedIpv6.DhcpClient = &Ipv6DhcpClient{} + if o.Ipv6.DhcpClient.Misc != nil { + entry.Misc["Ipv6DhcpClient"] = o.Ipv6.DhcpClient.Misc + } + if o.Ipv6.DhcpClient.AcceptRaRoute != nil { + nestedIpv6.DhcpClient.AcceptRaRoute = util.AsBool(o.Ipv6.DhcpClient.AcceptRaRoute, nil) + } + if o.Ipv6.DhcpClient.DefaultRouteMetric != nil { + nestedIpv6.DhcpClient.DefaultRouteMetric = o.Ipv6.DhcpClient.DefaultRouteMetric + } + if o.Ipv6.DhcpClient.Enable != nil { + nestedIpv6.DhcpClient.Enable = util.AsBool(o.Ipv6.DhcpClient.Enable, nil) + } + if o.Ipv6.DhcpClient.NeighborDiscovery != nil { + nestedIpv6.DhcpClient.NeighborDiscovery = &Ipv6DhcpClientNeighborDiscovery{} + if o.Ipv6.DhcpClient.NeighborDiscovery.Misc != nil { + entry.Misc["Ipv6DhcpClientNeighborDiscovery"] = o.Ipv6.DhcpClient.NeighborDiscovery.Misc + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix = &Ipv6DhcpClientNeighborDiscoveryDnsSuffix{} + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Misc != nil { + entry.Misc["Ipv6DhcpClientNeighborDiscoveryDnsSuffix"] = o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Misc + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable = util.AsBool(o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Enable, nil) + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source = &Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource{} + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Misc != nil { + entry.Misc["Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource"] = o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Misc + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6{} + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc != nil { + entry.Misc["Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6"] = o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc + } + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual = &Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual{} + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Misc != nil { + entry.Misc["Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual"] = o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Misc + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix{} + for _, oIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Ipv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix := Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix{} + if oIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc != nil { + entry.Misc["Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix"] = oIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc + } + if oIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + if oIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedIpv6.DhcpClient.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + } + if o.Ipv6.DhcpClient.NeighborDiscovery.EnableDad != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.EnableDad = util.AsBool(o.Ipv6.DhcpClient.NeighborDiscovery.EnableDad, nil) + } + if o.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor = util.AsBool(o.Ipv6.DhcpClient.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Ipv6.DhcpClient.NeighborDiscovery.Neighbor != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.Neighbor = []Ipv6DhcpClientNeighborDiscoveryNeighbor{} + for _, oIpv6DhcpClientNeighborDiscoveryNeighbor := range o.Ipv6.DhcpClient.NeighborDiscovery.Neighbor { + nestedIpv6DhcpClientNeighborDiscoveryNeighbor := Ipv6DhcpClientNeighborDiscoveryNeighbor{} + if oIpv6DhcpClientNeighborDiscoveryNeighbor.Misc != nil { + entry.Misc["Ipv6DhcpClientNeighborDiscoveryNeighbor"] = oIpv6DhcpClientNeighborDiscoveryNeighbor.Misc + } + if oIpv6DhcpClientNeighborDiscoveryNeighbor.HwAddress != nil { + nestedIpv6DhcpClientNeighborDiscoveryNeighbor.HwAddress = oIpv6DhcpClientNeighborDiscoveryNeighbor.HwAddress + } + if oIpv6DhcpClientNeighborDiscoveryNeighbor.Name != "" { + nestedIpv6DhcpClientNeighborDiscoveryNeighbor.Name = oIpv6DhcpClientNeighborDiscoveryNeighbor.Name + } + nestedIpv6.DhcpClient.NeighborDiscovery.Neighbor = append(nestedIpv6.DhcpClient.NeighborDiscovery.Neighbor, nestedIpv6DhcpClientNeighborDiscoveryNeighbor) + } + } + if o.Ipv6.DhcpClient.NeighborDiscovery.NsInterval != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.NsInterval = o.Ipv6.DhcpClient.NeighborDiscovery.NsInterval + } + if o.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.ReachableTime = o.Ipv6.DhcpClient.NeighborDiscovery.ReachableTime + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DadAttempts = o.Ipv6.DhcpClient.NeighborDiscovery.DadAttempts + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer = &Ipv6DhcpClientNeighborDiscoveryDnsServer{} + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Misc != nil { + entry.Misc["Ipv6DhcpClientNeighborDiscoveryDnsServer"] = o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Misc + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Enable = util.AsBool(o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Enable, nil) + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Source = &Ipv6DhcpClientNeighborDiscoveryDnsServerSource{} + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Misc != nil { + entry.Misc["Ipv6DhcpClientNeighborDiscoveryDnsServerSource"] = o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Misc + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6{} + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc != nil { + entry.Misc["Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6"] = o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc + } + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual = &Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual{} + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Misc != nil { + entry.Misc["Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual"] = o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Misc + } + if o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = []Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer{} + for _, oIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := range o.Ipv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer := Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer{} + if oIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Misc != nil { + entry.Misc["Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer"] = oIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Misc + } + if oIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + if oIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name = oIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer.Name + } + nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedIpv6.DhcpClient.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + } + } + } + if o.Ipv6.DhcpClient.Preference != nil { + nestedIpv6.DhcpClient.Preference = o.Ipv6.DhcpClient.Preference + } + if o.Ipv6.DhcpClient.PrefixDelegation != nil { + nestedIpv6.DhcpClient.PrefixDelegation = &Ipv6DhcpClientPrefixDelegation{} + if o.Ipv6.DhcpClient.PrefixDelegation.Misc != nil { + entry.Misc["Ipv6DhcpClientPrefixDelegation"] = o.Ipv6.DhcpClient.PrefixDelegation.Misc + } + if o.Ipv6.DhcpClient.PrefixDelegation.Enable != nil { + nestedIpv6.DhcpClient.PrefixDelegation.Enable = &Ipv6DhcpClientPrefixDelegationEnable{} + if o.Ipv6.DhcpClient.PrefixDelegation.Enable.Misc != nil { + entry.Misc["Ipv6DhcpClientPrefixDelegationEnable"] = o.Ipv6.DhcpClient.PrefixDelegation.Enable.Misc + } + if o.Ipv6.DhcpClient.PrefixDelegation.Enable.No != nil { + nestedIpv6.DhcpClient.PrefixDelegation.Enable.No = &Ipv6DhcpClientPrefixDelegationEnableNo{} + if o.Ipv6.DhcpClient.PrefixDelegation.Enable.No.Misc != nil { + entry.Misc["Ipv6DhcpClientPrefixDelegationEnableNo"] = o.Ipv6.DhcpClient.PrefixDelegation.Enable.No.Misc + } + } + if o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes != nil { + nestedIpv6.DhcpClient.PrefixDelegation.Enable.Yes = &Ipv6DhcpClientPrefixDelegationEnableYes{} + if o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.Misc != nil { + entry.Misc["Ipv6DhcpClientPrefixDelegationEnableYes"] = o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.Misc + } + if o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName != nil { + nestedIpv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName = o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PfxPoolName + } + if o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen != nil { + nestedIpv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen = o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLen + } + if o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint != nil { + nestedIpv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint = util.AsBool(o.Ipv6.DhcpClient.PrefixDelegation.Enable.Yes.PrefixLenHint, nil) + } + } + } + } + if o.Ipv6.DhcpClient.V6Options != nil { + nestedIpv6.DhcpClient.V6Options = &Ipv6DhcpClientV6Options{} + if o.Ipv6.DhcpClient.V6Options.Misc != nil { + entry.Misc["Ipv6DhcpClientV6Options"] = o.Ipv6.DhcpClient.V6Options.Misc + } + if o.Ipv6.DhcpClient.V6Options.DuidType != nil { + nestedIpv6.DhcpClient.V6Options.DuidType = o.Ipv6.DhcpClient.V6Options.DuidType + } + if o.Ipv6.DhcpClient.V6Options.Enable != nil { + nestedIpv6.DhcpClient.V6Options.Enable = &Ipv6DhcpClientV6OptionsEnable{} + if o.Ipv6.DhcpClient.V6Options.Enable.Misc != nil { + entry.Misc["Ipv6DhcpClientV6OptionsEnable"] = o.Ipv6.DhcpClient.V6Options.Enable.Misc + } + if o.Ipv6.DhcpClient.V6Options.Enable.Yes != nil { + nestedIpv6.DhcpClient.V6Options.Enable.Yes = &Ipv6DhcpClientV6OptionsEnableYes{} + if o.Ipv6.DhcpClient.V6Options.Enable.Yes.Misc != nil { + entry.Misc["Ipv6DhcpClientV6OptionsEnableYes"] = o.Ipv6.DhcpClient.V6Options.Enable.Yes.Misc + } + if o.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr != nil { + nestedIpv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr = util.AsBool(o.Ipv6.DhcpClient.V6Options.Enable.Yes.NonTempAddr, nil) + } + if o.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr != nil { + nestedIpv6.DhcpClient.V6Options.Enable.Yes.TempAddr = util.AsBool(o.Ipv6.DhcpClient.V6Options.Enable.Yes.TempAddr, nil) + } + } + if o.Ipv6.DhcpClient.V6Options.Enable.No != nil { + nestedIpv6.DhcpClient.V6Options.Enable.No = &Ipv6DhcpClientV6OptionsEnableNo{} + if o.Ipv6.DhcpClient.V6Options.Enable.No.Misc != nil { + entry.Misc["Ipv6DhcpClientV6OptionsEnableNo"] = o.Ipv6.DhcpClient.V6Options.Enable.No.Misc + } + } + } + if o.Ipv6.DhcpClient.V6Options.RapidCommit != nil { + nestedIpv6.DhcpClient.V6Options.RapidCommit = util.AsBool(o.Ipv6.DhcpClient.V6Options.RapidCommit, nil) + } + if o.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig != nil { + nestedIpv6.DhcpClient.V6Options.SupportSrvrReconfig = util.AsBool(o.Ipv6.DhcpClient.V6Options.SupportSrvrReconfig, nil) + } + } + } + if o.Ipv6.Inherited != nil { + nestedIpv6.Inherited = &Ipv6Inherited{} + if o.Ipv6.Inherited.Misc != nil { + entry.Misc["Ipv6Inherited"] = o.Ipv6.Inherited.Misc + } + if o.Ipv6.Inherited.AssignAddr != nil { + nestedIpv6.Inherited.AssignAddr = []Ipv6InheritedAssignAddr{} + for _, oIpv6InheritedAssignAddr := range o.Ipv6.Inherited.AssignAddr { + nestedIpv6InheritedAssignAddr := Ipv6InheritedAssignAddr{} + if oIpv6InheritedAssignAddr.Misc != nil { + entry.Misc["Ipv6InheritedAssignAddr"] = oIpv6InheritedAssignAddr.Misc + } + if oIpv6InheritedAssignAddr.Type != nil { + nestedIpv6InheritedAssignAddr.Type = &Ipv6InheritedAssignAddrType{} + if oIpv6InheritedAssignAddr.Type.Misc != nil { + entry.Misc["Ipv6InheritedAssignAddrType"] = oIpv6InheritedAssignAddr.Type.Misc + } + if oIpv6InheritedAssignAddr.Type.Gua != nil { + nestedIpv6InheritedAssignAddr.Type.Gua = &Ipv6InheritedAssignAddrTypeGua{} + if oIpv6InheritedAssignAddr.Type.Gua.Misc != nil { + entry.Misc["Ipv6InheritedAssignAddrTypeGua"] = oIpv6InheritedAssignAddr.Type.Gua.Misc + } + if oIpv6InheritedAssignAddr.Type.Gua.EnableOnInterface != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.EnableOnInterface = util.AsBool(oIpv6InheritedAssignAddr.Type.Gua.EnableOnInterface, nil) + } + if oIpv6InheritedAssignAddr.Type.Gua.PrefixPool != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.PrefixPool = oIpv6InheritedAssignAddr.Type.Gua.PrefixPool + } + if oIpv6InheritedAssignAddr.Type.Gua.PoolType != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.PoolType = &Ipv6InheritedAssignAddrTypeGuaPoolType{} + if oIpv6InheritedAssignAddr.Type.Gua.PoolType.Misc != nil { + entry.Misc["Ipv6InheritedAssignAddrTypeGuaPoolType"] = oIpv6InheritedAssignAddr.Type.Gua.PoolType.Misc + } + if oIpv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId = &Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId{} + if oIpv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Misc != nil { + entry.Misc["Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId"] = oIpv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Misc + } + if oIpv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier = oIpv6InheritedAssignAddr.Type.Gua.PoolType.DynamicId.Identifier + } + } + if oIpv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic = &Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic{} + if oIpv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic.Misc != nil { + entry.Misc["Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic"] = oIpv6InheritedAssignAddr.Type.Gua.PoolType.Dynamic.Misc + } + } + } + if oIpv6InheritedAssignAddr.Type.Gua.Advertise != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.Advertise = &Ipv6InheritedAssignAddrTypeGuaAdvertise{} + if oIpv6InheritedAssignAddr.Type.Gua.Advertise.Misc != nil { + entry.Misc["Ipv6InheritedAssignAddrTypeGuaAdvertise"] = oIpv6InheritedAssignAddr.Type.Gua.Advertise.Misc + } + if oIpv6InheritedAssignAddr.Type.Gua.Advertise.Enable != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.Advertise.Enable = util.AsBool(oIpv6InheritedAssignAddr.Type.Gua.Advertise.Enable, nil) + } + if oIpv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag = util.AsBool(oIpv6InheritedAssignAddr.Type.Gua.Advertise.OnlinkFlag, nil) + } + if oIpv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag != nil { + nestedIpv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag = util.AsBool(oIpv6InheritedAssignAddr.Type.Gua.Advertise.AutoConfigFlag, nil) + } + } + } + if oIpv6InheritedAssignAddr.Type.Ula != nil { + nestedIpv6InheritedAssignAddr.Type.Ula = &Ipv6InheritedAssignAddrTypeUla{} + if oIpv6InheritedAssignAddr.Type.Ula.Misc != nil { + entry.Misc["Ipv6InheritedAssignAddrTypeUla"] = oIpv6InheritedAssignAddr.Type.Ula.Misc + } + if oIpv6InheritedAssignAddr.Type.Ula.Anycast != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Anycast = util.AsBool(oIpv6InheritedAssignAddr.Type.Ula.Anycast, nil) + } + if oIpv6InheritedAssignAddr.Type.Ula.Advertise != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Advertise = &Ipv6InheritedAssignAddrTypeUlaAdvertise{} + if oIpv6InheritedAssignAddr.Type.Ula.Advertise.Misc != nil { + entry.Misc["Ipv6InheritedAssignAddrTypeUlaAdvertise"] = oIpv6InheritedAssignAddr.Type.Ula.Advertise.Misc + } + if oIpv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag = util.AsBool(oIpv6InheritedAssignAddr.Type.Ula.Advertise.OnlinkFlag, nil) + } + if oIpv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag = util.AsBool(oIpv6InheritedAssignAddr.Type.Ula.Advertise.AutoConfigFlag, nil) + } + if oIpv6InheritedAssignAddr.Type.Ula.Advertise.Enable != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Advertise.Enable = util.AsBool(oIpv6InheritedAssignAddr.Type.Ula.Advertise.Enable, nil) + } + if oIpv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime = oIpv6InheritedAssignAddr.Type.Ula.Advertise.ValidLifetime + } + if oIpv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime = oIpv6InheritedAssignAddr.Type.Ula.Advertise.PreferredLifetime + } + } + if oIpv6InheritedAssignAddr.Type.Ula.EnableOnInterface != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.EnableOnInterface = util.AsBool(oIpv6InheritedAssignAddr.Type.Ula.EnableOnInterface, nil) + } + if oIpv6InheritedAssignAddr.Type.Ula.Address != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Address = oIpv6InheritedAssignAddr.Type.Ula.Address + } + if oIpv6InheritedAssignAddr.Type.Ula.Prefix != nil { + nestedIpv6InheritedAssignAddr.Type.Ula.Prefix = util.AsBool(oIpv6InheritedAssignAddr.Type.Ula.Prefix, nil) + } + } + } + if oIpv6InheritedAssignAddr.Name != "" { + nestedIpv6InheritedAssignAddr.Name = oIpv6InheritedAssignAddr.Name + } + nestedIpv6.Inherited.AssignAddr = append(nestedIpv6.Inherited.AssignAddr, nestedIpv6InheritedAssignAddr) + } + } + if o.Ipv6.Inherited.Enable != nil { + nestedIpv6.Inherited.Enable = util.AsBool(o.Ipv6.Inherited.Enable, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery != nil { + nestedIpv6.Inherited.NeighborDiscovery = &Ipv6InheritedNeighborDiscovery{} + if o.Ipv6.Inherited.NeighborDiscovery.Misc != nil { + entry.Misc["Ipv6InheritedNeighborDiscovery"] = o.Ipv6.Inherited.NeighborDiscovery.Misc + } + if o.Ipv6.Inherited.NeighborDiscovery.NsInterval != nil { + nestedIpv6.Inherited.NeighborDiscovery.NsInterval = o.Ipv6.Inherited.NeighborDiscovery.NsInterval + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement = &Ipv6InheritedNeighborDiscoveryRouterAdvertisement{} + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Misc != nil { + entry.Misc["Ipv6InheritedNeighborDiscoveryRouterAdvertisement"] = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Misc + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.HopLimit + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Lifetime + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.LinkMtu + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MaxInterval + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.MinInterval + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ReachableTime + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable = util.AsBool(o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.Enable, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck = util.AsBool(o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.EnableConsistencyCheck, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RetransmissionTimer + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference = o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.RouterPreference + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag = util.AsBool(o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.ManagedFlag, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag != nil { + nestedIpv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag = util.AsBool(o.Ipv6.Inherited.NeighborDiscovery.RouterAdvertisement.OtherFlag, nil) + } + } + if o.Ipv6.Inherited.NeighborDiscovery.DadAttempts != nil { + nestedIpv6.Inherited.NeighborDiscovery.DadAttempts = o.Ipv6.Inherited.NeighborDiscovery.DadAttempts + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer = &Ipv6InheritedNeighborDiscoveryDnsServer{} + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Misc != nil { + entry.Misc["Ipv6InheritedNeighborDiscoveryDnsServer"] = o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Misc + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Enable = util.AsBool(o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Enable, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source = &Ipv6InheritedNeighborDiscoveryDnsServerSource{} + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Misc != nil { + entry.Misc["Ipv6InheritedNeighborDiscoveryDnsServerSource"] = o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Misc + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual = &Ipv6InheritedNeighborDiscoveryDnsServerSourceManual{} + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Misc != nil { + entry.Misc["Ipv6InheritedNeighborDiscoveryDnsServerSourceManual"] = o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Misc + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = []Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer{} + for _, oIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer := range o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server { + nestedIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer := Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer{} + if oIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Misc != nil { + entry.Misc["Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer"] = oIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Misc + } + if oIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name != "" { + nestedIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name = oIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Name + } + if oIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime != nil { + nestedIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime = oIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer.Lifetime + } + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server = append(nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source.Manual.Server, nestedIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer) + } + } + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6 = &Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6{} + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc != nil { + entry.Misc["Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6"] = o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.Misc + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool = o.Ipv6.Inherited.NeighborDiscovery.DnsServer.Source.Dhcpv6.PrefixPool + } + } + } + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix = &Ipv6InheritedNeighborDiscoveryDnsSuffix{} + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Misc != nil { + entry.Misc["Ipv6InheritedNeighborDiscoveryDnsSuffix"] = o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Misc + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source = &Ipv6InheritedNeighborDiscoveryDnsSuffixSource{} + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Misc != nil { + entry.Misc["Ipv6InheritedNeighborDiscoveryDnsSuffixSource"] = o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Misc + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6 = &Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6{} + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc != nil { + entry.Misc["Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6"] = o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.Misc + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool = o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Dhcpv6.PrefixPool + } + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual = &Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual{} + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Misc != nil { + entry.Misc["Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual"] = o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Misc + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = []Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix{} + for _, oIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := range o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix { + nestedIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix := Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix{} + if oIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc != nil { + entry.Misc["Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix"] = oIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Misc + } + if oIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name != "" { + nestedIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name = oIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Name + } + if oIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime != nil { + nestedIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime = oIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix.Lifetime + } + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix = append(nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Source.Manual.Suffix, nestedIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix) + } + } + } + } + if o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable != nil { + nestedIpv6.Inherited.NeighborDiscovery.DnsSuffix.Enable = util.AsBool(o.Ipv6.Inherited.NeighborDiscovery.DnsSuffix.Enable, nil) + } + } + if o.Ipv6.Inherited.NeighborDiscovery.EnableDad != nil { + nestedIpv6.Inherited.NeighborDiscovery.EnableDad = util.AsBool(o.Ipv6.Inherited.NeighborDiscovery.EnableDad, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery.Neighbor != nil { + nestedIpv6.Inherited.NeighborDiscovery.Neighbor = []Ipv6InheritedNeighborDiscoveryNeighbor{} + for _, oIpv6InheritedNeighborDiscoveryNeighbor := range o.Ipv6.Inherited.NeighborDiscovery.Neighbor { + nestedIpv6InheritedNeighborDiscoveryNeighbor := Ipv6InheritedNeighborDiscoveryNeighbor{} + if oIpv6InheritedNeighborDiscoveryNeighbor.Misc != nil { + entry.Misc["Ipv6InheritedNeighborDiscoveryNeighbor"] = oIpv6InheritedNeighborDiscoveryNeighbor.Misc + } + if oIpv6InheritedNeighborDiscoveryNeighbor.HwAddress != nil { + nestedIpv6InheritedNeighborDiscoveryNeighbor.HwAddress = oIpv6InheritedNeighborDiscoveryNeighbor.HwAddress + } + if oIpv6InheritedNeighborDiscoveryNeighbor.Name != "" { + nestedIpv6InheritedNeighborDiscoveryNeighbor.Name = oIpv6InheritedNeighborDiscoveryNeighbor.Name + } + nestedIpv6.Inherited.NeighborDiscovery.Neighbor = append(nestedIpv6.Inherited.NeighborDiscovery.Neighbor, nestedIpv6InheritedNeighborDiscoveryNeighbor) + } + } + if o.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor != nil { + nestedIpv6.Inherited.NeighborDiscovery.EnableNdpMonitor = util.AsBool(o.Ipv6.Inherited.NeighborDiscovery.EnableNdpMonitor, nil) + } + if o.Ipv6.Inherited.NeighborDiscovery.ReachableTime != nil { + nestedIpv6.Inherited.NeighborDiscovery.ReachableTime = o.Ipv6.Inherited.NeighborDiscovery.ReachableTime + } + } + } + if o.Ipv6.Address != nil { + nestedIpv6.Address = []Ipv6Address{} + for _, oIpv6Address := range o.Ipv6.Address { + nestedIpv6Address := Ipv6Address{} + if oIpv6Address.Misc != nil { + entry.Misc["Ipv6Address"] = oIpv6Address.Misc + } + if oIpv6Address.Prefix != nil { + nestedIpv6Address.Prefix = &Ipv6AddressPrefix{} + if oIpv6Address.Prefix.Misc != nil { + entry.Misc["Ipv6AddressPrefix"] = oIpv6Address.Prefix.Misc + } + } + if oIpv6Address.Anycast != nil { + nestedIpv6Address.Anycast = &Ipv6AddressAnycast{} + if oIpv6Address.Anycast.Misc != nil { + entry.Misc["Ipv6AddressAnycast"] = oIpv6Address.Anycast.Misc + } + } + if oIpv6Address.Advertise != nil { + nestedIpv6Address.Advertise = &Ipv6AddressAdvertise{} + if oIpv6Address.Advertise.Misc != nil { + entry.Misc["Ipv6AddressAdvertise"] = oIpv6Address.Advertise.Misc + } + if oIpv6Address.Advertise.Enable != nil { + nestedIpv6Address.Advertise.Enable = util.AsBool(oIpv6Address.Advertise.Enable, nil) + } + if oIpv6Address.Advertise.ValidLifetime != nil { + nestedIpv6Address.Advertise.ValidLifetime = oIpv6Address.Advertise.ValidLifetime + } + if oIpv6Address.Advertise.PreferredLifetime != nil { + nestedIpv6Address.Advertise.PreferredLifetime = oIpv6Address.Advertise.PreferredLifetime + } + if oIpv6Address.Advertise.OnlinkFlag != nil { + nestedIpv6Address.Advertise.OnlinkFlag = util.AsBool(oIpv6Address.Advertise.OnlinkFlag, nil) + } + if oIpv6Address.Advertise.AutoConfigFlag != nil { + nestedIpv6Address.Advertise.AutoConfigFlag = util.AsBool(oIpv6Address.Advertise.AutoConfigFlag, nil) + } + } + if oIpv6Address.Name != "" { + nestedIpv6Address.Name = oIpv6Address.Name + } + if oIpv6Address.EnableOnInterface != nil { + nestedIpv6Address.EnableOnInterface = util.AsBool(oIpv6Address.EnableOnInterface, nil) + } + nestedIpv6.Address = append(nestedIpv6.Address, nestedIpv6Address) + } + } + } + entry.Ipv6 = nestedIpv6 + + entry.Mtu = o.Mtu + var nestedNdpProxy *NdpProxy + if o.NdpProxy != nil { + nestedNdpProxy = &NdpProxy{} + if o.NdpProxy.Misc != nil { + entry.Misc["NdpProxy"] = o.NdpProxy.Misc + } + if o.NdpProxy.Address != nil { + nestedNdpProxy.Address = []NdpProxyAddress{} + for _, oNdpProxyAddress := range o.NdpProxy.Address { + nestedNdpProxyAddress := NdpProxyAddress{} + if oNdpProxyAddress.Misc != nil { + entry.Misc["NdpProxyAddress"] = oNdpProxyAddress.Misc + } + if oNdpProxyAddress.Negate != nil { + nestedNdpProxyAddress.Negate = util.AsBool(oNdpProxyAddress.Negate, nil) + } + if oNdpProxyAddress.Name != "" { + nestedNdpProxyAddress.Name = oNdpProxyAddress.Name + } + nestedNdpProxy.Address = append(nestedNdpProxy.Address, nestedNdpProxyAddress) + } + } + if o.NdpProxy.Enabled != nil { + nestedNdpProxy.Enabled = util.AsBool(o.NdpProxy.Enabled, nil) + } + } + entry.NdpProxy = nestedNdpProxy + + entry.NetflowProfile = o.NetflowProfile + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !matchAdjustTcpMss(a.AdjustTcpMss, b.AdjustTcpMss) { + return false + } + if !matchArp(a.Arp, b.Arp) { + return false + } + if !matchBonjour(a.Bonjour, b.Bonjour) { + return false + } + if !util.StringsMatch(a.Comment, b.Comment) { + return false + } + if !matchDdnsConfig(a.DdnsConfig, b.DdnsConfig) { + return false + } + if !util.BoolsMatch(a.DfIgnore, b.DfIgnore) { + return false + } + if !matchDhcpClient(a.DhcpClient, b.DhcpClient) { + return false + } + if !util.StringsMatch(a.InterfaceManagementProfile, b.InterfaceManagementProfile) { + return false + } + if !matchIp(a.Ip, b.Ip) { + return false + } + if !matchIpv6(a.Ipv6, b.Ipv6) { + return false + } + if !util.Ints64Match(a.Mtu, b.Mtu) { + return false + } + if !matchNdpProxy(a.NdpProxy, b.NdpProxy) { + return false + } + if !util.StringsMatch(a.NetflowProfile, b.NetflowProfile) { + return false + } + + return true +} + +func matchArp(a []Arp, b []Arp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.HwAddress, b.HwAddress) { + return false + } + if !util.StringsMatch(a.Interface, b.Interface) { + return false + } + } + } + return true +} +func matchBonjour(a *Bonjour, b *Bonjour) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.GroupId, b.GroupId) { + return false + } + if !util.BoolsMatch(a.TtlCheck, b.TtlCheck) { + return false + } + return true +} +func matchDdnsConfigDdnsVendorConfig(a []DdnsConfigDdnsVendorConfig, b []DdnsConfigDdnsVendorConfig) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.Value, b.Value) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchDdnsConfig(a *DdnsConfig, b *DdnsConfig) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchDdnsConfigDdnsVendorConfig(a.DdnsVendorConfig, b.DdnsVendorConfig) { + return false + } + if !util.StringsMatch(a.DdnsCertProfile, b.DdnsCertProfile) { + return false + } + if !util.BoolsMatch(a.DdnsEnabled, b.DdnsEnabled) { + return false + } + if !util.StringsMatch(a.DdnsHostname, b.DdnsHostname) { + return false + } + if !util.OrderedListsMatch(a.DdnsIp, b.DdnsIp) { + return false + } + if !util.OrderedListsMatch(a.DdnsIpv6, b.DdnsIpv6) { + return false + } + if !util.Ints64Match(a.DdnsUpdateInterval, b.DdnsUpdateInterval) { + return false + } + if !util.StringsMatch(a.DdnsVendor, b.DdnsVendor) { + return false + } + return true +} +func matchDhcpClientSendHostname(a *DhcpClientSendHostname, b *DhcpClientSendHostname) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.StringsMatch(a.Hostname, b.Hostname) { + return false + } + return true +} +func matchDhcpClient(a *DhcpClient, b *DhcpClient) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.CreateDefaultRoute, b.CreateDefaultRoute) { + return false + } + if !util.Ints64Match(a.DefaultRouteMetric, b.DefaultRouteMetric) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchDhcpClientSendHostname(a.SendHostname, b.SendHostname) { + return false + } + return true +} +func matchNdpProxyAddress(a []NdpProxyAddress, b []NdpProxyAddress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.BoolsMatch(a.Negate, b.Negate) { + return false + } + } + } + return true +} +func matchNdpProxy(a *NdpProxy, b *NdpProxy) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enabled, b.Enabled) { + return false + } + if !matchNdpProxyAddress(a.Address, b.Address) { + return false + } + return true +} +func matchAdjustTcpMss(a *AdjustTcpMss, b *AdjustTcpMss) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.Ipv4MssAdjustment, b.Ipv4MssAdjustment) { + return false + } + if !util.Ints64Match(a.Ipv6MssAdjustment, b.Ipv6MssAdjustment) { + return false + } + return true +} +func matchIp(a []Ip, b []Ip) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchIpv6AddressAdvertise(a *Ipv6AddressAdvertise, b *Ipv6AddressAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.ValidLifetime, b.ValidLifetime) { + return false + } + if !util.StringsMatch(a.PreferredLifetime, b.PreferredLifetime) { + return false + } + if !util.BoolsMatch(a.OnlinkFlag, b.OnlinkFlag) { + return false + } + if !util.BoolsMatch(a.AutoConfigFlag, b.AutoConfigFlag) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + return true +} +func matchIpv6AddressPrefix(a *Ipv6AddressPrefix, b *Ipv6AddressPrefix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchIpv6AddressAnycast(a *Ipv6AddressAnycast, b *Ipv6AddressAnycast) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchIpv6Address(a []Ipv6Address, b []Ipv6Address) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !matchIpv6AddressAdvertise(a.Advertise, b.Advertise) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.BoolsMatch(a.EnableOnInterface, b.EnableOnInterface) { + return false + } + if !matchIpv6AddressPrefix(a.Prefix, b.Prefix) { + return false + } + if !matchIpv6AddressAnycast(a.Anycast, b.Anycast) { + return false + } + } + } + return true +} +func matchIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer(a []Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer, b []Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix(a []Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix, b []Ipv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchIpv6NeighborDiscoveryRouterAdvertisementDnsSupport(a *Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport, b *Ipv6NeighborDiscoveryRouterAdvertisementDnsSupport) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6NeighborDiscoveryRouterAdvertisementDnsSupportSuffix(a.Suffix, b.Suffix) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchIpv6NeighborDiscoveryRouterAdvertisementDnsSupportServer(a.Server, b.Server) { + return false + } + return true +} +func matchIpv6NeighborDiscoveryRouterAdvertisement(a *Ipv6NeighborDiscoveryRouterAdvertisement, b *Ipv6NeighborDiscoveryRouterAdvertisement) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.HopLimit, b.HopLimit) { + return false + } + if !util.StringsMatch(a.LinkMtu, b.LinkMtu) { + return false + } + if !util.Ints64Match(a.MaxInterval, b.MaxInterval) { + return false + } + if !util.BoolsMatch(a.OtherFlag, b.OtherFlag) { + return false + } + if !util.StringsMatch(a.RetransmissionTimer, b.RetransmissionTimer) { + return false + } + if !util.StringsMatch(a.RouterPreference, b.RouterPreference) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.BoolsMatch(a.EnableConsistencyCheck, b.EnableConsistencyCheck) { + return false + } + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.BoolsMatch(a.ManagedFlag, b.ManagedFlag) { + return false + } + if !util.Ints64Match(a.MinInterval, b.MinInterval) { + return false + } + if !util.StringsMatch(a.ReachableTime, b.ReachableTime) { + return false + } + if !matchIpv6NeighborDiscoveryRouterAdvertisementDnsSupport(a.DnsSupport, b.DnsSupport) { + return false + } + return true +} +func matchIpv6NeighborDiscoveryNeighbor(a []Ipv6NeighborDiscoveryNeighbor, b []Ipv6NeighborDiscoveryNeighbor) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.HwAddress, b.HwAddress) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchIpv6NeighborDiscovery(a *Ipv6NeighborDiscovery, b *Ipv6NeighborDiscovery) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6NeighborDiscoveryNeighbor(a.Neighbor, b.Neighbor) { + return false + } + if !util.Ints64Match(a.NsInterval, b.NsInterval) { + return false + } + if !util.Ints64Match(a.ReachableTime, b.ReachableTime) { + return false + } + if !matchIpv6NeighborDiscoveryRouterAdvertisement(a.RouterAdvertisement, b.RouterAdvertisement) { + return false + } + if !util.Ints64Match(a.DadAttempts, b.DadAttempts) { + return false + } + if !util.BoolsMatch(a.EnableDad, b.EnableDad) { + return false + } + if !util.BoolsMatch(a.EnableNdpMonitor, b.EnableNdpMonitor) { + return false + } + return true +} +func matchIpv6DhcpClientPrefixDelegationEnableNo(a *Ipv6DhcpClientPrefixDelegationEnableNo, b *Ipv6DhcpClientPrefixDelegationEnableNo) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchIpv6DhcpClientPrefixDelegationEnableYes(a *Ipv6DhcpClientPrefixDelegationEnableYes, b *Ipv6DhcpClientPrefixDelegationEnableYes) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.PrefixLenHint, b.PrefixLenHint) { + return false + } + if !util.StringsMatch(a.PfxPoolName, b.PfxPoolName) { + return false + } + if !util.Ints64Match(a.PrefixLen, b.PrefixLen) { + return false + } + return true +} +func matchIpv6DhcpClientPrefixDelegationEnable(a *Ipv6DhcpClientPrefixDelegationEnable, b *Ipv6DhcpClientPrefixDelegationEnable) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6DhcpClientPrefixDelegationEnableNo(a.No, b.No) { + return false + } + if !matchIpv6DhcpClientPrefixDelegationEnableYes(a.Yes, b.Yes) { + return false + } + return true +} +func matchIpv6DhcpClientPrefixDelegation(a *Ipv6DhcpClientPrefixDelegation, b *Ipv6DhcpClientPrefixDelegation) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6DhcpClientPrefixDelegationEnable(a.Enable, b.Enable) { + return false + } + return true +} +func matchIpv6DhcpClientV6OptionsEnableNo(a *Ipv6DhcpClientV6OptionsEnableNo, b *Ipv6DhcpClientV6OptionsEnableNo) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchIpv6DhcpClientV6OptionsEnableYes(a *Ipv6DhcpClientV6OptionsEnableYes, b *Ipv6DhcpClientV6OptionsEnableYes) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.NonTempAddr, b.NonTempAddr) { + return false + } + if !util.BoolsMatch(a.TempAddr, b.TempAddr) { + return false + } + return true +} +func matchIpv6DhcpClientV6OptionsEnable(a *Ipv6DhcpClientV6OptionsEnable, b *Ipv6DhcpClientV6OptionsEnable) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6DhcpClientV6OptionsEnableNo(a.No, b.No) { + return false + } + if !matchIpv6DhcpClientV6OptionsEnableYes(a.Yes, b.Yes) { + return false + } + return true +} +func matchIpv6DhcpClientV6Options(a *Ipv6DhcpClientV6Options, b *Ipv6DhcpClientV6Options) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.RapidCommit, b.RapidCommit) { + return false + } + if !util.BoolsMatch(a.SupportSrvrReconfig, b.SupportSrvrReconfig) { + return false + } + if !util.StringsMatch(a.DuidType, b.DuidType) { + return false + } + if !matchIpv6DhcpClientV6OptionsEnable(a.Enable, b.Enable) { + return false + } + return true +} +func matchIpv6DhcpClientNeighborDiscoveryNeighbor(a []Ipv6DhcpClientNeighborDiscoveryNeighbor, b []Ipv6DhcpClientNeighborDiscoveryNeighbor) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.HwAddress, b.HwAddress) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchIpv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6(a *Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6, b *Ipv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer(a []Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer, b []Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchIpv6DhcpClientNeighborDiscoveryDnsServerSourceManual(a *Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual, b *Ipv6DhcpClientNeighborDiscoveryDnsServerSourceManual) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6DhcpClientNeighborDiscoveryDnsServerSourceManualServer(a.Server, b.Server) { + return false + } + return true +} +func matchIpv6DhcpClientNeighborDiscoveryDnsServerSource(a *Ipv6DhcpClientNeighborDiscoveryDnsServerSource, b *Ipv6DhcpClientNeighborDiscoveryDnsServerSource) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6DhcpClientNeighborDiscoveryDnsServerSourceDhcpv6(a.Dhcpv6, b.Dhcpv6) { + return false + } + if !matchIpv6DhcpClientNeighborDiscoveryDnsServerSourceManual(a.Manual, b.Manual) { + return false + } + return true +} +func matchIpv6DhcpClientNeighborDiscoveryDnsServer(a *Ipv6DhcpClientNeighborDiscoveryDnsServer, b *Ipv6DhcpClientNeighborDiscoveryDnsServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6DhcpClientNeighborDiscoveryDnsServerSource(a.Source, b.Source) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + return true +} +func matchIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6(a *Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6, b *Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix(a []Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix, b []Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual(a *Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual, b *Ipv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManualSuffix(a.Suffix, b.Suffix) { + return false + } + return true +} +func matchIpv6DhcpClientNeighborDiscoveryDnsSuffixSource(a *Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource, b *Ipv6DhcpClientNeighborDiscoveryDnsSuffixSource) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceDhcpv6(a.Dhcpv6, b.Dhcpv6) { + return false + } + if !matchIpv6DhcpClientNeighborDiscoveryDnsSuffixSourceManual(a.Manual, b.Manual) { + return false + } + return true +} +func matchIpv6DhcpClientNeighborDiscoveryDnsSuffix(a *Ipv6DhcpClientNeighborDiscoveryDnsSuffix, b *Ipv6DhcpClientNeighborDiscoveryDnsSuffix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchIpv6DhcpClientNeighborDiscoveryDnsSuffixSource(a.Source, b.Source) { + return false + } + return true +} +func matchIpv6DhcpClientNeighborDiscovery(a *Ipv6DhcpClientNeighborDiscovery, b *Ipv6DhcpClientNeighborDiscovery) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.NsInterval, b.NsInterval) { + return false + } + if !util.Ints64Match(a.ReachableTime, b.ReachableTime) { + return false + } + if !util.Ints64Match(a.DadAttempts, b.DadAttempts) { + return false + } + if !matchIpv6DhcpClientNeighborDiscoveryDnsServer(a.DnsServer, b.DnsServer) { + return false + } + if !matchIpv6DhcpClientNeighborDiscoveryDnsSuffix(a.DnsSuffix, b.DnsSuffix) { + return false + } + if !util.BoolsMatch(a.EnableDad, b.EnableDad) { + return false + } + if !util.BoolsMatch(a.EnableNdpMonitor, b.EnableNdpMonitor) { + return false + } + if !matchIpv6DhcpClientNeighborDiscoveryNeighbor(a.Neighbor, b.Neighbor) { + return false + } + return true +} +func matchIpv6DhcpClient(a *Ipv6DhcpClient, b *Ipv6DhcpClient) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.DefaultRouteMetric, b.DefaultRouteMetric) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchIpv6DhcpClientNeighborDiscovery(a.NeighborDiscovery, b.NeighborDiscovery) { + return false + } + if !util.StringsMatch(a.Preference, b.Preference) { + return false + } + if !matchIpv6DhcpClientPrefixDelegation(a.PrefixDelegation, b.PrefixDelegation) { + return false + } + if !matchIpv6DhcpClientV6Options(a.V6Options, b.V6Options) { + return false + } + if !util.BoolsMatch(a.AcceptRaRoute, b.AcceptRaRoute) { + return false + } + return true +} +func matchIpv6InheritedAssignAddrTypeGuaPoolTypeDynamic(a *Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic, b *Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamic) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchIpv6InheritedAssignAddrTypeGuaPoolTypeDynamicId(a *Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId, b *Ipv6InheritedAssignAddrTypeGuaPoolTypeDynamicId) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Identifier, b.Identifier) { + return false + } + return true +} +func matchIpv6InheritedAssignAddrTypeGuaPoolType(a *Ipv6InheritedAssignAddrTypeGuaPoolType, b *Ipv6InheritedAssignAddrTypeGuaPoolType) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6InheritedAssignAddrTypeGuaPoolTypeDynamic(a.Dynamic, b.Dynamic) { + return false + } + if !matchIpv6InheritedAssignAddrTypeGuaPoolTypeDynamicId(a.DynamicId, b.DynamicId) { + return false + } + return true +} +func matchIpv6InheritedAssignAddrTypeGuaAdvertise(a *Ipv6InheritedAssignAddrTypeGuaAdvertise, b *Ipv6InheritedAssignAddrTypeGuaAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.OnlinkFlag, b.OnlinkFlag) { + return false + } + if !util.BoolsMatch(a.AutoConfigFlag, b.AutoConfigFlag) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + return true +} +func matchIpv6InheritedAssignAddrTypeGua(a *Ipv6InheritedAssignAddrTypeGua, b *Ipv6InheritedAssignAddrTypeGua) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.EnableOnInterface, b.EnableOnInterface) { + return false + } + if !util.StringsMatch(a.PrefixPool, b.PrefixPool) { + return false + } + if !matchIpv6InheritedAssignAddrTypeGuaPoolType(a.PoolType, b.PoolType) { + return false + } + if !matchIpv6InheritedAssignAddrTypeGuaAdvertise(a.Advertise, b.Advertise) { + return false + } + return true +} +func matchIpv6InheritedAssignAddrTypeUlaAdvertise(a *Ipv6InheritedAssignAddrTypeUlaAdvertise, b *Ipv6InheritedAssignAddrTypeUlaAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.PreferredLifetime, b.PreferredLifetime) { + return false + } + if !util.BoolsMatch(a.OnlinkFlag, b.OnlinkFlag) { + return false + } + if !util.BoolsMatch(a.AutoConfigFlag, b.AutoConfigFlag) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.StringsMatch(a.ValidLifetime, b.ValidLifetime) { + return false + } + return true +} +func matchIpv6InheritedAssignAddrTypeUla(a *Ipv6InheritedAssignAddrTypeUla, b *Ipv6InheritedAssignAddrTypeUla) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6InheritedAssignAddrTypeUlaAdvertise(a.Advertise, b.Advertise) { + return false + } + if !util.BoolsMatch(a.EnableOnInterface, b.EnableOnInterface) { + return false + } + if !util.StringsMatch(a.Address, b.Address) { + return false + } + if !util.BoolsMatch(a.Prefix, b.Prefix) { + return false + } + if !util.BoolsMatch(a.Anycast, b.Anycast) { + return false + } + return true +} +func matchIpv6InheritedAssignAddrType(a *Ipv6InheritedAssignAddrType, b *Ipv6InheritedAssignAddrType) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6InheritedAssignAddrTypeGua(a.Gua, b.Gua) { + return false + } + if !matchIpv6InheritedAssignAddrTypeUla(a.Ula, b.Ula) { + return false + } + return true +} +func matchIpv6InheritedAssignAddr(a []Ipv6InheritedAssignAddr, b []Ipv6InheritedAssignAddr) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !matchIpv6InheritedAssignAddrType(a.Type, b.Type) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchIpv6InheritedNeighborDiscoveryRouterAdvertisement(a *Ipv6InheritedNeighborDiscoveryRouterAdvertisement, b *Ipv6InheritedNeighborDiscoveryRouterAdvertisement) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.ManagedFlag, b.ManagedFlag) { + return false + } + if !util.BoolsMatch(a.OtherFlag, b.OtherFlag) { + return false + } + if !util.StringsMatch(a.RetransmissionTimer, b.RetransmissionTimer) { + return false + } + if !util.StringsMatch(a.RouterPreference, b.RouterPreference) { + return false + } + if !util.StringsMatch(a.LinkMtu, b.LinkMtu) { + return false + } + if !util.Ints64Match(a.MaxInterval, b.MaxInterval) { + return false + } + if !util.Ints64Match(a.MinInterval, b.MinInterval) { + return false + } + if !util.StringsMatch(a.ReachableTime, b.ReachableTime) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.BoolsMatch(a.EnableConsistencyCheck, b.EnableConsistencyCheck) { + return false + } + if !util.StringsMatch(a.HopLimit, b.HopLimit) { + return false + } + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + return true +} +func matchIpv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6(a *Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6, b *Ipv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.PrefixPool, b.PrefixPool) { + return false + } + return true +} +func matchIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer(a []Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer, b []Ipv6InheritedNeighborDiscoveryDnsServerSourceManualServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchIpv6InheritedNeighborDiscoveryDnsServerSourceManual(a *Ipv6InheritedNeighborDiscoveryDnsServerSourceManual, b *Ipv6InheritedNeighborDiscoveryDnsServerSourceManual) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6InheritedNeighborDiscoveryDnsServerSourceManualServer(a.Server, b.Server) { + return false + } + return true +} +func matchIpv6InheritedNeighborDiscoveryDnsServerSource(a *Ipv6InheritedNeighborDiscoveryDnsServerSource, b *Ipv6InheritedNeighborDiscoveryDnsServerSource) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6InheritedNeighborDiscoveryDnsServerSourceDhcpv6(a.Dhcpv6, b.Dhcpv6) { + return false + } + if !matchIpv6InheritedNeighborDiscoveryDnsServerSourceManual(a.Manual, b.Manual) { + return false + } + return true +} +func matchIpv6InheritedNeighborDiscoveryDnsServer(a *Ipv6InheritedNeighborDiscoveryDnsServer, b *Ipv6InheritedNeighborDiscoveryDnsServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchIpv6InheritedNeighborDiscoveryDnsServerSource(a.Source, b.Source) { + return false + } + return true +} +func matchIpv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6(a *Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6, b *Ipv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.PrefixPool, b.PrefixPool) { + return false + } + return true +} +func matchIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix(a []Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix, b []Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Lifetime, b.Lifetime) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchIpv6InheritedNeighborDiscoveryDnsSuffixSourceManual(a *Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual, b *Ipv6InheritedNeighborDiscoveryDnsSuffixSourceManual) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6InheritedNeighborDiscoveryDnsSuffixSourceManualSuffix(a.Suffix, b.Suffix) { + return false + } + return true +} +func matchIpv6InheritedNeighborDiscoveryDnsSuffixSource(a *Ipv6InheritedNeighborDiscoveryDnsSuffixSource, b *Ipv6InheritedNeighborDiscoveryDnsSuffixSource) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6InheritedNeighborDiscoveryDnsSuffixSourceDhcpv6(a.Dhcpv6, b.Dhcpv6) { + return false + } + if !matchIpv6InheritedNeighborDiscoveryDnsSuffixSourceManual(a.Manual, b.Manual) { + return false + } + return true +} +func matchIpv6InheritedNeighborDiscoveryDnsSuffix(a *Ipv6InheritedNeighborDiscoveryDnsSuffix, b *Ipv6InheritedNeighborDiscoveryDnsSuffix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchIpv6InheritedNeighborDiscoveryDnsSuffixSource(a.Source, b.Source) { + return false + } + return true +} +func matchIpv6InheritedNeighborDiscoveryNeighbor(a []Ipv6InheritedNeighborDiscoveryNeighbor, b []Ipv6InheritedNeighborDiscoveryNeighbor) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.HwAddress, b.HwAddress) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchIpv6InheritedNeighborDiscovery(a *Ipv6InheritedNeighborDiscovery, b *Ipv6InheritedNeighborDiscovery) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.DadAttempts, b.DadAttempts) { + return false + } + if !matchIpv6InheritedNeighborDiscoveryDnsServer(a.DnsServer, b.DnsServer) { + return false + } + if !matchIpv6InheritedNeighborDiscoveryDnsSuffix(a.DnsSuffix, b.DnsSuffix) { + return false + } + if !util.BoolsMatch(a.EnableDad, b.EnableDad) { + return false + } + if !matchIpv6InheritedNeighborDiscoveryNeighbor(a.Neighbor, b.Neighbor) { + return false + } + if !util.Ints64Match(a.NsInterval, b.NsInterval) { + return false + } + if !matchIpv6InheritedNeighborDiscoveryRouterAdvertisement(a.RouterAdvertisement, b.RouterAdvertisement) { + return false + } + if !util.BoolsMatch(a.EnableNdpMonitor, b.EnableNdpMonitor) { + return false + } + if !util.Ints64Match(a.ReachableTime, b.ReachableTime) { + return false + } + return true +} +func matchIpv6Inherited(a *Ipv6Inherited, b *Ipv6Inherited) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6InheritedAssignAddr(a.AssignAddr, b.AssignAddr) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchIpv6InheritedNeighborDiscovery(a.NeighborDiscovery, b.NeighborDiscovery) { + return false + } + return true +} +func matchIpv6(a *Ipv6, b *Ipv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchIpv6Address(a.Address, b.Address) { + return false + } + if !util.BoolsMatch(a.Enabled, b.Enabled) { + return false + } + if !util.StringsMatch(a.InterfaceId, b.InterfaceId) { + return false + } + if !matchIpv6NeighborDiscovery(a.NeighborDiscovery, b.NeighborDiscovery) { + return false + } + if !matchIpv6DhcpClient(a.DhcpClient, b.DhcpClient) { + return false + } + if !matchIpv6Inherited(a.Inherited, b.Inherited) { + return false + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/network/interface/vlan/interfaces.go b/network/interface/vlan/interfaces.go new file mode 100644 index 00000000..c04654b3 --- /dev/null +++ b/network/interface/vlan/interfaces.go @@ -0,0 +1,7 @@ +package vlan + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/network/interface/vlan/location.go b/network/interface/vlan/location.go new file mode 100644 index 00000000..9b264b7c --- /dev/null +++ b/network/interface/vlan/location.go @@ -0,0 +1,200 @@ +package vlan + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + Ngfw *NgfwLocation `json:"ngfw,omitempty"` + Shared bool `json:"shared"` + Template *TemplateLocation `json:"template,omitempty"` + TemplateStack *TemplateStackLocation `json:"template_stack,omitempty"` +} + +type NgfwLocation struct { + NgfwDevice string `json:"ngfw_device"` +} + +type TemplateLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + Template string `json:"template"` +} + +type TemplateStackLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + TemplateStack string `json:"template_stack"` +} + +func NewNgfwLocation() *Location { + return &Location{Ngfw: &NgfwLocation{ + NgfwDevice: "localhost.localdomain", + }, + } +} +func NewSharedLocation() *Location { + return &Location{ + Shared: true, + } +} +func NewTemplateLocation() *Location { + return &Location{Template: &TemplateLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + Template: "", + }, + } +} +func NewTemplateStackLocation() *Location { + return &Location{TemplateStack: &TemplateStackLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + TemplateStack: "", + }, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.Ngfw != nil: + if o.Ngfw.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + count++ + case o.Shared: + count++ + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return fmt.Errorf("Template is unspecified") + } + count++ + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return fmt.Errorf("TemplateStack is unspecified") + } + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.Ngfw != nil: + if o.Ngfw.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Ngfw.NgfwDevice}), + } + case o.Shared: + ans = []string{ + "config", + "shared", + } + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return nil, fmt.Errorf("Template is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Template.PanoramaDevice}), + "template", + util.AsEntryXpath([]string{o.Template.Template}), + "config", + "devices", + util.AsEntryXpath([]string{o.Template.NgfwDevice}), + } + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return nil, fmt.Errorf("TemplateStack is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.PanoramaDevice}), + "template-stack", + util.AsEntryXpath([]string{o.TemplateStack.TemplateStack}), + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.NgfwDevice}), + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/network/interface/vlan/service.go b/network/interface/vlan/service.go new file mode 100644 index 00000000..d0e9ac3a --- /dev/null +++ b/network/interface/vlan/service.go @@ -0,0 +1,281 @@ +package vlan + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/network/profiles/interface_management/entry.go b/network/profiles/interface_management/entry.go index e69baefa..ce004eb9 100644 --- a/network/profiles/interface_management/entry.go +++ b/network/profiles/interface_management/entry.go @@ -23,7 +23,7 @@ type Entry struct { Http *bool HttpOcsp *bool Https *bool - PermittedIps []string + PermittedIp []PermittedIp Ping *bool ResponsePages *bool Snmp *bool @@ -36,25 +36,35 @@ type Entry struct { Misc map[string][]generic.Xml } +type PermittedIp struct { + Name string +} + type entryXmlContainer struct { Answer []entryXml `xml:"entry"` } type entryXml struct { - XMLName xml.Name `xml:"entry"` - Name string `xml:"name,attr"` - Http *string `xml:"http,omitempty"` - HttpOcsp *string `xml:"http-ocsp,omitempty"` - Https *string `xml:"https,omitempty"` - PermittedIps *util.EntryType `xml:"permitted-ip,omitempty"` - Ping *string `xml:"ping,omitempty"` - ResponsePages *string `xml:"response-pages,omitempty"` - Snmp *string `xml:"snmp,omitempty"` - Ssh *string `xml:"ssh,omitempty"` - Telnet *string `xml:"telnet,omitempty"` - UseridService *string `xml:"userid-service,omitempty"` - UseridSyslogListenerSsl *string `xml:"userid-syslog-listener-ssl,omitempty"` - UseridSyslogListenerUdp *string `xml:"userid-syslog-listener-udp,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Http *string `xml:"http,omitempty"` + HttpOcsp *string `xml:"http-ocsp,omitempty"` + Https *string `xml:"https,omitempty"` + PermittedIp []PermittedIpXml `xml:"permitted-ip>entry,omitempty"` + Ping *string `xml:"ping,omitempty"` + ResponsePages *string `xml:"response-pages,omitempty"` + Snmp *string `xml:"snmp,omitempty"` + Ssh *string `xml:"ssh,omitempty"` + Telnet *string `xml:"telnet,omitempty"` + UseridService *string `xml:"userid-service,omitempty"` + UseridSyslogListenerSsl *string `xml:"userid-syslog-listener-ssl,omitempty"` + UseridSyslogListenerUdp *string `xml:"userid-syslog-listener-udp,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type PermittedIpXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` Misc []generic.Xml `xml:",any"` } @@ -72,11 +82,11 @@ func (e *Entry) Field(v string) (any, error) { if v == "https" || v == "Https" { return e.Https, nil } - if v == "permitted_ips" || v == "PermittedIps" { - return e.PermittedIps, nil + if v == "permitted_ip" || v == "PermittedIp" { + return e.PermittedIp, nil } - if v == "permitted_ips|LENGTH" || v == "PermittedIps|LENGTH" { - return int64(len(e.PermittedIps)), nil + if v == "permitted_ip|LENGTH" || v == "PermittedIp|LENGTH" { + return int64(len(e.PermittedIp)), nil } if v == "ping" || v == "Ping" { return e.Ping, nil @@ -107,17 +117,31 @@ func (e *Entry) Field(v string) (any, error) { } func Versioning(vn version.Number) (Specifier, Normalizer, error) { + return specifyEntry, &entryXmlContainer{}, nil } - func specifyEntry(o *Entry) (any, error) { entry := entryXml{} - entry.Name = o.Name entry.Http = util.YesNo(o.Http, nil) entry.HttpOcsp = util.YesNo(o.HttpOcsp, nil) entry.Https = util.YesNo(o.Https, nil) - entry.PermittedIps = util.StrToEnt(o.PermittedIps) + var nestedPermittedIpCol []PermittedIpXml + if o.PermittedIp != nil { + nestedPermittedIpCol = []PermittedIpXml{} + for _, oPermittedIp := range o.PermittedIp { + nestedPermittedIp := PermittedIpXml{} + if _, ok := o.Misc["PermittedIp"]; ok { + nestedPermittedIp.Misc = o.Misc["PermittedIp"] + } + if oPermittedIp.Name != "" { + nestedPermittedIp.Name = oPermittedIp.Name + } + nestedPermittedIpCol = append(nestedPermittedIpCol, nestedPermittedIp) + } + entry.PermittedIp = nestedPermittedIpCol + } + entry.Ping = util.YesNo(o.Ping, nil) entry.ResponsePages = util.YesNo(o.ResponsePages, nil) entry.Snmp = util.YesNo(o.Snmp, nil) @@ -131,6 +155,7 @@ func specifyEntry(o *Entry) (any, error) { return entry, nil } + func (c *entryXmlContainer) Normalize() ([]*Entry, error) { entryList := make([]*Entry, 0, len(c.Answer)) for _, o := range c.Answer { @@ -141,7 +166,22 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { entry.Http = util.AsBool(o.Http, nil) entry.HttpOcsp = util.AsBool(o.HttpOcsp, nil) entry.Https = util.AsBool(o.Https, nil) - entry.PermittedIps = util.EntToStr(o.PermittedIps) + var nestedPermittedIpCol []PermittedIp + if o.PermittedIp != nil { + nestedPermittedIpCol = []PermittedIp{} + for _, oPermittedIp := range o.PermittedIp { + nestedPermittedIp := PermittedIp{} + if oPermittedIp.Misc != nil { + entry.Misc["PermittedIp"] = oPermittedIp.Misc + } + if oPermittedIp.Name != "" { + nestedPermittedIp.Name = oPermittedIp.Name + } + nestedPermittedIpCol = append(nestedPermittedIpCol, nestedPermittedIp) + } + entry.PermittedIp = nestedPermittedIpCol + } + entry.Ping = util.AsBool(o.Ping, nil) entry.ResponsePages = util.AsBool(o.ResponsePages, nil) entry.Snmp = util.AsBool(o.Snmp, nil) @@ -176,7 +216,7 @@ func SpecMatches(a, b *Entry) bool { if !util.BoolsMatch(a.Https, b.Https) { return false } - if !util.OrderedListsMatch(a.PermittedIps, b.PermittedIps) { + if !matchPermittedIp(a.PermittedIp, b.PermittedIp) { return false } if !util.BoolsMatch(a.Ping, b.Ping) { @@ -207,6 +247,22 @@ func SpecMatches(a, b *Entry) bool { return true } +func matchPermittedIp(a []PermittedIp, b []PermittedIp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} + func (o *Entry) EntryName() string { return o.Name } diff --git a/network/tunnel/ipsec/entry.go b/network/tunnel/ipsec/entry.go new file mode 100644 index 00000000..41f519b3 --- /dev/null +++ b/network/tunnel/ipsec/entry.go @@ -0,0 +1,3072 @@ +package ipsec + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"network", "tunnel", "ipsec"} +) + +type Entry struct { + Name string + AntiReplay *bool + AntiReplayWindow *string + Comment *string + CopyFlowLabel *bool + CopyTos *bool + Disabled *bool + EnableGreEncapsulation *bool + IpsecMode *string + Ipv6 *bool + TunnelInterface *string + TunnelMonitor *TunnelMonitor + AutoKey *AutoKey + GlobalProtectSatellite *GlobalProtectSatellite + ManualKey *ManualKey + + Misc map[string][]generic.Xml +} + +type AutoKey struct { + IkeGateway []AutoKeyIkeGateway + IpsecCryptoProfile *string + ProxyId []AutoKeyProxyId + ProxyIdV6 []AutoKeyProxyIdV6 +} +type AutoKeyIkeGateway struct { + Name string +} +type AutoKeyProxyId struct { + Local *string + Name string + Protocol *AutoKeyProxyIdProtocol + Remote *string +} +type AutoKeyProxyIdProtocol struct { + Any *AutoKeyProxyIdProtocolAny + Number *int64 + Tcp *AutoKeyProxyIdProtocolTcp + Udp *AutoKeyProxyIdProtocolUdp +} +type AutoKeyProxyIdProtocolAny struct { +} +type AutoKeyProxyIdProtocolTcp struct { + LocalPort *int64 + RemotePort *int64 +} +type AutoKeyProxyIdProtocolUdp struct { + LocalPort *int64 + RemotePort *int64 +} +type AutoKeyProxyIdV6 struct { + Local *string + Name string + Protocol *AutoKeyProxyIdV6Protocol + Remote *string +} +type AutoKeyProxyIdV6Protocol struct { + Any *AutoKeyProxyIdV6ProtocolAny + Number *int64 + Tcp *AutoKeyProxyIdV6ProtocolTcp + Udp *AutoKeyProxyIdV6ProtocolUdp +} +type AutoKeyProxyIdV6ProtocolAny struct { +} +type AutoKeyProxyIdV6ProtocolTcp struct { + LocalPort *int64 + RemotePort *int64 +} +type AutoKeyProxyIdV6ProtocolUdp struct { + LocalPort *int64 + RemotePort *int64 +} +type GlobalProtectSatellite struct { + ExternalCa *GlobalProtectSatelliteExternalCa + Ipv6Preferred *bool + LocalAddress *GlobalProtectSatelliteLocalAddress + PortalAddress *string + PublishConnectedRoutes *GlobalProtectSatellitePublishConnectedRoutes + PublishRoutes []string +} +type GlobalProtectSatelliteExternalCa struct { + CertificateProfile *string + LocalCertificate *string +} +type GlobalProtectSatelliteLocalAddress struct { + Interface *string + FloatingIp *GlobalProtectSatelliteLocalAddressFloatingIp + Ip *GlobalProtectSatelliteLocalAddressIp +} +type GlobalProtectSatelliteLocalAddressFloatingIp struct { + Ipv4 *string + Ipv6 *string +} +type GlobalProtectSatelliteLocalAddressIp struct { + Ipv4 *string + Ipv6 *string +} +type GlobalProtectSatellitePublishConnectedRoutes struct { + Enable *bool +} +type ManualKey struct { + LocalAddress *ManualKeyLocalAddress + LocalSpi *string + PeerAddress *ManualKeyPeerAddress + RemoteSpi *string + Ah *ManualKeyAh + Esp *ManualKeyEsp +} +type ManualKeyAh struct { + Md5 *ManualKeyAhMd5 + Sha1 *ManualKeyAhSha1 + Sha256 *ManualKeyAhSha256 + Sha384 *ManualKeyAhSha384 + Sha512 *ManualKeyAhSha512 +} +type ManualKeyAhMd5 struct { + Key *string +} +type ManualKeyAhSha1 struct { + Key *string +} +type ManualKeyAhSha256 struct { + Key *string +} +type ManualKeyAhSha384 struct { + Key *string +} +type ManualKeyAhSha512 struct { + Key *string +} +type ManualKeyEsp struct { + Authentication *ManualKeyEspAuthentication + Encryption *ManualKeyEspEncryption +} +type ManualKeyEspAuthentication struct { + Md5 *ManualKeyEspAuthenticationMd5 + None *ManualKeyEspAuthenticationNone + Sha1 *ManualKeyEspAuthenticationSha1 + Sha256 *ManualKeyEspAuthenticationSha256 + Sha384 *ManualKeyEspAuthenticationSha384 + Sha512 *ManualKeyEspAuthenticationSha512 +} +type ManualKeyEspAuthenticationMd5 struct { + Key *string +} +type ManualKeyEspAuthenticationNone struct { +} +type ManualKeyEspAuthenticationSha1 struct { + Key *string +} +type ManualKeyEspAuthenticationSha256 struct { + Key *string +} +type ManualKeyEspAuthenticationSha384 struct { + Key *string +} +type ManualKeyEspAuthenticationSha512 struct { + Key *string +} +type ManualKeyEspEncryption struct { + Algorithm *string + Key *string +} +type ManualKeyLocalAddress struct { + Interface *string + FloatingIp *string + Ip *string +} +type ManualKeyPeerAddress struct { + Ip *string +} +type TunnelMonitor struct { + DestinationIp *string + Enable *bool + ProxyId *string + TunnelMonitorProfile *string +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXmlContainer_11_0_2 struct { + Answer []entryXml_11_0_2 `xml:"entry"` +} +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + AntiReplay *string `xml:"anti-replay,omitempty"` + AntiReplayWindow *string `xml:"anti-replay-window,omitempty"` + Comment *string `xml:"comment,omitempty"` + CopyFlowLabel *string `xml:"copy-flow-label,omitempty"` + CopyTos *string `xml:"copy-tos,omitempty"` + Disabled *string `xml:"disabled,omitempty"` + EnableGreEncapsulation *string `xml:"enable-gre-encapsulation,omitempty"` + IpsecMode *string `xml:"ipsec-mode,omitempty"` + Ipv6 *string `xml:"ipv6,omitempty"` + TunnelInterface *string `xml:"tunnel-interface,omitempty"` + TunnelMonitor *TunnelMonitorXml `xml:"tunnel-monitor,omitempty"` + AutoKey *AutoKeyXml `xml:"auto-key,omitempty"` + GlobalProtectSatellite *GlobalProtectSatelliteXml `xml:"global-protect-satellite,omitempty"` + ManualKey *ManualKeyXml `xml:"manual-key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type entryXml_11_0_2 struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + AntiReplay *string `xml:"anti-replay,omitempty"` + AntiReplayWindow *string `xml:"anti-replay-window,omitempty"` + Comment *string `xml:"comment,omitempty"` + CopyFlowLabel *string `xml:"copy-flow-label,omitempty"` + CopyTos *string `xml:"copy-tos,omitempty"` + Disabled *string `xml:"disabled,omitempty"` + EnableGreEncapsulation *string `xml:"enable-gre-encapsulation,omitempty"` + IpsecMode *string `xml:"ipsec-mode,omitempty"` + Ipv6 *string `xml:"ipv6,omitempty"` + TunnelInterface *string `xml:"tunnel-interface,omitempty"` + TunnelMonitor *TunnelMonitorXml_11_0_2 `xml:"tunnel-monitor,omitempty"` + AutoKey *AutoKeyXml_11_0_2 `xml:"auto-key,omitempty"` + GlobalProtectSatellite *GlobalProtectSatelliteXml_11_0_2 `xml:"global-protect-satellite,omitempty"` + ManualKey *ManualKeyXml_11_0_2 `xml:"manual-key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyXml struct { + IkeGateway []AutoKeyIkeGatewayXml `xml:"ike-gateway>entry,omitempty"` + IpsecCryptoProfile *string `xml:"ipsec-crypto-profile,omitempty"` + ProxyId []AutoKeyProxyIdXml `xml:"proxy-id>entry,omitempty"` + ProxyIdV6 []AutoKeyProxyIdV6Xml `xml:"proxy-id-v6>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyIkeGatewayXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdXml struct { + Local *string `xml:"local,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Protocol *AutoKeyProxyIdProtocolXml `xml:"protocol,omitempty"` + Remote *string `xml:"remote,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdProtocolXml struct { + Any *AutoKeyProxyIdProtocolAnyXml `xml:"any,omitempty"` + Number *int64 `xml:"number,omitempty"` + Tcp *AutoKeyProxyIdProtocolTcpXml `xml:"tcp,omitempty"` + Udp *AutoKeyProxyIdProtocolUdpXml `xml:"udp,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdProtocolAnyXml struct { + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdProtocolTcpXml struct { + LocalPort *int64 `xml:"local-port,omitempty"` + RemotePort *int64 `xml:"remote-port,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdProtocolUdpXml struct { + LocalPort *int64 `xml:"local-port,omitempty"` + RemotePort *int64 `xml:"remote-port,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdV6Xml struct { + Local *string `xml:"local,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Protocol *AutoKeyProxyIdV6ProtocolXml `xml:"protocol,omitempty"` + Remote *string `xml:"remote,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdV6ProtocolXml struct { + Any *AutoKeyProxyIdV6ProtocolAnyXml `xml:"any,omitempty"` + Number *int64 `xml:"number,omitempty"` + Tcp *AutoKeyProxyIdV6ProtocolTcpXml `xml:"tcp,omitempty"` + Udp *AutoKeyProxyIdV6ProtocolUdpXml `xml:"udp,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdV6ProtocolAnyXml struct { + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdV6ProtocolTcpXml struct { + LocalPort *int64 `xml:"local-port,omitempty"` + RemotePort *int64 `xml:"remote-port,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdV6ProtocolUdpXml struct { + LocalPort *int64 `xml:"local-port,omitempty"` + RemotePort *int64 `xml:"remote-port,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type GlobalProtectSatelliteXml struct { + ExternalCa *GlobalProtectSatelliteExternalCaXml `xml:"external-ca,omitempty"` + Ipv6Preferred *string `xml:"ipv6-preferred,omitempty"` + LocalAddress *GlobalProtectSatelliteLocalAddressXml `xml:"local-address,omitempty"` + PortalAddress *string `xml:"portal-address,omitempty"` + PublishConnectedRoutes *GlobalProtectSatellitePublishConnectedRoutesXml `xml:"publish-connected-routes,omitempty"` + PublishRoutes *util.MemberType `xml:"publish-routes,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type GlobalProtectSatelliteExternalCaXml struct { + CertificateProfile *string `xml:"certificate-profile,omitempty"` + LocalCertificate *string `xml:"local-certificate,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type GlobalProtectSatelliteLocalAddressXml struct { + Interface *string `xml:"interface,omitempty"` + FloatingIp *GlobalProtectSatelliteLocalAddressFloatingIpXml `xml:"floating-ip,omitempty"` + Ip *GlobalProtectSatelliteLocalAddressIpXml `xml:"ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type GlobalProtectSatelliteLocalAddressFloatingIpXml struct { + Ipv4 *string `xml:"ipv4,omitempty"` + Ipv6 *string `xml:"ipv6,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type GlobalProtectSatelliteLocalAddressIpXml struct { + Ipv4 *string `xml:"ipv4,omitempty"` + Ipv6 *string `xml:"ipv6,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type GlobalProtectSatellitePublishConnectedRoutesXml struct { + Enable *string `xml:"enable,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyXml struct { + LocalAddress *ManualKeyLocalAddressXml `xml:"local-address,omitempty"` + LocalSpi *string `xml:"local-spi,omitempty"` + PeerAddress *ManualKeyPeerAddressXml `xml:"peer-address,omitempty"` + RemoteSpi *string `xml:"remote-spi,omitempty"` + Ah *ManualKeyAhXml `xml:"ah,omitempty"` + Esp *ManualKeyEspXml `xml:"esp,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyAhXml struct { + Md5 *ManualKeyAhMd5Xml `xml:"md5,omitempty"` + Sha1 *ManualKeyAhSha1Xml `xml:"sha1,omitempty"` + Sha256 *ManualKeyAhSha256Xml `xml:"sha256,omitempty"` + Sha384 *ManualKeyAhSha384Xml `xml:"sha384,omitempty"` + Sha512 *ManualKeyAhSha512Xml `xml:"sha512,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyAhMd5Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyAhSha1Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyAhSha256Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyAhSha384Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyAhSha512Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspXml struct { + Authentication *ManualKeyEspAuthenticationXml `xml:"authentication,omitempty"` + Encryption *ManualKeyEspEncryptionXml `xml:"encryption,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspAuthenticationXml struct { + Md5 *ManualKeyEspAuthenticationMd5Xml `xml:"md5,omitempty"` + None *ManualKeyEspAuthenticationNoneXml `xml:"none,omitempty"` + Sha1 *ManualKeyEspAuthenticationSha1Xml `xml:"sha1,omitempty"` + Sha256 *ManualKeyEspAuthenticationSha256Xml `xml:"sha256,omitempty"` + Sha384 *ManualKeyEspAuthenticationSha384Xml `xml:"sha384,omitempty"` + Sha512 *ManualKeyEspAuthenticationSha512Xml `xml:"sha512,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspAuthenticationMd5Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspAuthenticationNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspAuthenticationSha1Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspAuthenticationSha256Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspAuthenticationSha384Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspAuthenticationSha512Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspEncryptionXml struct { + Algorithm *string `xml:"algorithm,omitempty"` + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyLocalAddressXml struct { + Interface *string `xml:"interface,omitempty"` + FloatingIp *string `xml:"floating-ip,omitempty"` + Ip *string `xml:"ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyPeerAddressXml struct { + Ip *string `xml:"ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TunnelMonitorXml struct { + DestinationIp *string `xml:"destination-ip,omitempty"` + Enable *string `xml:"enable,omitempty"` + ProxyId *string `xml:"proxy-id,omitempty"` + TunnelMonitorProfile *string `xml:"tunnel-monitor-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyXml_11_0_2 struct { + IkeGateway []AutoKeyIkeGatewayXml_11_0_2 `xml:"ike-gateway>entry,omitempty"` + IpsecCryptoProfile *string `xml:"ipsec-crypto-profile,omitempty"` + ProxyId []AutoKeyProxyIdXml_11_0_2 `xml:"proxy-id>entry,omitempty"` + ProxyIdV6 []AutoKeyProxyIdV6Xml_11_0_2 `xml:"proxy-id-v6>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyIkeGatewayXml_11_0_2 struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdXml_11_0_2 struct { + Local *string `xml:"local,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Protocol *AutoKeyProxyIdProtocolXml_11_0_2 `xml:"protocol,omitempty"` + Remote *string `xml:"remote,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdProtocolXml_11_0_2 struct { + Any *AutoKeyProxyIdProtocolAnyXml_11_0_2 `xml:"any,omitempty"` + Number *int64 `xml:"number,omitempty"` + Tcp *AutoKeyProxyIdProtocolTcpXml_11_0_2 `xml:"tcp,omitempty"` + Udp *AutoKeyProxyIdProtocolUdpXml_11_0_2 `xml:"udp,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdProtocolAnyXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdProtocolTcpXml_11_0_2 struct { + LocalPort *int64 `xml:"local-port,omitempty"` + RemotePort *int64 `xml:"remote-port,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdProtocolUdpXml_11_0_2 struct { + LocalPort *int64 `xml:"local-port,omitempty"` + RemotePort *int64 `xml:"remote-port,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdV6Xml_11_0_2 struct { + Local *string `xml:"local,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Protocol *AutoKeyProxyIdV6ProtocolXml_11_0_2 `xml:"protocol,omitempty"` + Remote *string `xml:"remote,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdV6ProtocolXml_11_0_2 struct { + Any *AutoKeyProxyIdV6ProtocolAnyXml_11_0_2 `xml:"any,omitempty"` + Number *int64 `xml:"number,omitempty"` + Tcp *AutoKeyProxyIdV6ProtocolTcpXml_11_0_2 `xml:"tcp,omitempty"` + Udp *AutoKeyProxyIdV6ProtocolUdpXml_11_0_2 `xml:"udp,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdV6ProtocolAnyXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdV6ProtocolTcpXml_11_0_2 struct { + LocalPort *int64 `xml:"local-port,omitempty"` + RemotePort *int64 `xml:"remote-port,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AutoKeyProxyIdV6ProtocolUdpXml_11_0_2 struct { + LocalPort *int64 `xml:"local-port,omitempty"` + RemotePort *int64 `xml:"remote-port,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type GlobalProtectSatelliteXml_11_0_2 struct { + ExternalCa *GlobalProtectSatelliteExternalCaXml_11_0_2 `xml:"external-ca,omitempty"` + Ipv6Preferred *string `xml:"ipv6-preferred,omitempty"` + LocalAddress *GlobalProtectSatelliteLocalAddressXml_11_0_2 `xml:"local-address,omitempty"` + PortalAddress *string `xml:"portal-address,omitempty"` + PublishConnectedRoutes *GlobalProtectSatellitePublishConnectedRoutesXml_11_0_2 `xml:"publish-connected-routes,omitempty"` + PublishRoutes *util.MemberType `xml:"publish-routes,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type GlobalProtectSatelliteExternalCaXml_11_0_2 struct { + CertificateProfile *string `xml:"certificate-profile,omitempty"` + LocalCertificate *string `xml:"local-certificate,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type GlobalProtectSatelliteLocalAddressXml_11_0_2 struct { + Interface *string `xml:"interface,omitempty"` + FloatingIp *GlobalProtectSatelliteLocalAddressFloatingIpXml_11_0_2 `xml:"floating-ip,omitempty"` + Ip *GlobalProtectSatelliteLocalAddressIpXml_11_0_2 `xml:"ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type GlobalProtectSatelliteLocalAddressFloatingIpXml_11_0_2 struct { + Ipv4 *string `xml:"ipv4,omitempty"` + Ipv6 *string `xml:"ipv6,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type GlobalProtectSatelliteLocalAddressIpXml_11_0_2 struct { + Ipv4 *string `xml:"ipv4,omitempty"` + Ipv6 *string `xml:"ipv6,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type GlobalProtectSatellitePublishConnectedRoutesXml_11_0_2 struct { + Enable *string `xml:"enable,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyXml_11_0_2 struct { + LocalAddress *ManualKeyLocalAddressXml_11_0_2 `xml:"local-address,omitempty"` + LocalSpi *string `xml:"local-spi,omitempty"` + PeerAddress *ManualKeyPeerAddressXml_11_0_2 `xml:"peer-address,omitempty"` + RemoteSpi *string `xml:"remote-spi,omitempty"` + Ah *ManualKeyAhXml_11_0_2 `xml:"ah,omitempty"` + Esp *ManualKeyEspXml_11_0_2 `xml:"esp,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyAhXml_11_0_2 struct { + Md5 *ManualKeyAhMd5Xml_11_0_2 `xml:"md5,omitempty"` + Sha1 *ManualKeyAhSha1Xml_11_0_2 `xml:"sha1,omitempty"` + Sha256 *ManualKeyAhSha256Xml_11_0_2 `xml:"sha256,omitempty"` + Sha384 *ManualKeyAhSha384Xml_11_0_2 `xml:"sha384,omitempty"` + Sha512 *ManualKeyAhSha512Xml_11_0_2 `xml:"sha512,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyAhMd5Xml_11_0_2 struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyAhSha1Xml_11_0_2 struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyAhSha256Xml_11_0_2 struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyAhSha384Xml_11_0_2 struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyAhSha512Xml_11_0_2 struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspXml_11_0_2 struct { + Authentication *ManualKeyEspAuthenticationXml_11_0_2 `xml:"authentication,omitempty"` + Encryption *ManualKeyEspEncryptionXml_11_0_2 `xml:"encryption,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspAuthenticationXml_11_0_2 struct { + Md5 *ManualKeyEspAuthenticationMd5Xml_11_0_2 `xml:"md5,omitempty"` + None *ManualKeyEspAuthenticationNoneXml_11_0_2 `xml:"none,omitempty"` + Sha1 *ManualKeyEspAuthenticationSha1Xml_11_0_2 `xml:"sha1,omitempty"` + Sha256 *ManualKeyEspAuthenticationSha256Xml_11_0_2 `xml:"sha256,omitempty"` + Sha384 *ManualKeyEspAuthenticationSha384Xml_11_0_2 `xml:"sha384,omitempty"` + Sha512 *ManualKeyEspAuthenticationSha512Xml_11_0_2 `xml:"sha512,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspAuthenticationMd5Xml_11_0_2 struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspAuthenticationNoneXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspAuthenticationSha1Xml_11_0_2 struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspAuthenticationSha256Xml_11_0_2 struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspAuthenticationSha384Xml_11_0_2 struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspAuthenticationSha512Xml_11_0_2 struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyEspEncryptionXml_11_0_2 struct { + Algorithm *string `xml:"algorithm,omitempty"` + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyLocalAddressXml_11_0_2 struct { + Interface *string `xml:"interface,omitempty"` + FloatingIp *string `xml:"floating-ip,omitempty"` + Ip *string `xml:"ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ManualKeyPeerAddressXml_11_0_2 struct { + Ip *string `xml:"ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TunnelMonitorXml_11_0_2 struct { + DestinationIp *string `xml:"destination-ip,omitempty"` + Enable *string `xml:"enable,omitempty"` + ProxyId *string `xml:"proxy-id,omitempty"` + TunnelMonitorProfile *string `xml:"tunnel-monitor-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "anti_replay" || v == "AntiReplay" { + return e.AntiReplay, nil + } + if v == "anti_replay_window" || v == "AntiReplayWindow" { + return e.AntiReplayWindow, nil + } + if v == "comment" || v == "Comment" { + return e.Comment, nil + } + if v == "copy_flow_label" || v == "CopyFlowLabel" { + return e.CopyFlowLabel, nil + } + if v == "copy_tos" || v == "CopyTos" { + return e.CopyTos, nil + } + if v == "disabled" || v == "Disabled" { + return e.Disabled, nil + } + if v == "enable_gre_encapsulation" || v == "EnableGreEncapsulation" { + return e.EnableGreEncapsulation, nil + } + if v == "ipsec_mode" || v == "IpsecMode" { + return e.IpsecMode, nil + } + if v == "ipv6" || v == "Ipv6" { + return e.Ipv6, nil + } + if v == "tunnel_interface" || v == "TunnelInterface" { + return e.TunnelInterface, nil + } + if v == "tunnel_monitor" || v == "TunnelMonitor" { + return e.TunnelMonitor, nil + } + if v == "auto_key" || v == "AutoKey" { + return e.AutoKey, nil + } + if v == "global_protect_satellite" || v == "GlobalProtectSatellite" { + return e.GlobalProtectSatellite, nil + } + if v == "manual_key" || v == "ManualKey" { + return e.ManualKey, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + version_11_0_2, _ := version.New("11.0.2") + version_11_1_0, _ := version.New("11.1.0") + if vn.Gte(version_11_0_2) && vn.Lt(version_11_1_0) { + return specifyEntry_11_0_2, &entryXmlContainer_11_0_2{}, nil + } + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.AntiReplay = util.YesNo(o.AntiReplay, nil) + entry.AntiReplayWindow = o.AntiReplayWindow + entry.Comment = o.Comment + entry.CopyFlowLabel = util.YesNo(o.CopyFlowLabel, nil) + entry.CopyTos = util.YesNo(o.CopyTos, nil) + entry.Disabled = util.YesNo(o.Disabled, nil) + entry.EnableGreEncapsulation = util.YesNo(o.EnableGreEncapsulation, nil) + entry.IpsecMode = o.IpsecMode + entry.Ipv6 = util.YesNo(o.Ipv6, nil) + entry.TunnelInterface = o.TunnelInterface + var nestedTunnelMonitor *TunnelMonitorXml + if o.TunnelMonitor != nil { + nestedTunnelMonitor = &TunnelMonitorXml{} + if _, ok := o.Misc["TunnelMonitor"]; ok { + nestedTunnelMonitor.Misc = o.Misc["TunnelMonitor"] + } + if o.TunnelMonitor.DestinationIp != nil { + nestedTunnelMonitor.DestinationIp = o.TunnelMonitor.DestinationIp + } + if o.TunnelMonitor.Enable != nil { + nestedTunnelMonitor.Enable = util.YesNo(o.TunnelMonitor.Enable, nil) + } + if o.TunnelMonitor.ProxyId != nil { + nestedTunnelMonitor.ProxyId = o.TunnelMonitor.ProxyId + } + if o.TunnelMonitor.TunnelMonitorProfile != nil { + nestedTunnelMonitor.TunnelMonitorProfile = o.TunnelMonitor.TunnelMonitorProfile + } + } + entry.TunnelMonitor = nestedTunnelMonitor + + var nestedAutoKey *AutoKeyXml + if o.AutoKey != nil { + nestedAutoKey = &AutoKeyXml{} + if _, ok := o.Misc["AutoKey"]; ok { + nestedAutoKey.Misc = o.Misc["AutoKey"] + } + if o.AutoKey.IkeGateway != nil { + nestedAutoKey.IkeGateway = []AutoKeyIkeGatewayXml{} + for _, oAutoKeyIkeGateway := range o.AutoKey.IkeGateway { + nestedAutoKeyIkeGateway := AutoKeyIkeGatewayXml{} + if _, ok := o.Misc["AutoKeyIkeGateway"]; ok { + nestedAutoKeyIkeGateway.Misc = o.Misc["AutoKeyIkeGateway"] + } + if oAutoKeyIkeGateway.Name != "" { + nestedAutoKeyIkeGateway.Name = oAutoKeyIkeGateway.Name + } + nestedAutoKey.IkeGateway = append(nestedAutoKey.IkeGateway, nestedAutoKeyIkeGateway) + } + } + if o.AutoKey.IpsecCryptoProfile != nil { + nestedAutoKey.IpsecCryptoProfile = o.AutoKey.IpsecCryptoProfile + } + if o.AutoKey.ProxyId != nil { + nestedAutoKey.ProxyId = []AutoKeyProxyIdXml{} + for _, oAutoKeyProxyId := range o.AutoKey.ProxyId { + nestedAutoKeyProxyId := AutoKeyProxyIdXml{} + if _, ok := o.Misc["AutoKeyProxyId"]; ok { + nestedAutoKeyProxyId.Misc = o.Misc["AutoKeyProxyId"] + } + if oAutoKeyProxyId.Local != nil { + nestedAutoKeyProxyId.Local = oAutoKeyProxyId.Local + } + if oAutoKeyProxyId.Remote != nil { + nestedAutoKeyProxyId.Remote = oAutoKeyProxyId.Remote + } + if oAutoKeyProxyId.Protocol != nil { + nestedAutoKeyProxyId.Protocol = &AutoKeyProxyIdProtocolXml{} + if _, ok := o.Misc["AutoKeyProxyIdProtocol"]; ok { + nestedAutoKeyProxyId.Protocol.Misc = o.Misc["AutoKeyProxyIdProtocol"] + } + if oAutoKeyProxyId.Protocol.Number != nil { + nestedAutoKeyProxyId.Protocol.Number = oAutoKeyProxyId.Protocol.Number + } + if oAutoKeyProxyId.Protocol.Any != nil { + nestedAutoKeyProxyId.Protocol.Any = &AutoKeyProxyIdProtocolAnyXml{} + if _, ok := o.Misc["AutoKeyProxyIdProtocolAny"]; ok { + nestedAutoKeyProxyId.Protocol.Any.Misc = o.Misc["AutoKeyProxyIdProtocolAny"] + } + } + if oAutoKeyProxyId.Protocol.Tcp != nil { + nestedAutoKeyProxyId.Protocol.Tcp = &AutoKeyProxyIdProtocolTcpXml{} + if _, ok := o.Misc["AutoKeyProxyIdProtocolTcp"]; ok { + nestedAutoKeyProxyId.Protocol.Tcp.Misc = o.Misc["AutoKeyProxyIdProtocolTcp"] + } + if oAutoKeyProxyId.Protocol.Tcp.LocalPort != nil { + nestedAutoKeyProxyId.Protocol.Tcp.LocalPort = oAutoKeyProxyId.Protocol.Tcp.LocalPort + } + if oAutoKeyProxyId.Protocol.Tcp.RemotePort != nil { + nestedAutoKeyProxyId.Protocol.Tcp.RemotePort = oAutoKeyProxyId.Protocol.Tcp.RemotePort + } + } + if oAutoKeyProxyId.Protocol.Udp != nil { + nestedAutoKeyProxyId.Protocol.Udp = &AutoKeyProxyIdProtocolUdpXml{} + if _, ok := o.Misc["AutoKeyProxyIdProtocolUdp"]; ok { + nestedAutoKeyProxyId.Protocol.Udp.Misc = o.Misc["AutoKeyProxyIdProtocolUdp"] + } + if oAutoKeyProxyId.Protocol.Udp.LocalPort != nil { + nestedAutoKeyProxyId.Protocol.Udp.LocalPort = oAutoKeyProxyId.Protocol.Udp.LocalPort + } + if oAutoKeyProxyId.Protocol.Udp.RemotePort != nil { + nestedAutoKeyProxyId.Protocol.Udp.RemotePort = oAutoKeyProxyId.Protocol.Udp.RemotePort + } + } + } + if oAutoKeyProxyId.Name != "" { + nestedAutoKeyProxyId.Name = oAutoKeyProxyId.Name + } + nestedAutoKey.ProxyId = append(nestedAutoKey.ProxyId, nestedAutoKeyProxyId) + } + } + if o.AutoKey.ProxyIdV6 != nil { + nestedAutoKey.ProxyIdV6 = []AutoKeyProxyIdV6Xml{} + for _, oAutoKeyProxyIdV6 := range o.AutoKey.ProxyIdV6 { + nestedAutoKeyProxyIdV6 := AutoKeyProxyIdV6Xml{} + if _, ok := o.Misc["AutoKeyProxyIdV6"]; ok { + nestedAutoKeyProxyIdV6.Misc = o.Misc["AutoKeyProxyIdV6"] + } + if oAutoKeyProxyIdV6.Protocol != nil { + nestedAutoKeyProxyIdV6.Protocol = &AutoKeyProxyIdV6ProtocolXml{} + if _, ok := o.Misc["AutoKeyProxyIdV6Protocol"]; ok { + nestedAutoKeyProxyIdV6.Protocol.Misc = o.Misc["AutoKeyProxyIdV6Protocol"] + } + if oAutoKeyProxyIdV6.Protocol.Tcp != nil { + nestedAutoKeyProxyIdV6.Protocol.Tcp = &AutoKeyProxyIdV6ProtocolTcpXml{} + if _, ok := o.Misc["AutoKeyProxyIdV6ProtocolTcp"]; ok { + nestedAutoKeyProxyIdV6.Protocol.Tcp.Misc = o.Misc["AutoKeyProxyIdV6ProtocolTcp"] + } + if oAutoKeyProxyIdV6.Protocol.Tcp.LocalPort != nil { + nestedAutoKeyProxyIdV6.Protocol.Tcp.LocalPort = oAutoKeyProxyIdV6.Protocol.Tcp.LocalPort + } + if oAutoKeyProxyIdV6.Protocol.Tcp.RemotePort != nil { + nestedAutoKeyProxyIdV6.Protocol.Tcp.RemotePort = oAutoKeyProxyIdV6.Protocol.Tcp.RemotePort + } + } + if oAutoKeyProxyIdV6.Protocol.Udp != nil { + nestedAutoKeyProxyIdV6.Protocol.Udp = &AutoKeyProxyIdV6ProtocolUdpXml{} + if _, ok := o.Misc["AutoKeyProxyIdV6ProtocolUdp"]; ok { + nestedAutoKeyProxyIdV6.Protocol.Udp.Misc = o.Misc["AutoKeyProxyIdV6ProtocolUdp"] + } + if oAutoKeyProxyIdV6.Protocol.Udp.LocalPort != nil { + nestedAutoKeyProxyIdV6.Protocol.Udp.LocalPort = oAutoKeyProxyIdV6.Protocol.Udp.LocalPort + } + if oAutoKeyProxyIdV6.Protocol.Udp.RemotePort != nil { + nestedAutoKeyProxyIdV6.Protocol.Udp.RemotePort = oAutoKeyProxyIdV6.Protocol.Udp.RemotePort + } + } + if oAutoKeyProxyIdV6.Protocol.Number != nil { + nestedAutoKeyProxyIdV6.Protocol.Number = oAutoKeyProxyIdV6.Protocol.Number + } + if oAutoKeyProxyIdV6.Protocol.Any != nil { + nestedAutoKeyProxyIdV6.Protocol.Any = &AutoKeyProxyIdV6ProtocolAnyXml{} + if _, ok := o.Misc["AutoKeyProxyIdV6ProtocolAny"]; ok { + nestedAutoKeyProxyIdV6.Protocol.Any.Misc = o.Misc["AutoKeyProxyIdV6ProtocolAny"] + } + } + } + if oAutoKeyProxyIdV6.Name != "" { + nestedAutoKeyProxyIdV6.Name = oAutoKeyProxyIdV6.Name + } + if oAutoKeyProxyIdV6.Local != nil { + nestedAutoKeyProxyIdV6.Local = oAutoKeyProxyIdV6.Local + } + if oAutoKeyProxyIdV6.Remote != nil { + nestedAutoKeyProxyIdV6.Remote = oAutoKeyProxyIdV6.Remote + } + nestedAutoKey.ProxyIdV6 = append(nestedAutoKey.ProxyIdV6, nestedAutoKeyProxyIdV6) + } + } + } + entry.AutoKey = nestedAutoKey + + var nestedGlobalProtectSatellite *GlobalProtectSatelliteXml + if o.GlobalProtectSatellite != nil { + nestedGlobalProtectSatellite = &GlobalProtectSatelliteXml{} + if _, ok := o.Misc["GlobalProtectSatellite"]; ok { + nestedGlobalProtectSatellite.Misc = o.Misc["GlobalProtectSatellite"] + } + if o.GlobalProtectSatellite.PublishRoutes != nil { + nestedGlobalProtectSatellite.PublishRoutes = util.StrToMem(o.GlobalProtectSatellite.PublishRoutes) + } + if o.GlobalProtectSatellite.ExternalCa != nil { + nestedGlobalProtectSatellite.ExternalCa = &GlobalProtectSatelliteExternalCaXml{} + if _, ok := o.Misc["GlobalProtectSatelliteExternalCa"]; ok { + nestedGlobalProtectSatellite.ExternalCa.Misc = o.Misc["GlobalProtectSatelliteExternalCa"] + } + if o.GlobalProtectSatellite.ExternalCa.CertificateProfile != nil { + nestedGlobalProtectSatellite.ExternalCa.CertificateProfile = o.GlobalProtectSatellite.ExternalCa.CertificateProfile + } + if o.GlobalProtectSatellite.ExternalCa.LocalCertificate != nil { + nestedGlobalProtectSatellite.ExternalCa.LocalCertificate = o.GlobalProtectSatellite.ExternalCa.LocalCertificate + } + } + if o.GlobalProtectSatellite.Ipv6Preferred != nil { + nestedGlobalProtectSatellite.Ipv6Preferred = util.YesNo(o.GlobalProtectSatellite.Ipv6Preferred, nil) + } + if o.GlobalProtectSatellite.LocalAddress != nil { + nestedGlobalProtectSatellite.LocalAddress = &GlobalProtectSatelliteLocalAddressXml{} + if _, ok := o.Misc["GlobalProtectSatelliteLocalAddress"]; ok { + nestedGlobalProtectSatellite.LocalAddress.Misc = o.Misc["GlobalProtectSatelliteLocalAddress"] + } + if o.GlobalProtectSatellite.LocalAddress.Interface != nil { + nestedGlobalProtectSatellite.LocalAddress.Interface = o.GlobalProtectSatellite.LocalAddress.Interface + } + if o.GlobalProtectSatellite.LocalAddress.FloatingIp != nil { + nestedGlobalProtectSatellite.LocalAddress.FloatingIp = &GlobalProtectSatelliteLocalAddressFloatingIpXml{} + if _, ok := o.Misc["GlobalProtectSatelliteLocalAddressFloatingIp"]; ok { + nestedGlobalProtectSatellite.LocalAddress.FloatingIp.Misc = o.Misc["GlobalProtectSatelliteLocalAddressFloatingIp"] + } + if o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv4 != nil { + nestedGlobalProtectSatellite.LocalAddress.FloatingIp.Ipv4 = o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv4 + } + if o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv6 != nil { + nestedGlobalProtectSatellite.LocalAddress.FloatingIp.Ipv6 = o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv6 + } + } + if o.GlobalProtectSatellite.LocalAddress.Ip != nil { + nestedGlobalProtectSatellite.LocalAddress.Ip = &GlobalProtectSatelliteLocalAddressIpXml{} + if _, ok := o.Misc["GlobalProtectSatelliteLocalAddressIp"]; ok { + nestedGlobalProtectSatellite.LocalAddress.Ip.Misc = o.Misc["GlobalProtectSatelliteLocalAddressIp"] + } + if o.GlobalProtectSatellite.LocalAddress.Ip.Ipv4 != nil { + nestedGlobalProtectSatellite.LocalAddress.Ip.Ipv4 = o.GlobalProtectSatellite.LocalAddress.Ip.Ipv4 + } + if o.GlobalProtectSatellite.LocalAddress.Ip.Ipv6 != nil { + nestedGlobalProtectSatellite.LocalAddress.Ip.Ipv6 = o.GlobalProtectSatellite.LocalAddress.Ip.Ipv6 + } + } + } + if o.GlobalProtectSatellite.PortalAddress != nil { + nestedGlobalProtectSatellite.PortalAddress = o.GlobalProtectSatellite.PortalAddress + } + if o.GlobalProtectSatellite.PublishConnectedRoutes != nil { + nestedGlobalProtectSatellite.PublishConnectedRoutes = &GlobalProtectSatellitePublishConnectedRoutesXml{} + if _, ok := o.Misc["GlobalProtectSatellitePublishConnectedRoutes"]; ok { + nestedGlobalProtectSatellite.PublishConnectedRoutes.Misc = o.Misc["GlobalProtectSatellitePublishConnectedRoutes"] + } + if o.GlobalProtectSatellite.PublishConnectedRoutes.Enable != nil { + nestedGlobalProtectSatellite.PublishConnectedRoutes.Enable = util.YesNo(o.GlobalProtectSatellite.PublishConnectedRoutes.Enable, nil) + } + } + } + entry.GlobalProtectSatellite = nestedGlobalProtectSatellite + + var nestedManualKey *ManualKeyXml + if o.ManualKey != nil { + nestedManualKey = &ManualKeyXml{} + if _, ok := o.Misc["ManualKey"]; ok { + nestedManualKey.Misc = o.Misc["ManualKey"] + } + if o.ManualKey.LocalAddress != nil { + nestedManualKey.LocalAddress = &ManualKeyLocalAddressXml{} + if _, ok := o.Misc["ManualKeyLocalAddress"]; ok { + nestedManualKey.LocalAddress.Misc = o.Misc["ManualKeyLocalAddress"] + } + if o.ManualKey.LocalAddress.Interface != nil { + nestedManualKey.LocalAddress.Interface = o.ManualKey.LocalAddress.Interface + } + if o.ManualKey.LocalAddress.FloatingIp != nil { + nestedManualKey.LocalAddress.FloatingIp = o.ManualKey.LocalAddress.FloatingIp + } + if o.ManualKey.LocalAddress.Ip != nil { + nestedManualKey.LocalAddress.Ip = o.ManualKey.LocalAddress.Ip + } + } + if o.ManualKey.LocalSpi != nil { + nestedManualKey.LocalSpi = o.ManualKey.LocalSpi + } + if o.ManualKey.PeerAddress != nil { + nestedManualKey.PeerAddress = &ManualKeyPeerAddressXml{} + if _, ok := o.Misc["ManualKeyPeerAddress"]; ok { + nestedManualKey.PeerAddress.Misc = o.Misc["ManualKeyPeerAddress"] + } + if o.ManualKey.PeerAddress.Ip != nil { + nestedManualKey.PeerAddress.Ip = o.ManualKey.PeerAddress.Ip + } + } + if o.ManualKey.RemoteSpi != nil { + nestedManualKey.RemoteSpi = o.ManualKey.RemoteSpi + } + if o.ManualKey.Ah != nil { + nestedManualKey.Ah = &ManualKeyAhXml{} + if _, ok := o.Misc["ManualKeyAh"]; ok { + nestedManualKey.Ah.Misc = o.Misc["ManualKeyAh"] + } + if o.ManualKey.Ah.Md5 != nil { + nestedManualKey.Ah.Md5 = &ManualKeyAhMd5Xml{} + if _, ok := o.Misc["ManualKeyAhMd5"]; ok { + nestedManualKey.Ah.Md5.Misc = o.Misc["ManualKeyAhMd5"] + } + if o.ManualKey.Ah.Md5.Key != nil { + nestedManualKey.Ah.Md5.Key = o.ManualKey.Ah.Md5.Key + } + } + if o.ManualKey.Ah.Sha1 != nil { + nestedManualKey.Ah.Sha1 = &ManualKeyAhSha1Xml{} + if _, ok := o.Misc["ManualKeyAhSha1"]; ok { + nestedManualKey.Ah.Sha1.Misc = o.Misc["ManualKeyAhSha1"] + } + if o.ManualKey.Ah.Sha1.Key != nil { + nestedManualKey.Ah.Sha1.Key = o.ManualKey.Ah.Sha1.Key + } + } + if o.ManualKey.Ah.Sha256 != nil { + nestedManualKey.Ah.Sha256 = &ManualKeyAhSha256Xml{} + if _, ok := o.Misc["ManualKeyAhSha256"]; ok { + nestedManualKey.Ah.Sha256.Misc = o.Misc["ManualKeyAhSha256"] + } + if o.ManualKey.Ah.Sha256.Key != nil { + nestedManualKey.Ah.Sha256.Key = o.ManualKey.Ah.Sha256.Key + } + } + if o.ManualKey.Ah.Sha384 != nil { + nestedManualKey.Ah.Sha384 = &ManualKeyAhSha384Xml{} + if _, ok := o.Misc["ManualKeyAhSha384"]; ok { + nestedManualKey.Ah.Sha384.Misc = o.Misc["ManualKeyAhSha384"] + } + if o.ManualKey.Ah.Sha384.Key != nil { + nestedManualKey.Ah.Sha384.Key = o.ManualKey.Ah.Sha384.Key + } + } + if o.ManualKey.Ah.Sha512 != nil { + nestedManualKey.Ah.Sha512 = &ManualKeyAhSha512Xml{} + if _, ok := o.Misc["ManualKeyAhSha512"]; ok { + nestedManualKey.Ah.Sha512.Misc = o.Misc["ManualKeyAhSha512"] + } + if o.ManualKey.Ah.Sha512.Key != nil { + nestedManualKey.Ah.Sha512.Key = o.ManualKey.Ah.Sha512.Key + } + } + } + if o.ManualKey.Esp != nil { + nestedManualKey.Esp = &ManualKeyEspXml{} + if _, ok := o.Misc["ManualKeyEsp"]; ok { + nestedManualKey.Esp.Misc = o.Misc["ManualKeyEsp"] + } + if o.ManualKey.Esp.Authentication != nil { + nestedManualKey.Esp.Authentication = &ManualKeyEspAuthenticationXml{} + if _, ok := o.Misc["ManualKeyEspAuthentication"]; ok { + nestedManualKey.Esp.Authentication.Misc = o.Misc["ManualKeyEspAuthentication"] + } + if o.ManualKey.Esp.Authentication.Sha384 != nil { + nestedManualKey.Esp.Authentication.Sha384 = &ManualKeyEspAuthenticationSha384Xml{} + if _, ok := o.Misc["ManualKeyEspAuthenticationSha384"]; ok { + nestedManualKey.Esp.Authentication.Sha384.Misc = o.Misc["ManualKeyEspAuthenticationSha384"] + } + if o.ManualKey.Esp.Authentication.Sha384.Key != nil { + nestedManualKey.Esp.Authentication.Sha384.Key = o.ManualKey.Esp.Authentication.Sha384.Key + } + } + if o.ManualKey.Esp.Authentication.Sha512 != nil { + nestedManualKey.Esp.Authentication.Sha512 = &ManualKeyEspAuthenticationSha512Xml{} + if _, ok := o.Misc["ManualKeyEspAuthenticationSha512"]; ok { + nestedManualKey.Esp.Authentication.Sha512.Misc = o.Misc["ManualKeyEspAuthenticationSha512"] + } + if o.ManualKey.Esp.Authentication.Sha512.Key != nil { + nestedManualKey.Esp.Authentication.Sha512.Key = o.ManualKey.Esp.Authentication.Sha512.Key + } + } + if o.ManualKey.Esp.Authentication.Md5 != nil { + nestedManualKey.Esp.Authentication.Md5 = &ManualKeyEspAuthenticationMd5Xml{} + if _, ok := o.Misc["ManualKeyEspAuthenticationMd5"]; ok { + nestedManualKey.Esp.Authentication.Md5.Misc = o.Misc["ManualKeyEspAuthenticationMd5"] + } + if o.ManualKey.Esp.Authentication.Md5.Key != nil { + nestedManualKey.Esp.Authentication.Md5.Key = o.ManualKey.Esp.Authentication.Md5.Key + } + } + if o.ManualKey.Esp.Authentication.None != nil { + nestedManualKey.Esp.Authentication.None = &ManualKeyEspAuthenticationNoneXml{} + if _, ok := o.Misc["ManualKeyEspAuthenticationNone"]; ok { + nestedManualKey.Esp.Authentication.None.Misc = o.Misc["ManualKeyEspAuthenticationNone"] + } + } + if o.ManualKey.Esp.Authentication.Sha1 != nil { + nestedManualKey.Esp.Authentication.Sha1 = &ManualKeyEspAuthenticationSha1Xml{} + if _, ok := o.Misc["ManualKeyEspAuthenticationSha1"]; ok { + nestedManualKey.Esp.Authentication.Sha1.Misc = o.Misc["ManualKeyEspAuthenticationSha1"] + } + if o.ManualKey.Esp.Authentication.Sha1.Key != nil { + nestedManualKey.Esp.Authentication.Sha1.Key = o.ManualKey.Esp.Authentication.Sha1.Key + } + } + if o.ManualKey.Esp.Authentication.Sha256 != nil { + nestedManualKey.Esp.Authentication.Sha256 = &ManualKeyEspAuthenticationSha256Xml{} + if _, ok := o.Misc["ManualKeyEspAuthenticationSha256"]; ok { + nestedManualKey.Esp.Authentication.Sha256.Misc = o.Misc["ManualKeyEspAuthenticationSha256"] + } + if o.ManualKey.Esp.Authentication.Sha256.Key != nil { + nestedManualKey.Esp.Authentication.Sha256.Key = o.ManualKey.Esp.Authentication.Sha256.Key + } + } + } + if o.ManualKey.Esp.Encryption != nil { + nestedManualKey.Esp.Encryption = &ManualKeyEspEncryptionXml{} + if _, ok := o.Misc["ManualKeyEspEncryption"]; ok { + nestedManualKey.Esp.Encryption.Misc = o.Misc["ManualKeyEspEncryption"] + } + if o.ManualKey.Esp.Encryption.Algorithm != nil { + nestedManualKey.Esp.Encryption.Algorithm = o.ManualKey.Esp.Encryption.Algorithm + } + if o.ManualKey.Esp.Encryption.Key != nil { + nestedManualKey.Esp.Encryption.Key = o.ManualKey.Esp.Encryption.Key + } + } + } + } + entry.ManualKey = nestedManualKey + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func specifyEntry_11_0_2(o *Entry) (any, error) { + entry := entryXml_11_0_2{} + entry.Name = o.Name + entry.AntiReplay = util.YesNo(o.AntiReplay, nil) + entry.AntiReplayWindow = o.AntiReplayWindow + entry.Comment = o.Comment + entry.CopyFlowLabel = util.YesNo(o.CopyFlowLabel, nil) + entry.CopyTos = util.YesNo(o.CopyTos, nil) + entry.Disabled = util.YesNo(o.Disabled, nil) + entry.EnableGreEncapsulation = util.YesNo(o.EnableGreEncapsulation, nil) + entry.IpsecMode = o.IpsecMode + entry.Ipv6 = util.YesNo(o.Ipv6, nil) + entry.TunnelInterface = o.TunnelInterface + var nestedTunnelMonitor *TunnelMonitorXml_11_0_2 + if o.TunnelMonitor != nil { + nestedTunnelMonitor = &TunnelMonitorXml_11_0_2{} + if _, ok := o.Misc["TunnelMonitor"]; ok { + nestedTunnelMonitor.Misc = o.Misc["TunnelMonitor"] + } + if o.TunnelMonitor.TunnelMonitorProfile != nil { + nestedTunnelMonitor.TunnelMonitorProfile = o.TunnelMonitor.TunnelMonitorProfile + } + if o.TunnelMonitor.DestinationIp != nil { + nestedTunnelMonitor.DestinationIp = o.TunnelMonitor.DestinationIp + } + if o.TunnelMonitor.Enable != nil { + nestedTunnelMonitor.Enable = util.YesNo(o.TunnelMonitor.Enable, nil) + } + if o.TunnelMonitor.ProxyId != nil { + nestedTunnelMonitor.ProxyId = o.TunnelMonitor.ProxyId + } + } + entry.TunnelMonitor = nestedTunnelMonitor + + var nestedAutoKey *AutoKeyXml_11_0_2 + if o.AutoKey != nil { + nestedAutoKey = &AutoKeyXml_11_0_2{} + if _, ok := o.Misc["AutoKey"]; ok { + nestedAutoKey.Misc = o.Misc["AutoKey"] + } + if o.AutoKey.IpsecCryptoProfile != nil { + nestedAutoKey.IpsecCryptoProfile = o.AutoKey.IpsecCryptoProfile + } + if o.AutoKey.ProxyId != nil { + nestedAutoKey.ProxyId = []AutoKeyProxyIdXml_11_0_2{} + for _, oAutoKeyProxyId := range o.AutoKey.ProxyId { + nestedAutoKeyProxyId := AutoKeyProxyIdXml_11_0_2{} + if _, ok := o.Misc["AutoKeyProxyId"]; ok { + nestedAutoKeyProxyId.Misc = o.Misc["AutoKeyProxyId"] + } + if oAutoKeyProxyId.Name != "" { + nestedAutoKeyProxyId.Name = oAutoKeyProxyId.Name + } + if oAutoKeyProxyId.Local != nil { + nestedAutoKeyProxyId.Local = oAutoKeyProxyId.Local + } + if oAutoKeyProxyId.Remote != nil { + nestedAutoKeyProxyId.Remote = oAutoKeyProxyId.Remote + } + if oAutoKeyProxyId.Protocol != nil { + nestedAutoKeyProxyId.Protocol = &AutoKeyProxyIdProtocolXml_11_0_2{} + if _, ok := o.Misc["AutoKeyProxyIdProtocol"]; ok { + nestedAutoKeyProxyId.Protocol.Misc = o.Misc["AutoKeyProxyIdProtocol"] + } + if oAutoKeyProxyId.Protocol.Number != nil { + nestedAutoKeyProxyId.Protocol.Number = oAutoKeyProxyId.Protocol.Number + } + if oAutoKeyProxyId.Protocol.Any != nil { + nestedAutoKeyProxyId.Protocol.Any = &AutoKeyProxyIdProtocolAnyXml_11_0_2{} + if _, ok := o.Misc["AutoKeyProxyIdProtocolAny"]; ok { + nestedAutoKeyProxyId.Protocol.Any.Misc = o.Misc["AutoKeyProxyIdProtocolAny"] + } + } + if oAutoKeyProxyId.Protocol.Tcp != nil { + nestedAutoKeyProxyId.Protocol.Tcp = &AutoKeyProxyIdProtocolTcpXml_11_0_2{} + if _, ok := o.Misc["AutoKeyProxyIdProtocolTcp"]; ok { + nestedAutoKeyProxyId.Protocol.Tcp.Misc = o.Misc["AutoKeyProxyIdProtocolTcp"] + } + if oAutoKeyProxyId.Protocol.Tcp.LocalPort != nil { + nestedAutoKeyProxyId.Protocol.Tcp.LocalPort = oAutoKeyProxyId.Protocol.Tcp.LocalPort + } + if oAutoKeyProxyId.Protocol.Tcp.RemotePort != nil { + nestedAutoKeyProxyId.Protocol.Tcp.RemotePort = oAutoKeyProxyId.Protocol.Tcp.RemotePort + } + } + if oAutoKeyProxyId.Protocol.Udp != nil { + nestedAutoKeyProxyId.Protocol.Udp = &AutoKeyProxyIdProtocolUdpXml_11_0_2{} + if _, ok := o.Misc["AutoKeyProxyIdProtocolUdp"]; ok { + nestedAutoKeyProxyId.Protocol.Udp.Misc = o.Misc["AutoKeyProxyIdProtocolUdp"] + } + if oAutoKeyProxyId.Protocol.Udp.LocalPort != nil { + nestedAutoKeyProxyId.Protocol.Udp.LocalPort = oAutoKeyProxyId.Protocol.Udp.LocalPort + } + if oAutoKeyProxyId.Protocol.Udp.RemotePort != nil { + nestedAutoKeyProxyId.Protocol.Udp.RemotePort = oAutoKeyProxyId.Protocol.Udp.RemotePort + } + } + } + nestedAutoKey.ProxyId = append(nestedAutoKey.ProxyId, nestedAutoKeyProxyId) + } + } + if o.AutoKey.ProxyIdV6 != nil { + nestedAutoKey.ProxyIdV6 = []AutoKeyProxyIdV6Xml_11_0_2{} + for _, oAutoKeyProxyIdV6 := range o.AutoKey.ProxyIdV6 { + nestedAutoKeyProxyIdV6 := AutoKeyProxyIdV6Xml_11_0_2{} + if _, ok := o.Misc["AutoKeyProxyIdV6"]; ok { + nestedAutoKeyProxyIdV6.Misc = o.Misc["AutoKeyProxyIdV6"] + } + if oAutoKeyProxyIdV6.Local != nil { + nestedAutoKeyProxyIdV6.Local = oAutoKeyProxyIdV6.Local + } + if oAutoKeyProxyIdV6.Remote != nil { + nestedAutoKeyProxyIdV6.Remote = oAutoKeyProxyIdV6.Remote + } + if oAutoKeyProxyIdV6.Protocol != nil { + nestedAutoKeyProxyIdV6.Protocol = &AutoKeyProxyIdV6ProtocolXml_11_0_2{} + if _, ok := o.Misc["AutoKeyProxyIdV6Protocol"]; ok { + nestedAutoKeyProxyIdV6.Protocol.Misc = o.Misc["AutoKeyProxyIdV6Protocol"] + } + if oAutoKeyProxyIdV6.Protocol.Tcp != nil { + nestedAutoKeyProxyIdV6.Protocol.Tcp = &AutoKeyProxyIdV6ProtocolTcpXml_11_0_2{} + if _, ok := o.Misc["AutoKeyProxyIdV6ProtocolTcp"]; ok { + nestedAutoKeyProxyIdV6.Protocol.Tcp.Misc = o.Misc["AutoKeyProxyIdV6ProtocolTcp"] + } + if oAutoKeyProxyIdV6.Protocol.Tcp.LocalPort != nil { + nestedAutoKeyProxyIdV6.Protocol.Tcp.LocalPort = oAutoKeyProxyIdV6.Protocol.Tcp.LocalPort + } + if oAutoKeyProxyIdV6.Protocol.Tcp.RemotePort != nil { + nestedAutoKeyProxyIdV6.Protocol.Tcp.RemotePort = oAutoKeyProxyIdV6.Protocol.Tcp.RemotePort + } + } + if oAutoKeyProxyIdV6.Protocol.Udp != nil { + nestedAutoKeyProxyIdV6.Protocol.Udp = &AutoKeyProxyIdV6ProtocolUdpXml_11_0_2{} + if _, ok := o.Misc["AutoKeyProxyIdV6ProtocolUdp"]; ok { + nestedAutoKeyProxyIdV6.Protocol.Udp.Misc = o.Misc["AutoKeyProxyIdV6ProtocolUdp"] + } + if oAutoKeyProxyIdV6.Protocol.Udp.LocalPort != nil { + nestedAutoKeyProxyIdV6.Protocol.Udp.LocalPort = oAutoKeyProxyIdV6.Protocol.Udp.LocalPort + } + if oAutoKeyProxyIdV6.Protocol.Udp.RemotePort != nil { + nestedAutoKeyProxyIdV6.Protocol.Udp.RemotePort = oAutoKeyProxyIdV6.Protocol.Udp.RemotePort + } + } + if oAutoKeyProxyIdV6.Protocol.Number != nil { + nestedAutoKeyProxyIdV6.Protocol.Number = oAutoKeyProxyIdV6.Protocol.Number + } + if oAutoKeyProxyIdV6.Protocol.Any != nil { + nestedAutoKeyProxyIdV6.Protocol.Any = &AutoKeyProxyIdV6ProtocolAnyXml_11_0_2{} + if _, ok := o.Misc["AutoKeyProxyIdV6ProtocolAny"]; ok { + nestedAutoKeyProxyIdV6.Protocol.Any.Misc = o.Misc["AutoKeyProxyIdV6ProtocolAny"] + } + } + } + if oAutoKeyProxyIdV6.Name != "" { + nestedAutoKeyProxyIdV6.Name = oAutoKeyProxyIdV6.Name + } + nestedAutoKey.ProxyIdV6 = append(nestedAutoKey.ProxyIdV6, nestedAutoKeyProxyIdV6) + } + } + if o.AutoKey.IkeGateway != nil { + nestedAutoKey.IkeGateway = []AutoKeyIkeGatewayXml_11_0_2{} + for _, oAutoKeyIkeGateway := range o.AutoKey.IkeGateway { + nestedAutoKeyIkeGateway := AutoKeyIkeGatewayXml_11_0_2{} + if _, ok := o.Misc["AutoKeyIkeGateway"]; ok { + nestedAutoKeyIkeGateway.Misc = o.Misc["AutoKeyIkeGateway"] + } + if oAutoKeyIkeGateway.Name != "" { + nestedAutoKeyIkeGateway.Name = oAutoKeyIkeGateway.Name + } + nestedAutoKey.IkeGateway = append(nestedAutoKey.IkeGateway, nestedAutoKeyIkeGateway) + } + } + } + entry.AutoKey = nestedAutoKey + + var nestedGlobalProtectSatellite *GlobalProtectSatelliteXml_11_0_2 + if o.GlobalProtectSatellite != nil { + nestedGlobalProtectSatellite = &GlobalProtectSatelliteXml_11_0_2{} + if _, ok := o.Misc["GlobalProtectSatellite"]; ok { + nestedGlobalProtectSatellite.Misc = o.Misc["GlobalProtectSatellite"] + } + if o.GlobalProtectSatellite.Ipv6Preferred != nil { + nestedGlobalProtectSatellite.Ipv6Preferred = util.YesNo(o.GlobalProtectSatellite.Ipv6Preferred, nil) + } + if o.GlobalProtectSatellite.LocalAddress != nil { + nestedGlobalProtectSatellite.LocalAddress = &GlobalProtectSatelliteLocalAddressXml_11_0_2{} + if _, ok := o.Misc["GlobalProtectSatelliteLocalAddress"]; ok { + nestedGlobalProtectSatellite.LocalAddress.Misc = o.Misc["GlobalProtectSatelliteLocalAddress"] + } + if o.GlobalProtectSatellite.LocalAddress.Interface != nil { + nestedGlobalProtectSatellite.LocalAddress.Interface = o.GlobalProtectSatellite.LocalAddress.Interface + } + if o.GlobalProtectSatellite.LocalAddress.FloatingIp != nil { + nestedGlobalProtectSatellite.LocalAddress.FloatingIp = &GlobalProtectSatelliteLocalAddressFloatingIpXml_11_0_2{} + if _, ok := o.Misc["GlobalProtectSatelliteLocalAddressFloatingIp"]; ok { + nestedGlobalProtectSatellite.LocalAddress.FloatingIp.Misc = o.Misc["GlobalProtectSatelliteLocalAddressFloatingIp"] + } + if o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv4 != nil { + nestedGlobalProtectSatellite.LocalAddress.FloatingIp.Ipv4 = o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv4 + } + if o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv6 != nil { + nestedGlobalProtectSatellite.LocalAddress.FloatingIp.Ipv6 = o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv6 + } + } + if o.GlobalProtectSatellite.LocalAddress.Ip != nil { + nestedGlobalProtectSatellite.LocalAddress.Ip = &GlobalProtectSatelliteLocalAddressIpXml_11_0_2{} + if _, ok := o.Misc["GlobalProtectSatelliteLocalAddressIp"]; ok { + nestedGlobalProtectSatellite.LocalAddress.Ip.Misc = o.Misc["GlobalProtectSatelliteLocalAddressIp"] + } + if o.GlobalProtectSatellite.LocalAddress.Ip.Ipv4 != nil { + nestedGlobalProtectSatellite.LocalAddress.Ip.Ipv4 = o.GlobalProtectSatellite.LocalAddress.Ip.Ipv4 + } + if o.GlobalProtectSatellite.LocalAddress.Ip.Ipv6 != nil { + nestedGlobalProtectSatellite.LocalAddress.Ip.Ipv6 = o.GlobalProtectSatellite.LocalAddress.Ip.Ipv6 + } + } + } + if o.GlobalProtectSatellite.PortalAddress != nil { + nestedGlobalProtectSatellite.PortalAddress = o.GlobalProtectSatellite.PortalAddress + } + if o.GlobalProtectSatellite.PublishConnectedRoutes != nil { + nestedGlobalProtectSatellite.PublishConnectedRoutes = &GlobalProtectSatellitePublishConnectedRoutesXml_11_0_2{} + if _, ok := o.Misc["GlobalProtectSatellitePublishConnectedRoutes"]; ok { + nestedGlobalProtectSatellite.PublishConnectedRoutes.Misc = o.Misc["GlobalProtectSatellitePublishConnectedRoutes"] + } + if o.GlobalProtectSatellite.PublishConnectedRoutes.Enable != nil { + nestedGlobalProtectSatellite.PublishConnectedRoutes.Enable = util.YesNo(o.GlobalProtectSatellite.PublishConnectedRoutes.Enable, nil) + } + } + if o.GlobalProtectSatellite.PublishRoutes != nil { + nestedGlobalProtectSatellite.PublishRoutes = util.StrToMem(o.GlobalProtectSatellite.PublishRoutes) + } + if o.GlobalProtectSatellite.ExternalCa != nil { + nestedGlobalProtectSatellite.ExternalCa = &GlobalProtectSatelliteExternalCaXml_11_0_2{} + if _, ok := o.Misc["GlobalProtectSatelliteExternalCa"]; ok { + nestedGlobalProtectSatellite.ExternalCa.Misc = o.Misc["GlobalProtectSatelliteExternalCa"] + } + if o.GlobalProtectSatellite.ExternalCa.CertificateProfile != nil { + nestedGlobalProtectSatellite.ExternalCa.CertificateProfile = o.GlobalProtectSatellite.ExternalCa.CertificateProfile + } + if o.GlobalProtectSatellite.ExternalCa.LocalCertificate != nil { + nestedGlobalProtectSatellite.ExternalCa.LocalCertificate = o.GlobalProtectSatellite.ExternalCa.LocalCertificate + } + } + } + entry.GlobalProtectSatellite = nestedGlobalProtectSatellite + + var nestedManualKey *ManualKeyXml_11_0_2 + if o.ManualKey != nil { + nestedManualKey = &ManualKeyXml_11_0_2{} + if _, ok := o.Misc["ManualKey"]; ok { + nestedManualKey.Misc = o.Misc["ManualKey"] + } + if o.ManualKey.LocalAddress != nil { + nestedManualKey.LocalAddress = &ManualKeyLocalAddressXml_11_0_2{} + if _, ok := o.Misc["ManualKeyLocalAddress"]; ok { + nestedManualKey.LocalAddress.Misc = o.Misc["ManualKeyLocalAddress"] + } + if o.ManualKey.LocalAddress.Interface != nil { + nestedManualKey.LocalAddress.Interface = o.ManualKey.LocalAddress.Interface + } + if o.ManualKey.LocalAddress.FloatingIp != nil { + nestedManualKey.LocalAddress.FloatingIp = o.ManualKey.LocalAddress.FloatingIp + } + if o.ManualKey.LocalAddress.Ip != nil { + nestedManualKey.LocalAddress.Ip = o.ManualKey.LocalAddress.Ip + } + } + if o.ManualKey.LocalSpi != nil { + nestedManualKey.LocalSpi = o.ManualKey.LocalSpi + } + if o.ManualKey.PeerAddress != nil { + nestedManualKey.PeerAddress = &ManualKeyPeerAddressXml_11_0_2{} + if _, ok := o.Misc["ManualKeyPeerAddress"]; ok { + nestedManualKey.PeerAddress.Misc = o.Misc["ManualKeyPeerAddress"] + } + if o.ManualKey.PeerAddress.Ip != nil { + nestedManualKey.PeerAddress.Ip = o.ManualKey.PeerAddress.Ip + } + } + if o.ManualKey.RemoteSpi != nil { + nestedManualKey.RemoteSpi = o.ManualKey.RemoteSpi + } + if o.ManualKey.Ah != nil { + nestedManualKey.Ah = &ManualKeyAhXml_11_0_2{} + if _, ok := o.Misc["ManualKeyAh"]; ok { + nestedManualKey.Ah.Misc = o.Misc["ManualKeyAh"] + } + if o.ManualKey.Ah.Md5 != nil { + nestedManualKey.Ah.Md5 = &ManualKeyAhMd5Xml_11_0_2{} + if _, ok := o.Misc["ManualKeyAhMd5"]; ok { + nestedManualKey.Ah.Md5.Misc = o.Misc["ManualKeyAhMd5"] + } + if o.ManualKey.Ah.Md5.Key != nil { + nestedManualKey.Ah.Md5.Key = o.ManualKey.Ah.Md5.Key + } + } + if o.ManualKey.Ah.Sha1 != nil { + nestedManualKey.Ah.Sha1 = &ManualKeyAhSha1Xml_11_0_2{} + if _, ok := o.Misc["ManualKeyAhSha1"]; ok { + nestedManualKey.Ah.Sha1.Misc = o.Misc["ManualKeyAhSha1"] + } + if o.ManualKey.Ah.Sha1.Key != nil { + nestedManualKey.Ah.Sha1.Key = o.ManualKey.Ah.Sha1.Key + } + } + if o.ManualKey.Ah.Sha256 != nil { + nestedManualKey.Ah.Sha256 = &ManualKeyAhSha256Xml_11_0_2{} + if _, ok := o.Misc["ManualKeyAhSha256"]; ok { + nestedManualKey.Ah.Sha256.Misc = o.Misc["ManualKeyAhSha256"] + } + if o.ManualKey.Ah.Sha256.Key != nil { + nestedManualKey.Ah.Sha256.Key = o.ManualKey.Ah.Sha256.Key + } + } + if o.ManualKey.Ah.Sha384 != nil { + nestedManualKey.Ah.Sha384 = &ManualKeyAhSha384Xml_11_0_2{} + if _, ok := o.Misc["ManualKeyAhSha384"]; ok { + nestedManualKey.Ah.Sha384.Misc = o.Misc["ManualKeyAhSha384"] + } + if o.ManualKey.Ah.Sha384.Key != nil { + nestedManualKey.Ah.Sha384.Key = o.ManualKey.Ah.Sha384.Key + } + } + if o.ManualKey.Ah.Sha512 != nil { + nestedManualKey.Ah.Sha512 = &ManualKeyAhSha512Xml_11_0_2{} + if _, ok := o.Misc["ManualKeyAhSha512"]; ok { + nestedManualKey.Ah.Sha512.Misc = o.Misc["ManualKeyAhSha512"] + } + if o.ManualKey.Ah.Sha512.Key != nil { + nestedManualKey.Ah.Sha512.Key = o.ManualKey.Ah.Sha512.Key + } + } + } + if o.ManualKey.Esp != nil { + nestedManualKey.Esp = &ManualKeyEspXml_11_0_2{} + if _, ok := o.Misc["ManualKeyEsp"]; ok { + nestedManualKey.Esp.Misc = o.Misc["ManualKeyEsp"] + } + if o.ManualKey.Esp.Authentication != nil { + nestedManualKey.Esp.Authentication = &ManualKeyEspAuthenticationXml_11_0_2{} + if _, ok := o.Misc["ManualKeyEspAuthentication"]; ok { + nestedManualKey.Esp.Authentication.Misc = o.Misc["ManualKeyEspAuthentication"] + } + if o.ManualKey.Esp.Authentication.Md5 != nil { + nestedManualKey.Esp.Authentication.Md5 = &ManualKeyEspAuthenticationMd5Xml_11_0_2{} + if _, ok := o.Misc["ManualKeyEspAuthenticationMd5"]; ok { + nestedManualKey.Esp.Authentication.Md5.Misc = o.Misc["ManualKeyEspAuthenticationMd5"] + } + if o.ManualKey.Esp.Authentication.Md5.Key != nil { + nestedManualKey.Esp.Authentication.Md5.Key = o.ManualKey.Esp.Authentication.Md5.Key + } + } + if o.ManualKey.Esp.Authentication.None != nil { + nestedManualKey.Esp.Authentication.None = &ManualKeyEspAuthenticationNoneXml_11_0_2{} + if _, ok := o.Misc["ManualKeyEspAuthenticationNone"]; ok { + nestedManualKey.Esp.Authentication.None.Misc = o.Misc["ManualKeyEspAuthenticationNone"] + } + } + if o.ManualKey.Esp.Authentication.Sha1 != nil { + nestedManualKey.Esp.Authentication.Sha1 = &ManualKeyEspAuthenticationSha1Xml_11_0_2{} + if _, ok := o.Misc["ManualKeyEspAuthenticationSha1"]; ok { + nestedManualKey.Esp.Authentication.Sha1.Misc = o.Misc["ManualKeyEspAuthenticationSha1"] + } + if o.ManualKey.Esp.Authentication.Sha1.Key != nil { + nestedManualKey.Esp.Authentication.Sha1.Key = o.ManualKey.Esp.Authentication.Sha1.Key + } + } + if o.ManualKey.Esp.Authentication.Sha256 != nil { + nestedManualKey.Esp.Authentication.Sha256 = &ManualKeyEspAuthenticationSha256Xml_11_0_2{} + if _, ok := o.Misc["ManualKeyEspAuthenticationSha256"]; ok { + nestedManualKey.Esp.Authentication.Sha256.Misc = o.Misc["ManualKeyEspAuthenticationSha256"] + } + if o.ManualKey.Esp.Authentication.Sha256.Key != nil { + nestedManualKey.Esp.Authentication.Sha256.Key = o.ManualKey.Esp.Authentication.Sha256.Key + } + } + if o.ManualKey.Esp.Authentication.Sha384 != nil { + nestedManualKey.Esp.Authentication.Sha384 = &ManualKeyEspAuthenticationSha384Xml_11_0_2{} + if _, ok := o.Misc["ManualKeyEspAuthenticationSha384"]; ok { + nestedManualKey.Esp.Authentication.Sha384.Misc = o.Misc["ManualKeyEspAuthenticationSha384"] + } + if o.ManualKey.Esp.Authentication.Sha384.Key != nil { + nestedManualKey.Esp.Authentication.Sha384.Key = o.ManualKey.Esp.Authentication.Sha384.Key + } + } + if o.ManualKey.Esp.Authentication.Sha512 != nil { + nestedManualKey.Esp.Authentication.Sha512 = &ManualKeyEspAuthenticationSha512Xml_11_0_2{} + if _, ok := o.Misc["ManualKeyEspAuthenticationSha512"]; ok { + nestedManualKey.Esp.Authentication.Sha512.Misc = o.Misc["ManualKeyEspAuthenticationSha512"] + } + if o.ManualKey.Esp.Authentication.Sha512.Key != nil { + nestedManualKey.Esp.Authentication.Sha512.Key = o.ManualKey.Esp.Authentication.Sha512.Key + } + } + } + if o.ManualKey.Esp.Encryption != nil { + nestedManualKey.Esp.Encryption = &ManualKeyEspEncryptionXml_11_0_2{} + if _, ok := o.Misc["ManualKeyEspEncryption"]; ok { + nestedManualKey.Esp.Encryption.Misc = o.Misc["ManualKeyEspEncryption"] + } + if o.ManualKey.Esp.Encryption.Algorithm != nil { + nestedManualKey.Esp.Encryption.Algorithm = o.ManualKey.Esp.Encryption.Algorithm + } + if o.ManualKey.Esp.Encryption.Key != nil { + nestedManualKey.Esp.Encryption.Key = o.ManualKey.Esp.Encryption.Key + } + } + } + } + entry.ManualKey = nestedManualKey + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.AntiReplay = util.AsBool(o.AntiReplay, nil) + entry.AntiReplayWindow = o.AntiReplayWindow + entry.Comment = o.Comment + entry.CopyFlowLabel = util.AsBool(o.CopyFlowLabel, nil) + entry.CopyTos = util.AsBool(o.CopyTos, nil) + entry.Disabled = util.AsBool(o.Disabled, nil) + entry.EnableGreEncapsulation = util.AsBool(o.EnableGreEncapsulation, nil) + entry.IpsecMode = o.IpsecMode + entry.Ipv6 = util.AsBool(o.Ipv6, nil) + entry.TunnelInterface = o.TunnelInterface + var nestedTunnelMonitor *TunnelMonitor + if o.TunnelMonitor != nil { + nestedTunnelMonitor = &TunnelMonitor{} + if o.TunnelMonitor.Misc != nil { + entry.Misc["TunnelMonitor"] = o.TunnelMonitor.Misc + } + if o.TunnelMonitor.ProxyId != nil { + nestedTunnelMonitor.ProxyId = o.TunnelMonitor.ProxyId + } + if o.TunnelMonitor.TunnelMonitorProfile != nil { + nestedTunnelMonitor.TunnelMonitorProfile = o.TunnelMonitor.TunnelMonitorProfile + } + if o.TunnelMonitor.DestinationIp != nil { + nestedTunnelMonitor.DestinationIp = o.TunnelMonitor.DestinationIp + } + if o.TunnelMonitor.Enable != nil { + nestedTunnelMonitor.Enable = util.AsBool(o.TunnelMonitor.Enable, nil) + } + } + entry.TunnelMonitor = nestedTunnelMonitor + + var nestedAutoKey *AutoKey + if o.AutoKey != nil { + nestedAutoKey = &AutoKey{} + if o.AutoKey.Misc != nil { + entry.Misc["AutoKey"] = o.AutoKey.Misc + } + if o.AutoKey.ProxyId != nil { + nestedAutoKey.ProxyId = []AutoKeyProxyId{} + for _, oAutoKeyProxyId := range o.AutoKey.ProxyId { + nestedAutoKeyProxyId := AutoKeyProxyId{} + if oAutoKeyProxyId.Misc != nil { + entry.Misc["AutoKeyProxyId"] = oAutoKeyProxyId.Misc + } + if oAutoKeyProxyId.Local != nil { + nestedAutoKeyProxyId.Local = oAutoKeyProxyId.Local + } + if oAutoKeyProxyId.Remote != nil { + nestedAutoKeyProxyId.Remote = oAutoKeyProxyId.Remote + } + if oAutoKeyProxyId.Protocol != nil { + nestedAutoKeyProxyId.Protocol = &AutoKeyProxyIdProtocol{} + if oAutoKeyProxyId.Protocol.Misc != nil { + entry.Misc["AutoKeyProxyIdProtocol"] = oAutoKeyProxyId.Protocol.Misc + } + if oAutoKeyProxyId.Protocol.Tcp != nil { + nestedAutoKeyProxyId.Protocol.Tcp = &AutoKeyProxyIdProtocolTcp{} + if oAutoKeyProxyId.Protocol.Tcp.Misc != nil { + entry.Misc["AutoKeyProxyIdProtocolTcp"] = oAutoKeyProxyId.Protocol.Tcp.Misc + } + if oAutoKeyProxyId.Protocol.Tcp.LocalPort != nil { + nestedAutoKeyProxyId.Protocol.Tcp.LocalPort = oAutoKeyProxyId.Protocol.Tcp.LocalPort + } + if oAutoKeyProxyId.Protocol.Tcp.RemotePort != nil { + nestedAutoKeyProxyId.Protocol.Tcp.RemotePort = oAutoKeyProxyId.Protocol.Tcp.RemotePort + } + } + if oAutoKeyProxyId.Protocol.Udp != nil { + nestedAutoKeyProxyId.Protocol.Udp = &AutoKeyProxyIdProtocolUdp{} + if oAutoKeyProxyId.Protocol.Udp.Misc != nil { + entry.Misc["AutoKeyProxyIdProtocolUdp"] = oAutoKeyProxyId.Protocol.Udp.Misc + } + if oAutoKeyProxyId.Protocol.Udp.LocalPort != nil { + nestedAutoKeyProxyId.Protocol.Udp.LocalPort = oAutoKeyProxyId.Protocol.Udp.LocalPort + } + if oAutoKeyProxyId.Protocol.Udp.RemotePort != nil { + nestedAutoKeyProxyId.Protocol.Udp.RemotePort = oAutoKeyProxyId.Protocol.Udp.RemotePort + } + } + if oAutoKeyProxyId.Protocol.Number != nil { + nestedAutoKeyProxyId.Protocol.Number = oAutoKeyProxyId.Protocol.Number + } + if oAutoKeyProxyId.Protocol.Any != nil { + nestedAutoKeyProxyId.Protocol.Any = &AutoKeyProxyIdProtocolAny{} + if oAutoKeyProxyId.Protocol.Any.Misc != nil { + entry.Misc["AutoKeyProxyIdProtocolAny"] = oAutoKeyProxyId.Protocol.Any.Misc + } + } + } + if oAutoKeyProxyId.Name != "" { + nestedAutoKeyProxyId.Name = oAutoKeyProxyId.Name + } + nestedAutoKey.ProxyId = append(nestedAutoKey.ProxyId, nestedAutoKeyProxyId) + } + } + if o.AutoKey.ProxyIdV6 != nil { + nestedAutoKey.ProxyIdV6 = []AutoKeyProxyIdV6{} + for _, oAutoKeyProxyIdV6 := range o.AutoKey.ProxyIdV6 { + nestedAutoKeyProxyIdV6 := AutoKeyProxyIdV6{} + if oAutoKeyProxyIdV6.Misc != nil { + entry.Misc["AutoKeyProxyIdV6"] = oAutoKeyProxyIdV6.Misc + } + if oAutoKeyProxyIdV6.Local != nil { + nestedAutoKeyProxyIdV6.Local = oAutoKeyProxyIdV6.Local + } + if oAutoKeyProxyIdV6.Remote != nil { + nestedAutoKeyProxyIdV6.Remote = oAutoKeyProxyIdV6.Remote + } + if oAutoKeyProxyIdV6.Protocol != nil { + nestedAutoKeyProxyIdV6.Protocol = &AutoKeyProxyIdV6Protocol{} + if oAutoKeyProxyIdV6.Protocol.Misc != nil { + entry.Misc["AutoKeyProxyIdV6Protocol"] = oAutoKeyProxyIdV6.Protocol.Misc + } + if oAutoKeyProxyIdV6.Protocol.Number != nil { + nestedAutoKeyProxyIdV6.Protocol.Number = oAutoKeyProxyIdV6.Protocol.Number + } + if oAutoKeyProxyIdV6.Protocol.Any != nil { + nestedAutoKeyProxyIdV6.Protocol.Any = &AutoKeyProxyIdV6ProtocolAny{} + if oAutoKeyProxyIdV6.Protocol.Any.Misc != nil { + entry.Misc["AutoKeyProxyIdV6ProtocolAny"] = oAutoKeyProxyIdV6.Protocol.Any.Misc + } + } + if oAutoKeyProxyIdV6.Protocol.Tcp != nil { + nestedAutoKeyProxyIdV6.Protocol.Tcp = &AutoKeyProxyIdV6ProtocolTcp{} + if oAutoKeyProxyIdV6.Protocol.Tcp.Misc != nil { + entry.Misc["AutoKeyProxyIdV6ProtocolTcp"] = oAutoKeyProxyIdV6.Protocol.Tcp.Misc + } + if oAutoKeyProxyIdV6.Protocol.Tcp.LocalPort != nil { + nestedAutoKeyProxyIdV6.Protocol.Tcp.LocalPort = oAutoKeyProxyIdV6.Protocol.Tcp.LocalPort + } + if oAutoKeyProxyIdV6.Protocol.Tcp.RemotePort != nil { + nestedAutoKeyProxyIdV6.Protocol.Tcp.RemotePort = oAutoKeyProxyIdV6.Protocol.Tcp.RemotePort + } + } + if oAutoKeyProxyIdV6.Protocol.Udp != nil { + nestedAutoKeyProxyIdV6.Protocol.Udp = &AutoKeyProxyIdV6ProtocolUdp{} + if oAutoKeyProxyIdV6.Protocol.Udp.Misc != nil { + entry.Misc["AutoKeyProxyIdV6ProtocolUdp"] = oAutoKeyProxyIdV6.Protocol.Udp.Misc + } + if oAutoKeyProxyIdV6.Protocol.Udp.LocalPort != nil { + nestedAutoKeyProxyIdV6.Protocol.Udp.LocalPort = oAutoKeyProxyIdV6.Protocol.Udp.LocalPort + } + if oAutoKeyProxyIdV6.Protocol.Udp.RemotePort != nil { + nestedAutoKeyProxyIdV6.Protocol.Udp.RemotePort = oAutoKeyProxyIdV6.Protocol.Udp.RemotePort + } + } + } + if oAutoKeyProxyIdV6.Name != "" { + nestedAutoKeyProxyIdV6.Name = oAutoKeyProxyIdV6.Name + } + nestedAutoKey.ProxyIdV6 = append(nestedAutoKey.ProxyIdV6, nestedAutoKeyProxyIdV6) + } + } + if o.AutoKey.IkeGateway != nil { + nestedAutoKey.IkeGateway = []AutoKeyIkeGateway{} + for _, oAutoKeyIkeGateway := range o.AutoKey.IkeGateway { + nestedAutoKeyIkeGateway := AutoKeyIkeGateway{} + if oAutoKeyIkeGateway.Misc != nil { + entry.Misc["AutoKeyIkeGateway"] = oAutoKeyIkeGateway.Misc + } + if oAutoKeyIkeGateway.Name != "" { + nestedAutoKeyIkeGateway.Name = oAutoKeyIkeGateway.Name + } + nestedAutoKey.IkeGateway = append(nestedAutoKey.IkeGateway, nestedAutoKeyIkeGateway) + } + } + if o.AutoKey.IpsecCryptoProfile != nil { + nestedAutoKey.IpsecCryptoProfile = o.AutoKey.IpsecCryptoProfile + } + } + entry.AutoKey = nestedAutoKey + + var nestedGlobalProtectSatellite *GlobalProtectSatellite + if o.GlobalProtectSatellite != nil { + nestedGlobalProtectSatellite = &GlobalProtectSatellite{} + if o.GlobalProtectSatellite.Misc != nil { + entry.Misc["GlobalProtectSatellite"] = o.GlobalProtectSatellite.Misc + } + if o.GlobalProtectSatellite.LocalAddress != nil { + nestedGlobalProtectSatellite.LocalAddress = &GlobalProtectSatelliteLocalAddress{} + if o.GlobalProtectSatellite.LocalAddress.Misc != nil { + entry.Misc["GlobalProtectSatelliteLocalAddress"] = o.GlobalProtectSatellite.LocalAddress.Misc + } + if o.GlobalProtectSatellite.LocalAddress.Interface != nil { + nestedGlobalProtectSatellite.LocalAddress.Interface = o.GlobalProtectSatellite.LocalAddress.Interface + } + if o.GlobalProtectSatellite.LocalAddress.FloatingIp != nil { + nestedGlobalProtectSatellite.LocalAddress.FloatingIp = &GlobalProtectSatelliteLocalAddressFloatingIp{} + if o.GlobalProtectSatellite.LocalAddress.FloatingIp.Misc != nil { + entry.Misc["GlobalProtectSatelliteLocalAddressFloatingIp"] = o.GlobalProtectSatellite.LocalAddress.FloatingIp.Misc + } + if o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv4 != nil { + nestedGlobalProtectSatellite.LocalAddress.FloatingIp.Ipv4 = o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv4 + } + if o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv6 != nil { + nestedGlobalProtectSatellite.LocalAddress.FloatingIp.Ipv6 = o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv6 + } + } + if o.GlobalProtectSatellite.LocalAddress.Ip != nil { + nestedGlobalProtectSatellite.LocalAddress.Ip = &GlobalProtectSatelliteLocalAddressIp{} + if o.GlobalProtectSatellite.LocalAddress.Ip.Misc != nil { + entry.Misc["GlobalProtectSatelliteLocalAddressIp"] = o.GlobalProtectSatellite.LocalAddress.Ip.Misc + } + if o.GlobalProtectSatellite.LocalAddress.Ip.Ipv4 != nil { + nestedGlobalProtectSatellite.LocalAddress.Ip.Ipv4 = o.GlobalProtectSatellite.LocalAddress.Ip.Ipv4 + } + if o.GlobalProtectSatellite.LocalAddress.Ip.Ipv6 != nil { + nestedGlobalProtectSatellite.LocalAddress.Ip.Ipv6 = o.GlobalProtectSatellite.LocalAddress.Ip.Ipv6 + } + } + } + if o.GlobalProtectSatellite.PortalAddress != nil { + nestedGlobalProtectSatellite.PortalAddress = o.GlobalProtectSatellite.PortalAddress + } + if o.GlobalProtectSatellite.PublishConnectedRoutes != nil { + nestedGlobalProtectSatellite.PublishConnectedRoutes = &GlobalProtectSatellitePublishConnectedRoutes{} + if o.GlobalProtectSatellite.PublishConnectedRoutes.Misc != nil { + entry.Misc["GlobalProtectSatellitePublishConnectedRoutes"] = o.GlobalProtectSatellite.PublishConnectedRoutes.Misc + } + if o.GlobalProtectSatellite.PublishConnectedRoutes.Enable != nil { + nestedGlobalProtectSatellite.PublishConnectedRoutes.Enable = util.AsBool(o.GlobalProtectSatellite.PublishConnectedRoutes.Enable, nil) + } + } + if o.GlobalProtectSatellite.PublishRoutes != nil { + nestedGlobalProtectSatellite.PublishRoutes = util.MemToStr(o.GlobalProtectSatellite.PublishRoutes) + } + if o.GlobalProtectSatellite.ExternalCa != nil { + nestedGlobalProtectSatellite.ExternalCa = &GlobalProtectSatelliteExternalCa{} + if o.GlobalProtectSatellite.ExternalCa.Misc != nil { + entry.Misc["GlobalProtectSatelliteExternalCa"] = o.GlobalProtectSatellite.ExternalCa.Misc + } + if o.GlobalProtectSatellite.ExternalCa.CertificateProfile != nil { + nestedGlobalProtectSatellite.ExternalCa.CertificateProfile = o.GlobalProtectSatellite.ExternalCa.CertificateProfile + } + if o.GlobalProtectSatellite.ExternalCa.LocalCertificate != nil { + nestedGlobalProtectSatellite.ExternalCa.LocalCertificate = o.GlobalProtectSatellite.ExternalCa.LocalCertificate + } + } + if o.GlobalProtectSatellite.Ipv6Preferred != nil { + nestedGlobalProtectSatellite.Ipv6Preferred = util.AsBool(o.GlobalProtectSatellite.Ipv6Preferred, nil) + } + } + entry.GlobalProtectSatellite = nestedGlobalProtectSatellite + + var nestedManualKey *ManualKey + if o.ManualKey != nil { + nestedManualKey = &ManualKey{} + if o.ManualKey.Misc != nil { + entry.Misc["ManualKey"] = o.ManualKey.Misc + } + if o.ManualKey.LocalAddress != nil { + nestedManualKey.LocalAddress = &ManualKeyLocalAddress{} + if o.ManualKey.LocalAddress.Misc != nil { + entry.Misc["ManualKeyLocalAddress"] = o.ManualKey.LocalAddress.Misc + } + if o.ManualKey.LocalAddress.Interface != nil { + nestedManualKey.LocalAddress.Interface = o.ManualKey.LocalAddress.Interface + } + if o.ManualKey.LocalAddress.Ip != nil { + nestedManualKey.LocalAddress.Ip = o.ManualKey.LocalAddress.Ip + } + if o.ManualKey.LocalAddress.FloatingIp != nil { + nestedManualKey.LocalAddress.FloatingIp = o.ManualKey.LocalAddress.FloatingIp + } + } + if o.ManualKey.LocalSpi != nil { + nestedManualKey.LocalSpi = o.ManualKey.LocalSpi + } + if o.ManualKey.PeerAddress != nil { + nestedManualKey.PeerAddress = &ManualKeyPeerAddress{} + if o.ManualKey.PeerAddress.Misc != nil { + entry.Misc["ManualKeyPeerAddress"] = o.ManualKey.PeerAddress.Misc + } + if o.ManualKey.PeerAddress.Ip != nil { + nestedManualKey.PeerAddress.Ip = o.ManualKey.PeerAddress.Ip + } + } + if o.ManualKey.RemoteSpi != nil { + nestedManualKey.RemoteSpi = o.ManualKey.RemoteSpi + } + if o.ManualKey.Ah != nil { + nestedManualKey.Ah = &ManualKeyAh{} + if o.ManualKey.Ah.Misc != nil { + entry.Misc["ManualKeyAh"] = o.ManualKey.Ah.Misc + } + if o.ManualKey.Ah.Sha256 != nil { + nestedManualKey.Ah.Sha256 = &ManualKeyAhSha256{} + if o.ManualKey.Ah.Sha256.Misc != nil { + entry.Misc["ManualKeyAhSha256"] = o.ManualKey.Ah.Sha256.Misc + } + if o.ManualKey.Ah.Sha256.Key != nil { + nestedManualKey.Ah.Sha256.Key = o.ManualKey.Ah.Sha256.Key + } + } + if o.ManualKey.Ah.Sha384 != nil { + nestedManualKey.Ah.Sha384 = &ManualKeyAhSha384{} + if o.ManualKey.Ah.Sha384.Misc != nil { + entry.Misc["ManualKeyAhSha384"] = o.ManualKey.Ah.Sha384.Misc + } + if o.ManualKey.Ah.Sha384.Key != nil { + nestedManualKey.Ah.Sha384.Key = o.ManualKey.Ah.Sha384.Key + } + } + if o.ManualKey.Ah.Sha512 != nil { + nestedManualKey.Ah.Sha512 = &ManualKeyAhSha512{} + if o.ManualKey.Ah.Sha512.Misc != nil { + entry.Misc["ManualKeyAhSha512"] = o.ManualKey.Ah.Sha512.Misc + } + if o.ManualKey.Ah.Sha512.Key != nil { + nestedManualKey.Ah.Sha512.Key = o.ManualKey.Ah.Sha512.Key + } + } + if o.ManualKey.Ah.Md5 != nil { + nestedManualKey.Ah.Md5 = &ManualKeyAhMd5{} + if o.ManualKey.Ah.Md5.Misc != nil { + entry.Misc["ManualKeyAhMd5"] = o.ManualKey.Ah.Md5.Misc + } + if o.ManualKey.Ah.Md5.Key != nil { + nestedManualKey.Ah.Md5.Key = o.ManualKey.Ah.Md5.Key + } + } + if o.ManualKey.Ah.Sha1 != nil { + nestedManualKey.Ah.Sha1 = &ManualKeyAhSha1{} + if o.ManualKey.Ah.Sha1.Misc != nil { + entry.Misc["ManualKeyAhSha1"] = o.ManualKey.Ah.Sha1.Misc + } + if o.ManualKey.Ah.Sha1.Key != nil { + nestedManualKey.Ah.Sha1.Key = o.ManualKey.Ah.Sha1.Key + } + } + } + if o.ManualKey.Esp != nil { + nestedManualKey.Esp = &ManualKeyEsp{} + if o.ManualKey.Esp.Misc != nil { + entry.Misc["ManualKeyEsp"] = o.ManualKey.Esp.Misc + } + if o.ManualKey.Esp.Encryption != nil { + nestedManualKey.Esp.Encryption = &ManualKeyEspEncryption{} + if o.ManualKey.Esp.Encryption.Misc != nil { + entry.Misc["ManualKeyEspEncryption"] = o.ManualKey.Esp.Encryption.Misc + } + if o.ManualKey.Esp.Encryption.Algorithm != nil { + nestedManualKey.Esp.Encryption.Algorithm = o.ManualKey.Esp.Encryption.Algorithm + } + if o.ManualKey.Esp.Encryption.Key != nil { + nestedManualKey.Esp.Encryption.Key = o.ManualKey.Esp.Encryption.Key + } + } + if o.ManualKey.Esp.Authentication != nil { + nestedManualKey.Esp.Authentication = &ManualKeyEspAuthentication{} + if o.ManualKey.Esp.Authentication.Misc != nil { + entry.Misc["ManualKeyEspAuthentication"] = o.ManualKey.Esp.Authentication.Misc + } + if o.ManualKey.Esp.Authentication.Sha512 != nil { + nestedManualKey.Esp.Authentication.Sha512 = &ManualKeyEspAuthenticationSha512{} + if o.ManualKey.Esp.Authentication.Sha512.Misc != nil { + entry.Misc["ManualKeyEspAuthenticationSha512"] = o.ManualKey.Esp.Authentication.Sha512.Misc + } + if o.ManualKey.Esp.Authentication.Sha512.Key != nil { + nestedManualKey.Esp.Authentication.Sha512.Key = o.ManualKey.Esp.Authentication.Sha512.Key + } + } + if o.ManualKey.Esp.Authentication.Md5 != nil { + nestedManualKey.Esp.Authentication.Md5 = &ManualKeyEspAuthenticationMd5{} + if o.ManualKey.Esp.Authentication.Md5.Misc != nil { + entry.Misc["ManualKeyEspAuthenticationMd5"] = o.ManualKey.Esp.Authentication.Md5.Misc + } + if o.ManualKey.Esp.Authentication.Md5.Key != nil { + nestedManualKey.Esp.Authentication.Md5.Key = o.ManualKey.Esp.Authentication.Md5.Key + } + } + if o.ManualKey.Esp.Authentication.None != nil { + nestedManualKey.Esp.Authentication.None = &ManualKeyEspAuthenticationNone{} + if o.ManualKey.Esp.Authentication.None.Misc != nil { + entry.Misc["ManualKeyEspAuthenticationNone"] = o.ManualKey.Esp.Authentication.None.Misc + } + } + if o.ManualKey.Esp.Authentication.Sha1 != nil { + nestedManualKey.Esp.Authentication.Sha1 = &ManualKeyEspAuthenticationSha1{} + if o.ManualKey.Esp.Authentication.Sha1.Misc != nil { + entry.Misc["ManualKeyEspAuthenticationSha1"] = o.ManualKey.Esp.Authentication.Sha1.Misc + } + if o.ManualKey.Esp.Authentication.Sha1.Key != nil { + nestedManualKey.Esp.Authentication.Sha1.Key = o.ManualKey.Esp.Authentication.Sha1.Key + } + } + if o.ManualKey.Esp.Authentication.Sha256 != nil { + nestedManualKey.Esp.Authentication.Sha256 = &ManualKeyEspAuthenticationSha256{} + if o.ManualKey.Esp.Authentication.Sha256.Misc != nil { + entry.Misc["ManualKeyEspAuthenticationSha256"] = o.ManualKey.Esp.Authentication.Sha256.Misc + } + if o.ManualKey.Esp.Authentication.Sha256.Key != nil { + nestedManualKey.Esp.Authentication.Sha256.Key = o.ManualKey.Esp.Authentication.Sha256.Key + } + } + if o.ManualKey.Esp.Authentication.Sha384 != nil { + nestedManualKey.Esp.Authentication.Sha384 = &ManualKeyEspAuthenticationSha384{} + if o.ManualKey.Esp.Authentication.Sha384.Misc != nil { + entry.Misc["ManualKeyEspAuthenticationSha384"] = o.ManualKey.Esp.Authentication.Sha384.Misc + } + if o.ManualKey.Esp.Authentication.Sha384.Key != nil { + nestedManualKey.Esp.Authentication.Sha384.Key = o.ManualKey.Esp.Authentication.Sha384.Key + } + } + } + } + } + entry.ManualKey = nestedManualKey + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} +func (c *entryXmlContainer_11_0_2) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.AntiReplay = util.AsBool(o.AntiReplay, nil) + entry.AntiReplayWindow = o.AntiReplayWindow + entry.Comment = o.Comment + entry.CopyFlowLabel = util.AsBool(o.CopyFlowLabel, nil) + entry.CopyTos = util.AsBool(o.CopyTos, nil) + entry.Disabled = util.AsBool(o.Disabled, nil) + entry.EnableGreEncapsulation = util.AsBool(o.EnableGreEncapsulation, nil) + entry.IpsecMode = o.IpsecMode + entry.Ipv6 = util.AsBool(o.Ipv6, nil) + entry.TunnelInterface = o.TunnelInterface + var nestedTunnelMonitor *TunnelMonitor + if o.TunnelMonitor != nil { + nestedTunnelMonitor = &TunnelMonitor{} + if o.TunnelMonitor.Misc != nil { + entry.Misc["TunnelMonitor"] = o.TunnelMonitor.Misc + } + if o.TunnelMonitor.DestinationIp != nil { + nestedTunnelMonitor.DestinationIp = o.TunnelMonitor.DestinationIp + } + if o.TunnelMonitor.Enable != nil { + nestedTunnelMonitor.Enable = util.AsBool(o.TunnelMonitor.Enable, nil) + } + if o.TunnelMonitor.ProxyId != nil { + nestedTunnelMonitor.ProxyId = o.TunnelMonitor.ProxyId + } + if o.TunnelMonitor.TunnelMonitorProfile != nil { + nestedTunnelMonitor.TunnelMonitorProfile = o.TunnelMonitor.TunnelMonitorProfile + } + } + entry.TunnelMonitor = nestedTunnelMonitor + + var nestedAutoKey *AutoKey + if o.AutoKey != nil { + nestedAutoKey = &AutoKey{} + if o.AutoKey.Misc != nil { + entry.Misc["AutoKey"] = o.AutoKey.Misc + } + if o.AutoKey.IkeGateway != nil { + nestedAutoKey.IkeGateway = []AutoKeyIkeGateway{} + for _, oAutoKeyIkeGateway := range o.AutoKey.IkeGateway { + nestedAutoKeyIkeGateway := AutoKeyIkeGateway{} + if oAutoKeyIkeGateway.Misc != nil { + entry.Misc["AutoKeyIkeGateway"] = oAutoKeyIkeGateway.Misc + } + if oAutoKeyIkeGateway.Name != "" { + nestedAutoKeyIkeGateway.Name = oAutoKeyIkeGateway.Name + } + nestedAutoKey.IkeGateway = append(nestedAutoKey.IkeGateway, nestedAutoKeyIkeGateway) + } + } + if o.AutoKey.IpsecCryptoProfile != nil { + nestedAutoKey.IpsecCryptoProfile = o.AutoKey.IpsecCryptoProfile + } + if o.AutoKey.ProxyId != nil { + nestedAutoKey.ProxyId = []AutoKeyProxyId{} + for _, oAutoKeyProxyId := range o.AutoKey.ProxyId { + nestedAutoKeyProxyId := AutoKeyProxyId{} + if oAutoKeyProxyId.Misc != nil { + entry.Misc["AutoKeyProxyId"] = oAutoKeyProxyId.Misc + } + if oAutoKeyProxyId.Local != nil { + nestedAutoKeyProxyId.Local = oAutoKeyProxyId.Local + } + if oAutoKeyProxyId.Remote != nil { + nestedAutoKeyProxyId.Remote = oAutoKeyProxyId.Remote + } + if oAutoKeyProxyId.Protocol != nil { + nestedAutoKeyProxyId.Protocol = &AutoKeyProxyIdProtocol{} + if oAutoKeyProxyId.Protocol.Misc != nil { + entry.Misc["AutoKeyProxyIdProtocol"] = oAutoKeyProxyId.Protocol.Misc + } + if oAutoKeyProxyId.Protocol.Udp != nil { + nestedAutoKeyProxyId.Protocol.Udp = &AutoKeyProxyIdProtocolUdp{} + if oAutoKeyProxyId.Protocol.Udp.Misc != nil { + entry.Misc["AutoKeyProxyIdProtocolUdp"] = oAutoKeyProxyId.Protocol.Udp.Misc + } + if oAutoKeyProxyId.Protocol.Udp.LocalPort != nil { + nestedAutoKeyProxyId.Protocol.Udp.LocalPort = oAutoKeyProxyId.Protocol.Udp.LocalPort + } + if oAutoKeyProxyId.Protocol.Udp.RemotePort != nil { + nestedAutoKeyProxyId.Protocol.Udp.RemotePort = oAutoKeyProxyId.Protocol.Udp.RemotePort + } + } + if oAutoKeyProxyId.Protocol.Number != nil { + nestedAutoKeyProxyId.Protocol.Number = oAutoKeyProxyId.Protocol.Number + } + if oAutoKeyProxyId.Protocol.Any != nil { + nestedAutoKeyProxyId.Protocol.Any = &AutoKeyProxyIdProtocolAny{} + if oAutoKeyProxyId.Protocol.Any.Misc != nil { + entry.Misc["AutoKeyProxyIdProtocolAny"] = oAutoKeyProxyId.Protocol.Any.Misc + } + } + if oAutoKeyProxyId.Protocol.Tcp != nil { + nestedAutoKeyProxyId.Protocol.Tcp = &AutoKeyProxyIdProtocolTcp{} + if oAutoKeyProxyId.Protocol.Tcp.Misc != nil { + entry.Misc["AutoKeyProxyIdProtocolTcp"] = oAutoKeyProxyId.Protocol.Tcp.Misc + } + if oAutoKeyProxyId.Protocol.Tcp.LocalPort != nil { + nestedAutoKeyProxyId.Protocol.Tcp.LocalPort = oAutoKeyProxyId.Protocol.Tcp.LocalPort + } + if oAutoKeyProxyId.Protocol.Tcp.RemotePort != nil { + nestedAutoKeyProxyId.Protocol.Tcp.RemotePort = oAutoKeyProxyId.Protocol.Tcp.RemotePort + } + } + } + if oAutoKeyProxyId.Name != "" { + nestedAutoKeyProxyId.Name = oAutoKeyProxyId.Name + } + nestedAutoKey.ProxyId = append(nestedAutoKey.ProxyId, nestedAutoKeyProxyId) + } + } + if o.AutoKey.ProxyIdV6 != nil { + nestedAutoKey.ProxyIdV6 = []AutoKeyProxyIdV6{} + for _, oAutoKeyProxyIdV6 := range o.AutoKey.ProxyIdV6 { + nestedAutoKeyProxyIdV6 := AutoKeyProxyIdV6{} + if oAutoKeyProxyIdV6.Misc != nil { + entry.Misc["AutoKeyProxyIdV6"] = oAutoKeyProxyIdV6.Misc + } + if oAutoKeyProxyIdV6.Local != nil { + nestedAutoKeyProxyIdV6.Local = oAutoKeyProxyIdV6.Local + } + if oAutoKeyProxyIdV6.Remote != nil { + nestedAutoKeyProxyIdV6.Remote = oAutoKeyProxyIdV6.Remote + } + if oAutoKeyProxyIdV6.Protocol != nil { + nestedAutoKeyProxyIdV6.Protocol = &AutoKeyProxyIdV6Protocol{} + if oAutoKeyProxyIdV6.Protocol.Misc != nil { + entry.Misc["AutoKeyProxyIdV6Protocol"] = oAutoKeyProxyIdV6.Protocol.Misc + } + if oAutoKeyProxyIdV6.Protocol.Number != nil { + nestedAutoKeyProxyIdV6.Protocol.Number = oAutoKeyProxyIdV6.Protocol.Number + } + if oAutoKeyProxyIdV6.Protocol.Any != nil { + nestedAutoKeyProxyIdV6.Protocol.Any = &AutoKeyProxyIdV6ProtocolAny{} + if oAutoKeyProxyIdV6.Protocol.Any.Misc != nil { + entry.Misc["AutoKeyProxyIdV6ProtocolAny"] = oAutoKeyProxyIdV6.Protocol.Any.Misc + } + } + if oAutoKeyProxyIdV6.Protocol.Tcp != nil { + nestedAutoKeyProxyIdV6.Protocol.Tcp = &AutoKeyProxyIdV6ProtocolTcp{} + if oAutoKeyProxyIdV6.Protocol.Tcp.Misc != nil { + entry.Misc["AutoKeyProxyIdV6ProtocolTcp"] = oAutoKeyProxyIdV6.Protocol.Tcp.Misc + } + if oAutoKeyProxyIdV6.Protocol.Tcp.LocalPort != nil { + nestedAutoKeyProxyIdV6.Protocol.Tcp.LocalPort = oAutoKeyProxyIdV6.Protocol.Tcp.LocalPort + } + if oAutoKeyProxyIdV6.Protocol.Tcp.RemotePort != nil { + nestedAutoKeyProxyIdV6.Protocol.Tcp.RemotePort = oAutoKeyProxyIdV6.Protocol.Tcp.RemotePort + } + } + if oAutoKeyProxyIdV6.Protocol.Udp != nil { + nestedAutoKeyProxyIdV6.Protocol.Udp = &AutoKeyProxyIdV6ProtocolUdp{} + if oAutoKeyProxyIdV6.Protocol.Udp.Misc != nil { + entry.Misc["AutoKeyProxyIdV6ProtocolUdp"] = oAutoKeyProxyIdV6.Protocol.Udp.Misc + } + if oAutoKeyProxyIdV6.Protocol.Udp.RemotePort != nil { + nestedAutoKeyProxyIdV6.Protocol.Udp.RemotePort = oAutoKeyProxyIdV6.Protocol.Udp.RemotePort + } + if oAutoKeyProxyIdV6.Protocol.Udp.LocalPort != nil { + nestedAutoKeyProxyIdV6.Protocol.Udp.LocalPort = oAutoKeyProxyIdV6.Protocol.Udp.LocalPort + } + } + } + if oAutoKeyProxyIdV6.Name != "" { + nestedAutoKeyProxyIdV6.Name = oAutoKeyProxyIdV6.Name + } + nestedAutoKey.ProxyIdV6 = append(nestedAutoKey.ProxyIdV6, nestedAutoKeyProxyIdV6) + } + } + } + entry.AutoKey = nestedAutoKey + + var nestedGlobalProtectSatellite *GlobalProtectSatellite + if o.GlobalProtectSatellite != nil { + nestedGlobalProtectSatellite = &GlobalProtectSatellite{} + if o.GlobalProtectSatellite.Misc != nil { + entry.Misc["GlobalProtectSatellite"] = o.GlobalProtectSatellite.Misc + } + if o.GlobalProtectSatellite.ExternalCa != nil { + nestedGlobalProtectSatellite.ExternalCa = &GlobalProtectSatelliteExternalCa{} + if o.GlobalProtectSatellite.ExternalCa.Misc != nil { + entry.Misc["GlobalProtectSatelliteExternalCa"] = o.GlobalProtectSatellite.ExternalCa.Misc + } + if o.GlobalProtectSatellite.ExternalCa.CertificateProfile != nil { + nestedGlobalProtectSatellite.ExternalCa.CertificateProfile = o.GlobalProtectSatellite.ExternalCa.CertificateProfile + } + if o.GlobalProtectSatellite.ExternalCa.LocalCertificate != nil { + nestedGlobalProtectSatellite.ExternalCa.LocalCertificate = o.GlobalProtectSatellite.ExternalCa.LocalCertificate + } + } + if o.GlobalProtectSatellite.Ipv6Preferred != nil { + nestedGlobalProtectSatellite.Ipv6Preferred = util.AsBool(o.GlobalProtectSatellite.Ipv6Preferred, nil) + } + if o.GlobalProtectSatellite.LocalAddress != nil { + nestedGlobalProtectSatellite.LocalAddress = &GlobalProtectSatelliteLocalAddress{} + if o.GlobalProtectSatellite.LocalAddress.Misc != nil { + entry.Misc["GlobalProtectSatelliteLocalAddress"] = o.GlobalProtectSatellite.LocalAddress.Misc + } + if o.GlobalProtectSatellite.LocalAddress.Interface != nil { + nestedGlobalProtectSatellite.LocalAddress.Interface = o.GlobalProtectSatellite.LocalAddress.Interface + } + if o.GlobalProtectSatellite.LocalAddress.FloatingIp != nil { + nestedGlobalProtectSatellite.LocalAddress.FloatingIp = &GlobalProtectSatelliteLocalAddressFloatingIp{} + if o.GlobalProtectSatellite.LocalAddress.FloatingIp.Misc != nil { + entry.Misc["GlobalProtectSatelliteLocalAddressFloatingIp"] = o.GlobalProtectSatellite.LocalAddress.FloatingIp.Misc + } + if o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv4 != nil { + nestedGlobalProtectSatellite.LocalAddress.FloatingIp.Ipv4 = o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv4 + } + if o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv6 != nil { + nestedGlobalProtectSatellite.LocalAddress.FloatingIp.Ipv6 = o.GlobalProtectSatellite.LocalAddress.FloatingIp.Ipv6 + } + } + if o.GlobalProtectSatellite.LocalAddress.Ip != nil { + nestedGlobalProtectSatellite.LocalAddress.Ip = &GlobalProtectSatelliteLocalAddressIp{} + if o.GlobalProtectSatellite.LocalAddress.Ip.Misc != nil { + entry.Misc["GlobalProtectSatelliteLocalAddressIp"] = o.GlobalProtectSatellite.LocalAddress.Ip.Misc + } + if o.GlobalProtectSatellite.LocalAddress.Ip.Ipv4 != nil { + nestedGlobalProtectSatellite.LocalAddress.Ip.Ipv4 = o.GlobalProtectSatellite.LocalAddress.Ip.Ipv4 + } + if o.GlobalProtectSatellite.LocalAddress.Ip.Ipv6 != nil { + nestedGlobalProtectSatellite.LocalAddress.Ip.Ipv6 = o.GlobalProtectSatellite.LocalAddress.Ip.Ipv6 + } + } + } + if o.GlobalProtectSatellite.PortalAddress != nil { + nestedGlobalProtectSatellite.PortalAddress = o.GlobalProtectSatellite.PortalAddress + } + if o.GlobalProtectSatellite.PublishConnectedRoutes != nil { + nestedGlobalProtectSatellite.PublishConnectedRoutes = &GlobalProtectSatellitePublishConnectedRoutes{} + if o.GlobalProtectSatellite.PublishConnectedRoutes.Misc != nil { + entry.Misc["GlobalProtectSatellitePublishConnectedRoutes"] = o.GlobalProtectSatellite.PublishConnectedRoutes.Misc + } + if o.GlobalProtectSatellite.PublishConnectedRoutes.Enable != nil { + nestedGlobalProtectSatellite.PublishConnectedRoutes.Enable = util.AsBool(o.GlobalProtectSatellite.PublishConnectedRoutes.Enable, nil) + } + } + if o.GlobalProtectSatellite.PublishRoutes != nil { + nestedGlobalProtectSatellite.PublishRoutes = util.MemToStr(o.GlobalProtectSatellite.PublishRoutes) + } + } + entry.GlobalProtectSatellite = nestedGlobalProtectSatellite + + var nestedManualKey *ManualKey + if o.ManualKey != nil { + nestedManualKey = &ManualKey{} + if o.ManualKey.Misc != nil { + entry.Misc["ManualKey"] = o.ManualKey.Misc + } + if o.ManualKey.LocalAddress != nil { + nestedManualKey.LocalAddress = &ManualKeyLocalAddress{} + if o.ManualKey.LocalAddress.Misc != nil { + entry.Misc["ManualKeyLocalAddress"] = o.ManualKey.LocalAddress.Misc + } + if o.ManualKey.LocalAddress.Interface != nil { + nestedManualKey.LocalAddress.Interface = o.ManualKey.LocalAddress.Interface + } + if o.ManualKey.LocalAddress.FloatingIp != nil { + nestedManualKey.LocalAddress.FloatingIp = o.ManualKey.LocalAddress.FloatingIp + } + if o.ManualKey.LocalAddress.Ip != nil { + nestedManualKey.LocalAddress.Ip = o.ManualKey.LocalAddress.Ip + } + } + if o.ManualKey.LocalSpi != nil { + nestedManualKey.LocalSpi = o.ManualKey.LocalSpi + } + if o.ManualKey.PeerAddress != nil { + nestedManualKey.PeerAddress = &ManualKeyPeerAddress{} + if o.ManualKey.PeerAddress.Misc != nil { + entry.Misc["ManualKeyPeerAddress"] = o.ManualKey.PeerAddress.Misc + } + if o.ManualKey.PeerAddress.Ip != nil { + nestedManualKey.PeerAddress.Ip = o.ManualKey.PeerAddress.Ip + } + } + if o.ManualKey.RemoteSpi != nil { + nestedManualKey.RemoteSpi = o.ManualKey.RemoteSpi + } + if o.ManualKey.Esp != nil { + nestedManualKey.Esp = &ManualKeyEsp{} + if o.ManualKey.Esp.Misc != nil { + entry.Misc["ManualKeyEsp"] = o.ManualKey.Esp.Misc + } + if o.ManualKey.Esp.Authentication != nil { + nestedManualKey.Esp.Authentication = &ManualKeyEspAuthentication{} + if o.ManualKey.Esp.Authentication.Misc != nil { + entry.Misc["ManualKeyEspAuthentication"] = o.ManualKey.Esp.Authentication.Misc + } + if o.ManualKey.Esp.Authentication.Md5 != nil { + nestedManualKey.Esp.Authentication.Md5 = &ManualKeyEspAuthenticationMd5{} + if o.ManualKey.Esp.Authentication.Md5.Misc != nil { + entry.Misc["ManualKeyEspAuthenticationMd5"] = o.ManualKey.Esp.Authentication.Md5.Misc + } + if o.ManualKey.Esp.Authentication.Md5.Key != nil { + nestedManualKey.Esp.Authentication.Md5.Key = o.ManualKey.Esp.Authentication.Md5.Key + } + } + if o.ManualKey.Esp.Authentication.None != nil { + nestedManualKey.Esp.Authentication.None = &ManualKeyEspAuthenticationNone{} + if o.ManualKey.Esp.Authentication.None.Misc != nil { + entry.Misc["ManualKeyEspAuthenticationNone"] = o.ManualKey.Esp.Authentication.None.Misc + } + } + if o.ManualKey.Esp.Authentication.Sha1 != nil { + nestedManualKey.Esp.Authentication.Sha1 = &ManualKeyEspAuthenticationSha1{} + if o.ManualKey.Esp.Authentication.Sha1.Misc != nil { + entry.Misc["ManualKeyEspAuthenticationSha1"] = o.ManualKey.Esp.Authentication.Sha1.Misc + } + if o.ManualKey.Esp.Authentication.Sha1.Key != nil { + nestedManualKey.Esp.Authentication.Sha1.Key = o.ManualKey.Esp.Authentication.Sha1.Key + } + } + if o.ManualKey.Esp.Authentication.Sha256 != nil { + nestedManualKey.Esp.Authentication.Sha256 = &ManualKeyEspAuthenticationSha256{} + if o.ManualKey.Esp.Authentication.Sha256.Misc != nil { + entry.Misc["ManualKeyEspAuthenticationSha256"] = o.ManualKey.Esp.Authentication.Sha256.Misc + } + if o.ManualKey.Esp.Authentication.Sha256.Key != nil { + nestedManualKey.Esp.Authentication.Sha256.Key = o.ManualKey.Esp.Authentication.Sha256.Key + } + } + if o.ManualKey.Esp.Authentication.Sha384 != nil { + nestedManualKey.Esp.Authentication.Sha384 = &ManualKeyEspAuthenticationSha384{} + if o.ManualKey.Esp.Authentication.Sha384.Misc != nil { + entry.Misc["ManualKeyEspAuthenticationSha384"] = o.ManualKey.Esp.Authentication.Sha384.Misc + } + if o.ManualKey.Esp.Authentication.Sha384.Key != nil { + nestedManualKey.Esp.Authentication.Sha384.Key = o.ManualKey.Esp.Authentication.Sha384.Key + } + } + if o.ManualKey.Esp.Authentication.Sha512 != nil { + nestedManualKey.Esp.Authentication.Sha512 = &ManualKeyEspAuthenticationSha512{} + if o.ManualKey.Esp.Authentication.Sha512.Misc != nil { + entry.Misc["ManualKeyEspAuthenticationSha512"] = o.ManualKey.Esp.Authentication.Sha512.Misc + } + if o.ManualKey.Esp.Authentication.Sha512.Key != nil { + nestedManualKey.Esp.Authentication.Sha512.Key = o.ManualKey.Esp.Authentication.Sha512.Key + } + } + } + if o.ManualKey.Esp.Encryption != nil { + nestedManualKey.Esp.Encryption = &ManualKeyEspEncryption{} + if o.ManualKey.Esp.Encryption.Misc != nil { + entry.Misc["ManualKeyEspEncryption"] = o.ManualKey.Esp.Encryption.Misc + } + if o.ManualKey.Esp.Encryption.Algorithm != nil { + nestedManualKey.Esp.Encryption.Algorithm = o.ManualKey.Esp.Encryption.Algorithm + } + if o.ManualKey.Esp.Encryption.Key != nil { + nestedManualKey.Esp.Encryption.Key = o.ManualKey.Esp.Encryption.Key + } + } + } + if o.ManualKey.Ah != nil { + nestedManualKey.Ah = &ManualKeyAh{} + if o.ManualKey.Ah.Misc != nil { + entry.Misc["ManualKeyAh"] = o.ManualKey.Ah.Misc + } + if o.ManualKey.Ah.Sha256 != nil { + nestedManualKey.Ah.Sha256 = &ManualKeyAhSha256{} + if o.ManualKey.Ah.Sha256.Misc != nil { + entry.Misc["ManualKeyAhSha256"] = o.ManualKey.Ah.Sha256.Misc + } + if o.ManualKey.Ah.Sha256.Key != nil { + nestedManualKey.Ah.Sha256.Key = o.ManualKey.Ah.Sha256.Key + } + } + if o.ManualKey.Ah.Sha384 != nil { + nestedManualKey.Ah.Sha384 = &ManualKeyAhSha384{} + if o.ManualKey.Ah.Sha384.Misc != nil { + entry.Misc["ManualKeyAhSha384"] = o.ManualKey.Ah.Sha384.Misc + } + if o.ManualKey.Ah.Sha384.Key != nil { + nestedManualKey.Ah.Sha384.Key = o.ManualKey.Ah.Sha384.Key + } + } + if o.ManualKey.Ah.Sha512 != nil { + nestedManualKey.Ah.Sha512 = &ManualKeyAhSha512{} + if o.ManualKey.Ah.Sha512.Misc != nil { + entry.Misc["ManualKeyAhSha512"] = o.ManualKey.Ah.Sha512.Misc + } + if o.ManualKey.Ah.Sha512.Key != nil { + nestedManualKey.Ah.Sha512.Key = o.ManualKey.Ah.Sha512.Key + } + } + if o.ManualKey.Ah.Md5 != nil { + nestedManualKey.Ah.Md5 = &ManualKeyAhMd5{} + if o.ManualKey.Ah.Md5.Misc != nil { + entry.Misc["ManualKeyAhMd5"] = o.ManualKey.Ah.Md5.Misc + } + if o.ManualKey.Ah.Md5.Key != nil { + nestedManualKey.Ah.Md5.Key = o.ManualKey.Ah.Md5.Key + } + } + if o.ManualKey.Ah.Sha1 != nil { + nestedManualKey.Ah.Sha1 = &ManualKeyAhSha1{} + if o.ManualKey.Ah.Sha1.Misc != nil { + entry.Misc["ManualKeyAhSha1"] = o.ManualKey.Ah.Sha1.Misc + } + if o.ManualKey.Ah.Sha1.Key != nil { + nestedManualKey.Ah.Sha1.Key = o.ManualKey.Ah.Sha1.Key + } + } + } + } + entry.ManualKey = nestedManualKey + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.BoolsMatch(a.AntiReplay, b.AntiReplay) { + return false + } + if !util.StringsMatch(a.AntiReplayWindow, b.AntiReplayWindow) { + return false + } + if !util.StringsMatch(a.Comment, b.Comment) { + return false + } + if !util.BoolsMatch(a.CopyFlowLabel, b.CopyFlowLabel) { + return false + } + if !util.BoolsMatch(a.CopyTos, b.CopyTos) { + return false + } + if !util.BoolsMatch(a.Disabled, b.Disabled) { + return false + } + if !util.BoolsMatch(a.EnableGreEncapsulation, b.EnableGreEncapsulation) { + return false + } + if !util.StringsMatch(a.IpsecMode, b.IpsecMode) { + return false + } + if !util.BoolsMatch(a.Ipv6, b.Ipv6) { + return false + } + if !util.StringsMatch(a.TunnelInterface, b.TunnelInterface) { + return false + } + if !matchTunnelMonitor(a.TunnelMonitor, b.TunnelMonitor) { + return false + } + if !matchAutoKey(a.AutoKey, b.AutoKey) { + return false + } + if !matchGlobalProtectSatellite(a.GlobalProtectSatellite, b.GlobalProtectSatellite) { + return false + } + if !matchManualKey(a.ManualKey, b.ManualKey) { + return false + } + + return true +} + +func matchTunnelMonitor(a *TunnelMonitor, b *TunnelMonitor) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.ProxyId, b.ProxyId) { + return false + } + if !util.StringsMatch(a.TunnelMonitorProfile, b.TunnelMonitorProfile) { + return false + } + if !util.StringsMatch(a.DestinationIp, b.DestinationIp) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + return true +} +func matchAutoKeyProxyIdV6ProtocolAny(a *AutoKeyProxyIdV6ProtocolAny, b *AutoKeyProxyIdV6ProtocolAny) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchAutoKeyProxyIdV6ProtocolTcp(a *AutoKeyProxyIdV6ProtocolTcp, b *AutoKeyProxyIdV6ProtocolTcp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.LocalPort, b.LocalPort) { + return false + } + if !util.Ints64Match(a.RemotePort, b.RemotePort) { + return false + } + return true +} +func matchAutoKeyProxyIdV6ProtocolUdp(a *AutoKeyProxyIdV6ProtocolUdp, b *AutoKeyProxyIdV6ProtocolUdp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.LocalPort, b.LocalPort) { + return false + } + if !util.Ints64Match(a.RemotePort, b.RemotePort) { + return false + } + return true +} +func matchAutoKeyProxyIdV6Protocol(a *AutoKeyProxyIdV6Protocol, b *AutoKeyProxyIdV6Protocol) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Number, b.Number) { + return false + } + if !matchAutoKeyProxyIdV6ProtocolAny(a.Any, b.Any) { + return false + } + if !matchAutoKeyProxyIdV6ProtocolTcp(a.Tcp, b.Tcp) { + return false + } + if !matchAutoKeyProxyIdV6ProtocolUdp(a.Udp, b.Udp) { + return false + } + return true +} +func matchAutoKeyProxyIdV6(a []AutoKeyProxyIdV6, b []AutoKeyProxyIdV6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.Local, b.Local) { + return false + } + if !util.StringsMatch(a.Remote, b.Remote) { + return false + } + if !matchAutoKeyProxyIdV6Protocol(a.Protocol, b.Protocol) { + return false + } + } + } + return true +} +func matchAutoKeyIkeGateway(a []AutoKeyIkeGateway, b []AutoKeyIkeGateway) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchAutoKeyProxyIdProtocolAny(a *AutoKeyProxyIdProtocolAny, b *AutoKeyProxyIdProtocolAny) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchAutoKeyProxyIdProtocolTcp(a *AutoKeyProxyIdProtocolTcp, b *AutoKeyProxyIdProtocolTcp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.LocalPort, b.LocalPort) { + return false + } + if !util.Ints64Match(a.RemotePort, b.RemotePort) { + return false + } + return true +} +func matchAutoKeyProxyIdProtocolUdp(a *AutoKeyProxyIdProtocolUdp, b *AutoKeyProxyIdProtocolUdp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.LocalPort, b.LocalPort) { + return false + } + if !util.Ints64Match(a.RemotePort, b.RemotePort) { + return false + } + return true +} +func matchAutoKeyProxyIdProtocol(a *AutoKeyProxyIdProtocol, b *AutoKeyProxyIdProtocol) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Number, b.Number) { + return false + } + if !matchAutoKeyProxyIdProtocolAny(a.Any, b.Any) { + return false + } + if !matchAutoKeyProxyIdProtocolTcp(a.Tcp, b.Tcp) { + return false + } + if !matchAutoKeyProxyIdProtocolUdp(a.Udp, b.Udp) { + return false + } + return true +} +func matchAutoKeyProxyId(a []AutoKeyProxyId, b []AutoKeyProxyId) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.Local, b.Local) { + return false + } + if !util.StringsMatch(a.Remote, b.Remote) { + return false + } + if !matchAutoKeyProxyIdProtocol(a.Protocol, b.Protocol) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchAutoKey(a *AutoKey, b *AutoKey) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchAutoKeyProxyId(a.ProxyId, b.ProxyId) { + return false + } + if !matchAutoKeyProxyIdV6(a.ProxyIdV6, b.ProxyIdV6) { + return false + } + if !matchAutoKeyIkeGateway(a.IkeGateway, b.IkeGateway) { + return false + } + if !util.StringsMatch(a.IpsecCryptoProfile, b.IpsecCryptoProfile) { + return false + } + return true +} +func matchGlobalProtectSatelliteLocalAddressIp(a *GlobalProtectSatelliteLocalAddressIp, b *GlobalProtectSatelliteLocalAddressIp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Ipv4, b.Ipv4) { + return false + } + if !util.StringsMatch(a.Ipv6, b.Ipv6) { + return false + } + return true +} +func matchGlobalProtectSatelliteLocalAddressFloatingIp(a *GlobalProtectSatelliteLocalAddressFloatingIp, b *GlobalProtectSatelliteLocalAddressFloatingIp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Ipv4, b.Ipv4) { + return false + } + if !util.StringsMatch(a.Ipv6, b.Ipv6) { + return false + } + return true +} +func matchGlobalProtectSatelliteLocalAddress(a *GlobalProtectSatelliteLocalAddress, b *GlobalProtectSatelliteLocalAddress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Interface, b.Interface) { + return false + } + if !matchGlobalProtectSatelliteLocalAddressFloatingIp(a.FloatingIp, b.FloatingIp) { + return false + } + if !matchGlobalProtectSatelliteLocalAddressIp(a.Ip, b.Ip) { + return false + } + return true +} +func matchGlobalProtectSatellitePublishConnectedRoutes(a *GlobalProtectSatellitePublishConnectedRoutes, b *GlobalProtectSatellitePublishConnectedRoutes) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + return true +} +func matchGlobalProtectSatelliteExternalCa(a *GlobalProtectSatelliteExternalCa, b *GlobalProtectSatelliteExternalCa) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.CertificateProfile, b.CertificateProfile) { + return false + } + if !util.StringsMatch(a.LocalCertificate, b.LocalCertificate) { + return false + } + return true +} +func matchGlobalProtectSatellite(a *GlobalProtectSatellite, b *GlobalProtectSatellite) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchGlobalProtectSatelliteExternalCa(a.ExternalCa, b.ExternalCa) { + return false + } + if !util.BoolsMatch(a.Ipv6Preferred, b.Ipv6Preferred) { + return false + } + if !matchGlobalProtectSatelliteLocalAddress(a.LocalAddress, b.LocalAddress) { + return false + } + if !util.StringsMatch(a.PortalAddress, b.PortalAddress) { + return false + } + if !matchGlobalProtectSatellitePublishConnectedRoutes(a.PublishConnectedRoutes, b.PublishConnectedRoutes) { + return false + } + if !util.OrderedListsMatch(a.PublishRoutes, b.PublishRoutes) { + return false + } + return true +} +func matchManualKeyLocalAddress(a *ManualKeyLocalAddress, b *ManualKeyLocalAddress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Interface, b.Interface) { + return false + } + if !util.StringsMatch(a.FloatingIp, b.FloatingIp) { + return false + } + if !util.StringsMatch(a.Ip, b.Ip) { + return false + } + return true +} +func matchManualKeyPeerAddress(a *ManualKeyPeerAddress, b *ManualKeyPeerAddress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Ip, b.Ip) { + return false + } + return true +} +func matchManualKeyEspEncryption(a *ManualKeyEspEncryption, b *ManualKeyEspEncryption) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Algorithm, b.Algorithm) { + return false + } + if !util.StringsMatch(a.Key, b.Key) { + return false + } + return true +} +func matchManualKeyEspAuthenticationMd5(a *ManualKeyEspAuthenticationMd5, b *ManualKeyEspAuthenticationMd5) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Key, b.Key) { + return false + } + return true +} +func matchManualKeyEspAuthenticationNone(a *ManualKeyEspAuthenticationNone, b *ManualKeyEspAuthenticationNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchManualKeyEspAuthenticationSha1(a *ManualKeyEspAuthenticationSha1, b *ManualKeyEspAuthenticationSha1) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Key, b.Key) { + return false + } + return true +} +func matchManualKeyEspAuthenticationSha256(a *ManualKeyEspAuthenticationSha256, b *ManualKeyEspAuthenticationSha256) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Key, b.Key) { + return false + } + return true +} +func matchManualKeyEspAuthenticationSha384(a *ManualKeyEspAuthenticationSha384, b *ManualKeyEspAuthenticationSha384) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Key, b.Key) { + return false + } + return true +} +func matchManualKeyEspAuthenticationSha512(a *ManualKeyEspAuthenticationSha512, b *ManualKeyEspAuthenticationSha512) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Key, b.Key) { + return false + } + return true +} +func matchManualKeyEspAuthentication(a *ManualKeyEspAuthentication, b *ManualKeyEspAuthentication) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchManualKeyEspAuthenticationMd5(a.Md5, b.Md5) { + return false + } + if !matchManualKeyEspAuthenticationNone(a.None, b.None) { + return false + } + if !matchManualKeyEspAuthenticationSha1(a.Sha1, b.Sha1) { + return false + } + if !matchManualKeyEspAuthenticationSha256(a.Sha256, b.Sha256) { + return false + } + if !matchManualKeyEspAuthenticationSha384(a.Sha384, b.Sha384) { + return false + } + if !matchManualKeyEspAuthenticationSha512(a.Sha512, b.Sha512) { + return false + } + return true +} +func matchManualKeyEsp(a *ManualKeyEsp, b *ManualKeyEsp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchManualKeyEspAuthentication(a.Authentication, b.Authentication) { + return false + } + if !matchManualKeyEspEncryption(a.Encryption, b.Encryption) { + return false + } + return true +} +func matchManualKeyAhSha1(a *ManualKeyAhSha1, b *ManualKeyAhSha1) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Key, b.Key) { + return false + } + return true +} +func matchManualKeyAhSha256(a *ManualKeyAhSha256, b *ManualKeyAhSha256) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Key, b.Key) { + return false + } + return true +} +func matchManualKeyAhSha384(a *ManualKeyAhSha384, b *ManualKeyAhSha384) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Key, b.Key) { + return false + } + return true +} +func matchManualKeyAhSha512(a *ManualKeyAhSha512, b *ManualKeyAhSha512) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Key, b.Key) { + return false + } + return true +} +func matchManualKeyAhMd5(a *ManualKeyAhMd5, b *ManualKeyAhMd5) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Key, b.Key) { + return false + } + return true +} +func matchManualKeyAh(a *ManualKeyAh, b *ManualKeyAh) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchManualKeyAhMd5(a.Md5, b.Md5) { + return false + } + if !matchManualKeyAhSha1(a.Sha1, b.Sha1) { + return false + } + if !matchManualKeyAhSha256(a.Sha256, b.Sha256) { + return false + } + if !matchManualKeyAhSha384(a.Sha384, b.Sha384) { + return false + } + if !matchManualKeyAhSha512(a.Sha512, b.Sha512) { + return false + } + return true +} +func matchManualKey(a *ManualKey, b *ManualKey) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchManualKeyLocalAddress(a.LocalAddress, b.LocalAddress) { + return false + } + if !util.StringsMatch(a.LocalSpi, b.LocalSpi) { + return false + } + if !matchManualKeyPeerAddress(a.PeerAddress, b.PeerAddress) { + return false + } + if !util.StringsMatch(a.RemoteSpi, b.RemoteSpi) { + return false + } + if !matchManualKeyAh(a.Ah, b.Ah) { + return false + } + if !matchManualKeyEsp(a.Esp, b.Esp) { + return false + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/network/tunnel/ipsec/interfaces.go b/network/tunnel/ipsec/interfaces.go new file mode 100644 index 00000000..fabf2377 --- /dev/null +++ b/network/tunnel/ipsec/interfaces.go @@ -0,0 +1,7 @@ +package ipsec + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/network/tunnel/ipsec/location.go b/network/tunnel/ipsec/location.go new file mode 100644 index 00000000..c5b2d7a4 --- /dev/null +++ b/network/tunnel/ipsec/location.go @@ -0,0 +1,162 @@ +package ipsec + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + Template *TemplateLocation `json:"template,omitempty"` + TemplateStack *TemplateStackLocation `json:"template_stack,omitempty"` +} + +type TemplateLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + Template string `json:"template"` +} + +type TemplateStackLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + TemplateStack string `json:"template_stack"` +} + +func NewTemplateLocation() *Location { + return &Location{Template: &TemplateLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + Template: "", + }, + } +} +func NewTemplateStackLocation() *Location { + return &Location{TemplateStack: &TemplateStackLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + TemplateStack: "", + }, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return fmt.Errorf("Template is unspecified") + } + count++ + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return fmt.Errorf("TemplateStack is unspecified") + } + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return nil, fmt.Errorf("Template is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Template.PanoramaDevice}), + "template", + util.AsEntryXpath([]string{o.Template.Template}), + "config", + "devices", + util.AsEntryXpath([]string{o.Template.NgfwDevice}), + } + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return nil, fmt.Errorf("TemplateStack is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.PanoramaDevice}), + "template-stack", + util.AsEntryXpath([]string{o.TemplateStack.TemplateStack}), + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.NgfwDevice}), + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/network/tunnel/ipsec/service.go b/network/tunnel/ipsec/service.go new file mode 100644 index 00000000..fa0074d5 --- /dev/null +++ b/network/tunnel/ipsec/service.go @@ -0,0 +1,281 @@ +package ipsec + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/network/virtual_router/entry.go b/network/virtual_router/entry.go index ed83568b..aa7db077 100644 --- a/network/virtual_router/entry.go +++ b/network/virtual_router/entry.go @@ -19,17 +19,18 @@ var ( ) type Entry struct { - Name string - AdministrativeDistances *AdministrativeDistances - Ecmp *Ecmp - Interfaces []string - Protocol *Protocol - RoutingTable *RoutingTable + Name string + AdminDists *AdminDists + Ecmp *Ecmp + Interface []string + Multicast *Multicast + Protocol *Protocol + RoutingTable *RoutingTable Misc map[string][]generic.Xml } -type AdministrativeDistances struct { +type AdminDists struct { Ebgp *int64 Ibgp *int64 OspfExt *int64 @@ -43,7 +44,7 @@ type AdministrativeDistances struct { type Ecmp struct { Algorithm *EcmpAlgorithm Enable *bool - MaxPaths *int64 + MaxPath *int64 StrictSourcePath *bool SymmetricReturn *bool } @@ -63,870 +64,13142 @@ type EcmpAlgorithmIpHash struct { type EcmpAlgorithmIpModulo struct { } type EcmpAlgorithmWeightedRoundRobin struct { - Interfaces []EcmpAlgorithmWeightedRoundRobinInterfaces + Interface []EcmpAlgorithmWeightedRoundRobinInterface } -type EcmpAlgorithmWeightedRoundRobinInterfaces struct { +type EcmpAlgorithmWeightedRoundRobinInterface struct { Name string Weight *int64 } +type Multicast struct { + Enable *bool + InterfaceGroup []MulticastInterfaceGroup + RouteAgeoutTime *int64 + Rp *MulticastRp + SptThreshold []MulticastSptThreshold + SsmAddressSpace []MulticastSsmAddressSpace +} +type MulticastInterfaceGroup struct { + Description *string + GroupPermission *MulticastInterfaceGroupGroupPermission + Igmp *MulticastInterfaceGroupIgmp + Interface []string + Name string + Pim *MulticastInterfaceGroupPim +} +type MulticastInterfaceGroupGroupPermission struct { + AnySourceMulticast []MulticastInterfaceGroupGroupPermissionAnySourceMulticast + SourceSpecificMulticast []MulticastInterfaceGroupGroupPermissionSourceSpecificMulticast +} +type MulticastInterfaceGroupGroupPermissionAnySourceMulticast struct { + GroupAddress *string + Included *bool + Name string +} +type MulticastInterfaceGroupGroupPermissionSourceSpecificMulticast struct { + GroupAddress *string + Included *bool + Name string + SourceAddress *string +} +type MulticastInterfaceGroupIgmp struct { + Enable *bool + ImmediateLeave *bool + LastMemberQueryInterval *float64 + MaxGroups *string + MaxQueryResponseTime *float64 + MaxSources *string + QueryInterval *int64 + Robustness *string + RouterAlertPolicing *bool + Version *string +} +type MulticastInterfaceGroupPim struct { + AllowedNeighbors []MulticastInterfaceGroupPimAllowedNeighbors + AssertInterval *int64 + BsrBorder *bool + DrPriority *int64 + Enable *bool + HelloInterval *int64 + JoinPruneInterval *int64 +} +type MulticastInterfaceGroupPimAllowedNeighbors struct { + Name string +} +type MulticastRp struct { + ExternalRp []MulticastRpExternalRp + LocalRp *MulticastRpLocalRp +} +type MulticastRpExternalRp struct { + GroupAddresses []string + Name string + Override *bool +} +type MulticastRpLocalRp struct { + CandidateRp *MulticastRpLocalRpCandidateRp + StaticRp *MulticastRpLocalRpStaticRp +} +type MulticastRpLocalRpCandidateRp struct { + Address *string + AdvertisementInterval *int64 + GroupAddresses []string + Interface *string + Priority *int64 +} +type MulticastRpLocalRpStaticRp struct { + Address *string + GroupAddresses []string + Interface *string + Override *bool +} +type MulticastSptThreshold struct { + Name string + Threshold *string +} +type MulticastSsmAddressSpace struct { + GroupAddress *string + Included *bool + Name string +} type Protocol struct { - Bgp *ProtocolBgp - Ospf *ProtocolOspf - Ospfv3 *ProtocolOspfv3 - Rip *ProtocolRip + Bgp *ProtocolBgp + Ospf *ProtocolOspf + Ospfv3 *ProtocolOspfv3 + RedistProfile []ProtocolRedistProfile + RedistProfileIpv6 []ProtocolRedistProfileIpv6 + Rip *ProtocolRip } type ProtocolBgp struct { + AllowRedistDefaultRoute *bool + AuthProfile []ProtocolBgpAuthProfile + DampeningProfile []ProtocolBgpDampeningProfile + EcmpMultiAs *bool + Enable *bool + EnforceFirstAs *bool + GlobalBfd *ProtocolBgpGlobalBfd + InstallRoute *bool + LocalAs *string + PeerGroup []ProtocolBgpPeerGroup + Policy *ProtocolBgpPolicy + RedistRules []ProtocolBgpRedistRules + RejectDefaultRoute *bool + RouterId *string + RoutingOptions *ProtocolBgpRoutingOptions +} +type ProtocolBgpAuthProfile struct { + Name string + Secret *string +} +type ProtocolBgpDampeningProfile struct { + Cutoff *float64 + DecayHalfLifeReachable *int64 + DecayHalfLifeUnreachable *int64 + Enable *bool + MaxHoldTime *int64 + Name string + Reuse *float64 +} +type ProtocolBgpGlobalBfd struct { + Profile *string +} +type ProtocolBgpPeerGroup struct { + AggregatedConfedAsPath *bool + Enable *bool + Name string + Peer []ProtocolBgpPeerGroupPeer + SoftResetWithStoredInfo *bool + Type *ProtocolBgpPeerGroupType +} +type ProtocolBgpPeerGroupPeer struct { + AddressFamilyIdentifier *string + Bfd *ProtocolBgpPeerGroupPeerBfd + ConnectionOptions *ProtocolBgpPeerGroupPeerConnectionOptions + Enable *bool + EnableMpBgp *bool + EnableSenderSideLoopDetection *bool + LocalAddress *ProtocolBgpPeerGroupPeerLocalAddress + MaxPrefixes *string + Name string + PeerAddress *ProtocolBgpPeerGroupPeerPeerAddress + PeerAs *string + PeeringType *string + ReflectorClient *string + SubsequentAddressFamilyIdentifier *ProtocolBgpPeerGroupPeerSubsequentAddressFamilyIdentifier +} +type ProtocolBgpPeerGroupPeerBfd struct { + Profile *string +} +type ProtocolBgpPeerGroupPeerConnectionOptions struct { + Authentication *string + HoldTime *string + IdleHoldTime *int64 + IncomingBgpConnection *ProtocolBgpPeerGroupPeerConnectionOptionsIncomingBgpConnection + KeepAliveInterval *string + MinRouteAdvInterval *int64 + Multihop *int64 + OpenDelayTime *int64 + OutgoingBgpConnection *ProtocolBgpPeerGroupPeerConnectionOptionsOutgoingBgpConnection +} +type ProtocolBgpPeerGroupPeerConnectionOptionsIncomingBgpConnection struct { + Allow *bool + RemotePort *int64 +} +type ProtocolBgpPeerGroupPeerConnectionOptionsOutgoingBgpConnection struct { + Allow *bool + LocalPort *int64 +} +type ProtocolBgpPeerGroupPeerLocalAddress struct { + Interface *string + Ip *string +} +type ProtocolBgpPeerGroupPeerPeerAddress struct { + Fqdn *string + Ip *string +} +type ProtocolBgpPeerGroupPeerSubsequentAddressFamilyIdentifier struct { + Multicast *bool + Unicast *bool +} +type ProtocolBgpPeerGroupType struct { + Ebgp *ProtocolBgpPeerGroupTypeEbgp + EbgpConfed *ProtocolBgpPeerGroupTypeEbgpConfed + Ibgp *ProtocolBgpPeerGroupTypeIbgp + IbgpConfed *ProtocolBgpPeerGroupTypeIbgpConfed +} +type ProtocolBgpPeerGroupTypeEbgp struct { + ExportNexthop *string + ImportNexthop *string + RemovePrivateAs *bool +} +type ProtocolBgpPeerGroupTypeEbgpConfed struct { + ExportNexthop *string +} +type ProtocolBgpPeerGroupTypeIbgp struct { + ExportNexthop *string +} +type ProtocolBgpPeerGroupTypeIbgpConfed struct { + ExportNexthop *string +} +type ProtocolBgpPolicy struct { + Aggregation *ProtocolBgpPolicyAggregation + ConditionalAdvertisement *ProtocolBgpPolicyConditionalAdvertisement + Export *ProtocolBgpPolicyExport + Import *ProtocolBgpPolicyImport +} +type ProtocolBgpPolicyAggregation struct { + Address []ProtocolBgpPolicyAggregationAddress +} +type ProtocolBgpPolicyAggregationAddress struct { + AdvertiseFilters []ProtocolBgpPolicyAggregationAddressAdvertiseFilters + AggregateRouteAttributes *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributes + AsSet *bool + Enable *bool + Name string + Prefix *string + Summary *bool + SuppressFilters []ProtocolBgpPolicyAggregationAddressSuppressFilters +} +type ProtocolBgpPolicyAggregationAddressAdvertiseFilters struct { Enable *bool + Match *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatch + Name string } -type ProtocolOspf struct { +type ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatch struct { + AddressPrefix []ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix + AsPath *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAsPath + Community *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchCommunity + ExtendedCommunity *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchExtendedCommunity + FromPeer []string + Med *int64 + Nexthop []string + RouteTable *string +} +type ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix struct { + Exact *bool + Name string +} +type ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAsPath struct { + Regex *string +} +type ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchCommunity struct { + Regex *string +} +type ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchExtendedCommunity struct { + Regex *string +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributes struct { + AsPath *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPath + AsPathLimit *int64 + Community *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunity + ExtendedCommunity *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunity + LocalPreference *int64 + Med *int64 + Nexthop *string + Origin *string + Weight *int64 +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPath struct { + None *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathNone + Prepend *int64 + Remove *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathRemove +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathNone struct { +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathRemove struct { +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunity struct { + Append []string + None *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityNone + Overwrite []string + RemoveAll *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityRemoveAll + RemoveRegex *string +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityNone struct { +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityRemoveAll struct { +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunity struct { + Append []string + None *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityNone + Overwrite []string + RemoveAll *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityRemoveAll + RemoveRegex *string +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityNone struct { +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityRemoveAll struct { +} +type ProtocolBgpPolicyAggregationAddressSuppressFilters struct { Enable *bool + Match *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatch + Name string } -type ProtocolOspfv3 struct { +type ProtocolBgpPolicyAggregationAddressSuppressFiltersMatch struct { + AddressPrefix []ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix + AsPath *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAsPath + Community *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchCommunity + ExtendedCommunity *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchExtendedCommunity + FromPeer []string + Med *int64 + Nexthop []string + RouteTable *string +} +type ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix struct { + Exact *bool + Name string +} +type ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAsPath struct { + Regex *string +} +type ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchCommunity struct { + Regex *string +} +type ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchExtendedCommunity struct { + Regex *string +} +type ProtocolBgpPolicyConditionalAdvertisement struct { + Policy []ProtocolBgpPolicyConditionalAdvertisementPolicy +} +type ProtocolBgpPolicyConditionalAdvertisementPolicy struct { + AdvertiseFilters []ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters + Enable *bool + Name string + NonExistFilters []ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters + UsedBy []string +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters struct { Enable *bool + Match *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatch + Name string } -type ProtocolRip struct { +type ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatch struct { + AddressPrefix []ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix + AsPath *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAsPath + Community *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchCommunity + ExtendedCommunity *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchExtendedCommunity + FromPeer []string + Med *int64 + Nexthop []string + RouteTable *string +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix struct { + Name string +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAsPath struct { + Regex *string +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchCommunity struct { + Regex *string +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchExtendedCommunity struct { + Regex *string +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters struct { Enable *bool + Match *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatch + Name string } -type RoutingTable struct { - Ip *RoutingTableIp - Ipv6 *RoutingTableIpv6 +type ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatch struct { + AddressPrefix []ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix + AsPath *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAsPath + Community *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchCommunity + ExtendedCommunity *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchExtendedCommunity + FromPeer []string + Med *int64 + Nexthop []string + RouteTable *string } -type RoutingTableIp struct { - StaticRoutes []RoutingTableIpStaticRoutes +type ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix struct { + Name string } -type RoutingTableIpStaticRoutes struct { - AdminDist *int64 - Destination *string - Interface *string - Metric *int64 - Name string - NextHop *RoutingTableIpStaticRoutesNextHop - RouteTable *string +type ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAsPath struct { + Regex *string } -type RoutingTableIpStaticRoutesNextHop struct { - Fqdn *string - IpAddress *string - NextVr *string - Tunnel *string +type ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchCommunity struct { + Regex *string } -type RoutingTableIpv6 struct { - StaticRoutes []RoutingTableIpv6StaticRoutes +type ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchExtendedCommunity struct { + Regex *string } -type RoutingTableIpv6StaticRoutes struct { - AdminDist *int64 - Destination *string - Interface *string - Metric *int64 +type ProtocolBgpPolicyExport struct { + Rules []ProtocolBgpPolicyExportRules +} +type ProtocolBgpPolicyExportRules struct { + Action *ProtocolBgpPolicyExportRulesAction + Enable *bool + Match *ProtocolBgpPolicyExportRulesMatch + Name string + UsedBy []string +} +type ProtocolBgpPolicyExportRulesAction struct { + Allow *ProtocolBgpPolicyExportRulesActionAllow + Deny *ProtocolBgpPolicyExportRulesActionDeny +} +type ProtocolBgpPolicyExportRulesActionAllow struct { + Update *ProtocolBgpPolicyExportRulesActionAllowUpdate +} +type ProtocolBgpPolicyExportRulesActionAllowUpdate struct { + AsPath *ProtocolBgpPolicyExportRulesActionAllowUpdateAsPath + AsPathLimit *int64 + Community *ProtocolBgpPolicyExportRulesActionAllowUpdateCommunity + ExtendedCommunity *ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunity + LocalPreference *int64 + Med *int64 + Nexthop *string + Origin *string +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateAsPath struct { + None *ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathNone + Prepend *int64 + Remove *ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathRemove + RemoveAndPrepend *int64 +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathNone struct { +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathRemove struct { +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateCommunity struct { + Append []string + None *ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityNone + Overwrite []string + RemoveAll *ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityRemoveAll + RemoveRegex *string +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityNone struct { +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityRemoveAll struct { +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunity struct { + Append []string + None *ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityNone + Overwrite []string + RemoveAll *ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityRemoveAll + RemoveRegex *string +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityNone struct { +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityRemoveAll struct { +} +type ProtocolBgpPolicyExportRulesActionDeny struct { +} +type ProtocolBgpPolicyExportRulesMatch struct { + AddressPrefix []ProtocolBgpPolicyExportRulesMatchAddressPrefix + AsPath *ProtocolBgpPolicyExportRulesMatchAsPath + Community *ProtocolBgpPolicyExportRulesMatchCommunity + ExtendedCommunity *ProtocolBgpPolicyExportRulesMatchExtendedCommunity + FromPeer []string + Med *int64 + Nexthop []string + RouteTable *string +} +type ProtocolBgpPolicyExportRulesMatchAddressPrefix struct { + Exact *bool + Name string +} +type ProtocolBgpPolicyExportRulesMatchAsPath struct { + Regex *string +} +type ProtocolBgpPolicyExportRulesMatchCommunity struct { + Regex *string +} +type ProtocolBgpPolicyExportRulesMatchExtendedCommunity struct { + Regex *string +} +type ProtocolBgpPolicyImport struct { + Rules []ProtocolBgpPolicyImportRules +} +type ProtocolBgpPolicyImportRules struct { + Action *ProtocolBgpPolicyImportRulesAction + Enable *bool + Match *ProtocolBgpPolicyImportRulesMatch + Name string + UsedBy []string +} +type ProtocolBgpPolicyImportRulesAction struct { + Allow *ProtocolBgpPolicyImportRulesActionAllow + Deny *ProtocolBgpPolicyImportRulesActionDeny +} +type ProtocolBgpPolicyImportRulesActionAllow struct { + Dampening *string + Update *ProtocolBgpPolicyImportRulesActionAllowUpdate +} +type ProtocolBgpPolicyImportRulesActionAllowUpdate struct { + AsPath *ProtocolBgpPolicyImportRulesActionAllowUpdateAsPath + AsPathLimit *int64 + Community *ProtocolBgpPolicyImportRulesActionAllowUpdateCommunity + ExtendedCommunity *ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunity + LocalPreference *int64 + Med *int64 + Nexthop *string + Origin *string + Weight *int64 +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateAsPath struct { + None *ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathNone + Remove *ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathRemove +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathNone struct { +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathRemove struct { +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateCommunity struct { + Append []string + None *ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityNone + Overwrite []string + RemoveAll *ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityRemoveAll + RemoveRegex *string +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityNone struct { +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityRemoveAll struct { +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunity struct { + Append []string + None *ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityNone + Overwrite []string + RemoveAll *ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityRemoveAll + RemoveRegex *string +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityNone struct { +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityRemoveAll struct { +} +type ProtocolBgpPolicyImportRulesActionDeny struct { +} +type ProtocolBgpPolicyImportRulesMatch struct { + AddressPrefix []ProtocolBgpPolicyImportRulesMatchAddressPrefix + AsPath *ProtocolBgpPolicyImportRulesMatchAsPath + Community *ProtocolBgpPolicyImportRulesMatchCommunity + ExtendedCommunity *ProtocolBgpPolicyImportRulesMatchExtendedCommunity + FromPeer []string + Med *int64 + Nexthop []string + RouteTable *string +} +type ProtocolBgpPolicyImportRulesMatchAddressPrefix struct { + Exact *bool + Name string +} +type ProtocolBgpPolicyImportRulesMatchAsPath struct { + Regex *string +} +type ProtocolBgpPolicyImportRulesMatchCommunity struct { + Regex *string +} +type ProtocolBgpPolicyImportRulesMatchExtendedCommunity struct { + Regex *string +} +type ProtocolBgpRedistRules struct { + AddressFamilyIdentifier *string + Enable *bool + Metric *int64 + Name string + RouteTable *string + SetAsPathLimit *int64 + SetCommunity []string + SetExtendedCommunity []string + SetLocalPreference *int64 + SetMed *int64 + SetOrigin *string +} +type ProtocolBgpRoutingOptions struct { + Aggregate *ProtocolBgpRoutingOptionsAggregate + AsFormat *string + ConfederationMemberAs *string + DefaultLocalPreference *int64 + GracefulRestart *ProtocolBgpRoutingOptionsGracefulRestart + Med *ProtocolBgpRoutingOptionsMed + ReflectorClusterId *string +} +type ProtocolBgpRoutingOptionsAggregate struct { + AggregateMed *bool +} +type ProtocolBgpRoutingOptionsGracefulRestart struct { + Enable *bool + LocalRestartTime *int64 + MaxPeerRestartTime *int64 + StaleRouteTime *int64 +} +type ProtocolBgpRoutingOptionsMed struct { + AlwaysCompareMed *bool + DeterministicMedComparison *bool +} +type ProtocolOspf struct { + AllowRedistDefaultRoute *bool + Area []ProtocolOspfArea + AuthProfile []ProtocolOspfAuthProfile + Enable *bool + ExportRules []ProtocolOspfExportRules + GlobalBfd *ProtocolOspfGlobalBfd + GracefulRestart *ProtocolOspfGracefulRestart + RejectDefaultRoute *bool + Rfc1583 *bool + RouterId *string + Timers *ProtocolOspfTimers +} +type ProtocolOspfArea struct { + Interface []ProtocolOspfAreaInterface Name string - NextHop *RoutingTableIpv6StaticRoutesNextHop - RouteTable *string + Range []ProtocolOspfAreaRange + Type *ProtocolOspfAreaType + VirtualLink []ProtocolOspfAreaVirtualLink } -type RoutingTableIpv6StaticRoutesNextHop struct { - Fqdn *string - Ipv6Address *string - NextVr *string - Tunnel *string +type ProtocolOspfAreaInterface struct { + Authentication *string + Bfd *ProtocolOspfAreaInterfaceBfd + DeadCounts *int64 + Enable *bool + GrDelay *int64 + HelloInterval *int64 + LinkType *ProtocolOspfAreaInterfaceLinkType + Metric *int64 + Name string + Neighbor []ProtocolOspfAreaInterfaceNeighbor + Passive *bool + Priority *int64 + RetransmitInterval *int64 + TransitDelay *int64 } - -type entryXmlContainer struct { - Answer []entryXml `xml:"entry"` +type ProtocolOspfAreaInterfaceBfd struct { + Profile *string } - -type entryXml struct { - XMLName xml.Name `xml:"entry"` - Name string `xml:"name,attr"` - AdministrativeDistances *AdministrativeDistancesXml `xml:"admin-dists,omitempty"` - Ecmp *EcmpXml `xml:"ecmp,omitempty"` - Interfaces *util.MemberType `xml:"interface,omitempty"` - Protocol *ProtocolXml `xml:"protocol,omitempty"` - RoutingTable *RoutingTableXml `xml:"routing-table,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaInterfaceLinkType struct { + Broadcast *ProtocolOspfAreaInterfaceLinkTypeBroadcast + P2mp *ProtocolOspfAreaInterfaceLinkTypeP2mp + P2p *ProtocolOspfAreaInterfaceLinkTypeP2p } - -type AdministrativeDistancesXml struct { - Ebgp *int64 `xml:"ebgp,omitempty"` - Ibgp *int64 `xml:"ibgp,omitempty"` - OspfExt *int64 `xml:"ospf-ext,omitempty"` - OspfInt *int64 `xml:"ospf-int,omitempty"` - Ospfv3Ext *int64 `xml:"ospfv3-ext,omitempty"` - Ospfv3Int *int64 `xml:"ospfv3-int,omitempty"` - Rip *int64 `xml:"rip,omitempty"` - Static *int64 `xml:"static,omitempty"` - StaticIpv6 *int64 `xml:"static-ipv6,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaInterfaceLinkTypeBroadcast struct { } -type EcmpXml struct { - Algorithm *EcmpAlgorithmXml `xml:"algorithm,omitempty"` - Enable *string `xml:"enable,omitempty"` - MaxPaths *int64 `xml:"max-path,omitempty"` - StrictSourcePath *string `xml:"strict-source-path,omitempty"` - SymmetricReturn *string `xml:"symmetric-return,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaInterfaceLinkTypeP2mp struct { } -type EcmpAlgorithmXml struct { - BalancedRoundRobin *EcmpAlgorithmBalancedRoundRobinXml `xml:"balanced-round-robin,omitempty"` - IpHash *EcmpAlgorithmIpHashXml `xml:"ip-hash,omitempty"` - IpModulo *EcmpAlgorithmIpModuloXml `xml:"ip-modulo,omitempty"` - WeightedRoundRobin *EcmpAlgorithmWeightedRoundRobinXml `xml:"weighted-round-robin,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaInterfaceLinkTypeP2p struct { } -type EcmpAlgorithmBalancedRoundRobinXml struct { - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaInterfaceNeighbor struct { + Name string } -type EcmpAlgorithmIpHashXml struct { - HashSeed *int64 `xml:"hash-seed,omitempty"` - SrcOnly *string `xml:"src-only,omitempty"` - UsePort *string `xml:"use-port,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaRange struct { + Name string + Advertise *ProtocolOspfAreaRangeAdvertise + Suppress *ProtocolOspfAreaRangeSuppress } -type EcmpAlgorithmIpModuloXml struct { - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaRangeAdvertise struct { } -type EcmpAlgorithmWeightedRoundRobinXml struct { - Interfaces []EcmpAlgorithmWeightedRoundRobinInterfacesXml `xml:"interface>entry,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaRangeSuppress struct { } -type EcmpAlgorithmWeightedRoundRobinInterfacesXml struct { - XMLName xml.Name `xml:"entry"` - Name string `xml:"name,attr"` - Weight *int64 - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaType struct { + Normal *ProtocolOspfAreaTypeNormal + Nssa *ProtocolOspfAreaTypeNssa + Stub *ProtocolOspfAreaTypeStub } -type ProtocolXml struct { - Bgp *ProtocolBgpXml `xml:"bgp,omitempty"` - Ospf *ProtocolOspfXml `xml:"ospf,omitempty"` - Ospfv3 *ProtocolOspfv3Xml `xml:"ospfv3,omitempty"` - Rip *ProtocolRipXml `xml:"rip,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaTypeNormal struct { } -type ProtocolBgpXml struct { - Enable *string `xml:"enable,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaTypeNssa struct { + AcceptSummary *bool + DefaultRoute *ProtocolOspfAreaTypeNssaDefaultRoute + NssaExtRange []ProtocolOspfAreaTypeNssaNssaExtRange } -type ProtocolOspfXml struct { - Enable *string `xml:"enable,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaTypeNssaDefaultRoute struct { + Advertise *ProtocolOspfAreaTypeNssaDefaultRouteAdvertise + Disable *ProtocolOspfAreaTypeNssaDefaultRouteDisable } -type ProtocolOspfv3Xml struct { - Enable *string `xml:"enable,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaTypeNssaDefaultRouteAdvertise struct { + Metric *int64 + Type *string } -type ProtocolRipXml struct { - Enable *string `xml:"enable,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaTypeNssaDefaultRouteDisable struct { } -type RoutingTableXml struct { - Ip *RoutingTableIpXml `xml:"ip,omitempty"` - Ipv6 *RoutingTableIpv6Xml `xml:"ipv6,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaTypeNssaNssaExtRange struct { + Name string + Advertise *ProtocolOspfAreaTypeNssaNssaExtRangeAdvertise + Suppress *ProtocolOspfAreaTypeNssaNssaExtRangeSuppress } -type RoutingTableIpXml struct { - StaticRoutes []RoutingTableIpStaticRoutesXml `xml:"static-route>entry,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaTypeNssaNssaExtRangeAdvertise struct { } -type RoutingTableIpStaticRoutesXml struct { - AdminDist *int64 `xml:"admin-dist,omitempty"` - Destination *string `xml:"destination,omitempty"` - Interface *string `xml:"interface,omitempty"` - Metric *int64 `xml:"metric,omitempty"` - XMLName xml.Name `xml:"entry"` - Name string `xml:"name,attr"` - NextHop *RoutingTableIpStaticRoutesNextHopXml `xml:"nexthop,omitempty"` - RouteTable *string `xml:"route-table,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaTypeNssaNssaExtRangeSuppress struct { } -type RoutingTableIpStaticRoutesNextHopXml struct { - Fqdn *string `xml:"fqdn,omitempty"` - IpAddress *string `xml:"ip-address,omitempty"` - NextVr *string `xml:"next-vr,omitempty"` - Tunnel *string `xml:"tunnel,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaTypeStub struct { + AcceptSummary *bool + DefaultRoute *ProtocolOspfAreaTypeStubDefaultRoute } -type RoutingTableIpv6Xml struct { - StaticRoutes []RoutingTableIpv6StaticRoutesXml `xml:"static-route>entry,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaTypeStubDefaultRoute struct { + Advertise *ProtocolOspfAreaTypeStubDefaultRouteAdvertise + Disable *ProtocolOspfAreaTypeStubDefaultRouteDisable } -type RoutingTableIpv6StaticRoutesXml struct { - AdminDist *int64 `xml:"admin-dist,omitempty"` - Destination *string `xml:"destination,omitempty"` - Interface *string `xml:"interface,omitempty"` - Metric *int64 `xml:"metric,omitempty"` - XMLName xml.Name `xml:"entry"` - Name string `xml:"name,attr"` - NextHop *RoutingTableIpv6StaticRoutesNextHopXml `xml:"nexthop,omitempty"` - RouteTable *string `xml:"route-table,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaTypeStubDefaultRouteAdvertise struct { + Metric *int64 } -type RoutingTableIpv6StaticRoutesNextHopXml struct { - Fqdn *string `xml:"fqdn,omitempty"` - Ipv6Address *string `xml:"ipv6-address,omitempty"` - NextVr *string `xml:"next-vr,omitempty"` - Tunnel *string `xml:"tunnel,omitempty"` - - Misc []generic.Xml `xml:",any"` +type ProtocolOspfAreaTypeStubDefaultRouteDisable struct { } - -func (e *Entry) Field(v string) (any, error) { - if v == "name" || v == "Name" { - return e.Name, nil - } - if v == "administrative_distances" || v == "AdministrativeDistances" { - return e.AdministrativeDistances, nil - } - if v == "ecmp" || v == "Ecmp" { - return e.Ecmp, nil - } - if v == "interfaces" || v == "Interfaces" { - return e.Interfaces, nil - } - if v == "interfaces|LENGTH" || v == "Interfaces|LENGTH" { - return int64(len(e.Interfaces)), nil - } - if v == "protocol" || v == "Protocol" { - return e.Protocol, nil - } - if v == "routing_table" || v == "RoutingTable" { - return e.RoutingTable, nil - } - - return nil, fmt.Errorf("unknown field") +type ProtocolOspfAreaVirtualLink struct { + Authentication *string + Bfd *ProtocolOspfAreaVirtualLinkBfd + DeadCounts *int64 + Enable *bool + HelloInterval *int64 + Name string + NeighborId *string + RetransmitInterval *int64 + TransitAreaId *string + TransitDelay *int64 } - -func Versioning(vn version.Number) (Specifier, Normalizer, error) { - return specifyEntry, &entryXmlContainer{}, nil +type ProtocolOspfAreaVirtualLinkBfd struct { + Profile *string } - -func specifyEntry(o *Entry) (any, error) { - entry := entryXml{} - - entry.Name = o.Name - var nestedAdministrativeDistances *AdministrativeDistancesXml - if o.AdministrativeDistances != nil { - nestedAdministrativeDistances = &AdministrativeDistancesXml{} - if _, ok := o.Misc["AdministrativeDistances"]; ok { - nestedAdministrativeDistances.Misc = o.Misc["AdministrativeDistances"] +type ProtocolOspfAuthProfile struct { + Name string + Md5 []ProtocolOspfAuthProfileMd5 + Password *string +} +type ProtocolOspfAuthProfileMd5 struct { + Key *string + Name string + Preferred *bool +} +type ProtocolOspfExportRules struct { + Metric *int64 + Name string + NewPathType *string + NewTag *string +} +type ProtocolOspfGlobalBfd struct { + Profile *string +} +type ProtocolOspfGracefulRestart struct { + Enable *bool + GracePeriod *int64 + HelperEnable *bool + MaxNeighborRestartTime *int64 + StrictLSAChecking *bool +} +type ProtocolOspfTimers struct { + LsaInterval *float64 + SpfCalculationDelay *float64 +} +type ProtocolOspfv3 struct { + AllowRedistDefaultRoute *bool + Area []ProtocolOspfv3Area + AuthProfile []ProtocolOspfv3AuthProfile + DisableTransitTraffic *bool + Enable *bool + ExportRules []ProtocolOspfv3ExportRules + GlobalBfd *ProtocolOspfv3GlobalBfd + GracefulRestart *ProtocolOspfv3GracefulRestart + RejectDefaultRoute *bool + RouterId *string + Timers *ProtocolOspfv3Timers +} +type ProtocolOspfv3Area struct { + Authentication *string + Interface []ProtocolOspfv3AreaInterface + Name string + Range []ProtocolOspfv3AreaRange + Type *ProtocolOspfv3AreaType + VirtualLink []ProtocolOspfv3AreaVirtualLink +} +type ProtocolOspfv3AreaInterface struct { + Authentication *string + Bfd *ProtocolOspfv3AreaInterfaceBfd + DeadCounts *int64 + Enable *bool + GrDelay *int64 + HelloInterval *int64 + InstanceId *int64 + LinkType *ProtocolOspfv3AreaInterfaceLinkType + Metric *int64 + Name string + Neighbor []ProtocolOspfv3AreaInterfaceNeighbor + Passive *bool + Priority *int64 + RetransmitInterval *int64 + TransitDelay *int64 +} +type ProtocolOspfv3AreaInterfaceBfd struct { + Profile *string +} +type ProtocolOspfv3AreaInterfaceLinkType struct { + Broadcast *ProtocolOspfv3AreaInterfaceLinkTypeBroadcast + P2mp *ProtocolOspfv3AreaInterfaceLinkTypeP2mp + P2p *ProtocolOspfv3AreaInterfaceLinkTypeP2p +} +type ProtocolOspfv3AreaInterfaceLinkTypeBroadcast struct { +} +type ProtocolOspfv3AreaInterfaceLinkTypeP2mp struct { +} +type ProtocolOspfv3AreaInterfaceLinkTypeP2p struct { +} +type ProtocolOspfv3AreaInterfaceNeighbor struct { + Name string +} +type ProtocolOspfv3AreaRange struct { + Name string + Advertise *ProtocolOspfv3AreaRangeAdvertise + Suppress *ProtocolOspfv3AreaRangeSuppress +} +type ProtocolOspfv3AreaRangeAdvertise struct { +} +type ProtocolOspfv3AreaRangeSuppress struct { +} +type ProtocolOspfv3AreaType struct { + Normal *ProtocolOspfv3AreaTypeNormal + Nssa *ProtocolOspfv3AreaTypeNssa + Stub *ProtocolOspfv3AreaTypeStub +} +type ProtocolOspfv3AreaTypeNormal struct { +} +type ProtocolOspfv3AreaTypeNssa struct { + AcceptSummary *bool + DefaultRoute *ProtocolOspfv3AreaTypeNssaDefaultRoute + NssaExtRange []ProtocolOspfv3AreaTypeNssaNssaExtRange +} +type ProtocolOspfv3AreaTypeNssaDefaultRoute struct { + Advertise *ProtocolOspfv3AreaTypeNssaDefaultRouteAdvertise + Disable *ProtocolOspfv3AreaTypeNssaDefaultRouteDisable +} +type ProtocolOspfv3AreaTypeNssaDefaultRouteAdvertise struct { + Metric *int64 + Type *string +} +type ProtocolOspfv3AreaTypeNssaDefaultRouteDisable struct { +} +type ProtocolOspfv3AreaTypeNssaNssaExtRange struct { + Name string + Advertise *ProtocolOspfv3AreaTypeNssaNssaExtRangeAdvertise + Suppress *ProtocolOspfv3AreaTypeNssaNssaExtRangeSuppress +} +type ProtocolOspfv3AreaTypeNssaNssaExtRangeAdvertise struct { +} +type ProtocolOspfv3AreaTypeNssaNssaExtRangeSuppress struct { +} +type ProtocolOspfv3AreaTypeStub struct { + AcceptSummary *bool + DefaultRoute *ProtocolOspfv3AreaTypeStubDefaultRoute +} +type ProtocolOspfv3AreaTypeStubDefaultRoute struct { + Advertise *ProtocolOspfv3AreaTypeStubDefaultRouteAdvertise + Disable *ProtocolOspfv3AreaTypeStubDefaultRouteDisable +} +type ProtocolOspfv3AreaTypeStubDefaultRouteAdvertise struct { + Metric *int64 +} +type ProtocolOspfv3AreaTypeStubDefaultRouteDisable struct { +} +type ProtocolOspfv3AreaVirtualLink struct { + Authentication *string + Bfd *ProtocolOspfv3AreaVirtualLinkBfd + DeadCounts *int64 + Enable *bool + HelloInterval *int64 + InstanceId *int64 + Name string + NeighborId *string + RetransmitInterval *int64 + TransitAreaId *string + TransitDelay *int64 +} +type ProtocolOspfv3AreaVirtualLinkBfd struct { + Profile *string +} +type ProtocolOspfv3AuthProfile struct { + Name string + Spi *string + Ah *ProtocolOspfv3AuthProfileAh + Esp *ProtocolOspfv3AuthProfileEsp +} +type ProtocolOspfv3AuthProfileAh struct { + Md5 *ProtocolOspfv3AuthProfileAhMd5 + Sha1 *ProtocolOspfv3AuthProfileAhSha1 + Sha256 *ProtocolOspfv3AuthProfileAhSha256 + Sha384 *ProtocolOspfv3AuthProfileAhSha384 + Sha512 *ProtocolOspfv3AuthProfileAhSha512 +} +type ProtocolOspfv3AuthProfileAhMd5 struct { + Key *string +} +type ProtocolOspfv3AuthProfileAhSha1 struct { + Key *string +} +type ProtocolOspfv3AuthProfileAhSha256 struct { + Key *string +} +type ProtocolOspfv3AuthProfileAhSha384 struct { + Key *string +} +type ProtocolOspfv3AuthProfileAhSha512 struct { + Key *string +} +type ProtocolOspfv3AuthProfileEsp struct { + Authentication *ProtocolOspfv3AuthProfileEspAuthentication + Encryption *ProtocolOspfv3AuthProfileEspEncryption +} +type ProtocolOspfv3AuthProfileEspAuthentication struct { + Md5 *ProtocolOspfv3AuthProfileEspAuthenticationMd5 + None *ProtocolOspfv3AuthProfileEspAuthenticationNone + Sha1 *ProtocolOspfv3AuthProfileEspAuthenticationSha1 + Sha256 *ProtocolOspfv3AuthProfileEspAuthenticationSha256 + Sha384 *ProtocolOspfv3AuthProfileEspAuthenticationSha384 + Sha512 *ProtocolOspfv3AuthProfileEspAuthenticationSha512 +} +type ProtocolOspfv3AuthProfileEspAuthenticationMd5 struct { + Key *string +} +type ProtocolOspfv3AuthProfileEspAuthenticationNone struct { +} +type ProtocolOspfv3AuthProfileEspAuthenticationSha1 struct { + Key *string +} +type ProtocolOspfv3AuthProfileEspAuthenticationSha256 struct { + Key *string +} +type ProtocolOspfv3AuthProfileEspAuthenticationSha384 struct { + Key *string +} +type ProtocolOspfv3AuthProfileEspAuthenticationSha512 struct { + Key *string +} +type ProtocolOspfv3AuthProfileEspEncryption struct { + Algorithm *string + Key *string +} +type ProtocolOspfv3ExportRules struct { + Metric *int64 + Name string + NewPathType *string + NewTag *string +} +type ProtocolOspfv3GlobalBfd struct { + Profile *string +} +type ProtocolOspfv3GracefulRestart struct { + Enable *bool + GracePeriod *int64 + HelperEnable *bool + MaxNeighborRestartTime *int64 + StrictLSAChecking *bool +} +type ProtocolOspfv3Timers struct { + LsaInterval *float64 + SpfCalculationDelay *float64 +} +type ProtocolRedistProfile struct { + Action *ProtocolRedistProfileAction + Filter *ProtocolRedistProfileFilter + Name string + Priority *int64 +} +type ProtocolRedistProfileAction struct { + NoRedist *ProtocolRedistProfileActionNoRedist + Redist *ProtocolRedistProfileActionRedist +} +type ProtocolRedistProfileActionNoRedist struct { +} +type ProtocolRedistProfileActionRedist struct { +} +type ProtocolRedistProfileFilter struct { + Bgp *ProtocolRedistProfileFilterBgp + Destination []string + Interface []string + Nexthop []string + Ospf *ProtocolRedistProfileFilterOspf + Type []string +} +type ProtocolRedistProfileFilterBgp struct { + Community []string + ExtendedCommunity []string +} +type ProtocolRedistProfileFilterOspf struct { + Area []string + PathType []string + Tag []string +} +type ProtocolRedistProfileIpv6 struct { + Action *ProtocolRedistProfileIpv6Action + Filter *ProtocolRedistProfileIpv6Filter + Name string + Priority *int64 +} +type ProtocolRedistProfileIpv6Action struct { + NoRedist *ProtocolRedistProfileIpv6ActionNoRedist + Redist *ProtocolRedistProfileIpv6ActionRedist +} +type ProtocolRedistProfileIpv6ActionNoRedist struct { +} +type ProtocolRedistProfileIpv6ActionRedist struct { +} +type ProtocolRedistProfileIpv6Filter struct { + Bgp *ProtocolRedistProfileIpv6FilterBgp + Destination []string + Interface []string + Nexthop []string + Ospfv3 *ProtocolRedistProfileIpv6FilterOspfv3 + Type []string +} +type ProtocolRedistProfileIpv6FilterBgp struct { + Community []string + ExtendedCommunity []string +} +type ProtocolRedistProfileIpv6FilterOspfv3 struct { + Area []string + PathType []string + Tag []string +} +type ProtocolRip struct { + AllowRedistDefaultRoute *bool + AuthProfile []ProtocolRipAuthProfile + Enable *bool + ExportRules []ProtocolRipExportRules + GlobalBfd *ProtocolRipGlobalBfd + Interface []ProtocolRipInterface + RejectDefaultRoute *bool + Timers *ProtocolRipTimers +} +type ProtocolRipAuthProfile struct { + Name string + Md5 []ProtocolRipAuthProfileMd5 + Password *string +} +type ProtocolRipAuthProfileMd5 struct { + Key *string + Name string + Preferred *bool +} +type ProtocolRipExportRules struct { + Metric *int64 + Name string +} +type ProtocolRipGlobalBfd struct { + Profile *string +} +type ProtocolRipInterface struct { + Authentication *string + Bfd *ProtocolRipInterfaceBfd + DefaultRoute *ProtocolRipInterfaceDefaultRoute + Enable *bool + Mode *string + Name string +} +type ProtocolRipInterfaceBfd struct { + Profile *string +} +type ProtocolRipInterfaceDefaultRoute struct { + Advertise *ProtocolRipInterfaceDefaultRouteAdvertise + Disable *ProtocolRipInterfaceDefaultRouteDisable +} +type ProtocolRipInterfaceDefaultRouteAdvertise struct { + Metric *int64 +} +type ProtocolRipInterfaceDefaultRouteDisable struct { +} +type ProtocolRipTimers struct { + DeleteIntervals *int64 + ExpireIntervals *int64 + IntervalSeconds *int64 + UpdateIntervals *int64 +} +type RoutingTable struct { + Ip *RoutingTableIp + Ipv6 *RoutingTableIpv6 +} +type RoutingTableIp struct { + StaticRoute []RoutingTableIpStaticRoute +} +type RoutingTableIpStaticRoute struct { + AdminDist *int64 + Bfd *RoutingTableIpStaticRouteBfd + Destination *string + Interface *string + Metric *int64 + Name string + Nexthop *RoutingTableIpStaticRouteNexthop + PathMonitor *RoutingTableIpStaticRoutePathMonitor + RouteTable *RoutingTableIpStaticRouteRouteTable +} +type RoutingTableIpStaticRouteBfd struct { + Profile *string +} +type RoutingTableIpStaticRouteNexthop struct { + Discard *RoutingTableIpStaticRouteNexthopDiscard + Fqdn *string + IpAddress *string + NextVr *string + Receive *RoutingTableIpStaticRouteNexthopReceive +} +type RoutingTableIpStaticRouteNexthopDiscard struct { +} +type RoutingTableIpStaticRouteNexthopReceive struct { +} +type RoutingTableIpStaticRoutePathMonitor struct { + Enable *bool + FailureCondition *string + HoldTime *int64 + MonitorDestinations []RoutingTableIpStaticRoutePathMonitorMonitorDestinations +} +type RoutingTableIpStaticRoutePathMonitorMonitorDestinations struct { + Count *int64 + Destination *string + Enable *bool + Interval *int64 + Name string + Source *string +} +type RoutingTableIpStaticRouteRouteTable struct { + Both *RoutingTableIpStaticRouteRouteTableBoth + Multicast *RoutingTableIpStaticRouteRouteTableMulticast + NoInstall *RoutingTableIpStaticRouteRouteTableNoInstall + Unicast *RoutingTableIpStaticRouteRouteTableUnicast +} +type RoutingTableIpStaticRouteRouteTableBoth struct { +} +type RoutingTableIpStaticRouteRouteTableMulticast struct { +} +type RoutingTableIpStaticRouteRouteTableNoInstall struct { +} +type RoutingTableIpStaticRouteRouteTableUnicast struct { +} +type RoutingTableIpv6 struct { + StaticRoute []RoutingTableIpv6StaticRoute +} +type RoutingTableIpv6StaticRoute struct { + AdminDist *int64 + Bfd *RoutingTableIpv6StaticRouteBfd + Destination *string + Interface *string + Metric *int64 + Name string + Nexthop *RoutingTableIpv6StaticRouteNexthop + Option *RoutingTableIpv6StaticRouteOption + PathMonitor *RoutingTableIpv6StaticRoutePathMonitor + RouteTable *RoutingTableIpv6StaticRouteRouteTable +} +type RoutingTableIpv6StaticRouteBfd struct { + Profile *string +} +type RoutingTableIpv6StaticRouteNexthop struct { + Discard *RoutingTableIpv6StaticRouteNexthopDiscard + Ipv6Address *string + NextVr *string + Receive *RoutingTableIpv6StaticRouteNexthopReceive +} +type RoutingTableIpv6StaticRouteNexthopDiscard struct { +} +type RoutingTableIpv6StaticRouteNexthopReceive struct { +} +type RoutingTableIpv6StaticRouteOption struct { +} +type RoutingTableIpv6StaticRoutePathMonitor struct { + Enable *bool + FailureCondition *string + HoldTime *int64 + MonitorDestinations []RoutingTableIpv6StaticRoutePathMonitorMonitorDestinations +} +type RoutingTableIpv6StaticRoutePathMonitorMonitorDestinations struct { + Count *int64 + Destination *string + Enable *bool + Interval *int64 + Name string + Source *string +} +type RoutingTableIpv6StaticRouteRouteTable struct { + NoInstall *RoutingTableIpv6StaticRouteRouteTableNoInstall + Unicast *RoutingTableIpv6StaticRouteRouteTableUnicast +} +type RoutingTableIpv6StaticRouteRouteTableNoInstall struct { +} +type RoutingTableIpv6StaticRouteRouteTableUnicast struct { +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + AdminDists *AdminDistsXml `xml:"admin-dists,omitempty"` + Ecmp *EcmpXml `xml:"ecmp,omitempty"` + Interface *util.MemberType `xml:"interface,omitempty"` + Multicast *MulticastXml `xml:"multicast,omitempty"` + Protocol *ProtocolXml `xml:"protocol,omitempty"` + RoutingTable *RoutingTableXml `xml:"routing-table,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AdminDistsXml struct { + Ebgp *int64 `xml:"ebgp,omitempty"` + Ibgp *int64 `xml:"ibgp,omitempty"` + OspfExt *int64 `xml:"ospf-ext,omitempty"` + OspfInt *int64 `xml:"ospf-int,omitempty"` + Ospfv3Ext *int64 `xml:"ospfv3-ext,omitempty"` + Ospfv3Int *int64 `xml:"ospfv3-int,omitempty"` + Rip *int64 `xml:"rip,omitempty"` + Static *int64 `xml:"static,omitempty"` + StaticIpv6 *int64 `xml:"static-ipv6,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type EcmpXml struct { + Algorithm *EcmpAlgorithmXml `xml:"algorithm,omitempty"` + Enable *string `xml:"enable,omitempty"` + MaxPath *int64 `xml:"max-path,omitempty"` + StrictSourcePath *string `xml:"strict-source-path,omitempty"` + SymmetricReturn *string `xml:"symmetric-return,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type EcmpAlgorithmXml struct { + BalancedRoundRobin *EcmpAlgorithmBalancedRoundRobinXml `xml:"balanced-round-robin,omitempty"` + IpHash *EcmpAlgorithmIpHashXml `xml:"ip-hash,omitempty"` + IpModulo *EcmpAlgorithmIpModuloXml `xml:"ip-modulo,omitempty"` + WeightedRoundRobin *EcmpAlgorithmWeightedRoundRobinXml `xml:"weighted-round-robin,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type EcmpAlgorithmBalancedRoundRobinXml struct { + Misc []generic.Xml `xml:",any"` +} +type EcmpAlgorithmIpHashXml struct { + HashSeed *int64 `xml:"hash-seed,omitempty"` + SrcOnly *string `xml:"src-only,omitempty"` + UsePort *string `xml:"use-port,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type EcmpAlgorithmIpModuloXml struct { + Misc []generic.Xml `xml:",any"` +} +type EcmpAlgorithmWeightedRoundRobinXml struct { + Interface []EcmpAlgorithmWeightedRoundRobinInterfaceXml `xml:"interface>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type EcmpAlgorithmWeightedRoundRobinInterfaceXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Weight *int64 `xml:"weight,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MulticastXml struct { + Enable *string `xml:"enable,omitempty"` + InterfaceGroup []MulticastInterfaceGroupXml `xml:"interface-group>entry,omitempty"` + RouteAgeoutTime *int64 `xml:"route-ageout-time,omitempty"` + Rp *MulticastRpXml `xml:"rp,omitempty"` + SptThreshold []MulticastSptThresholdXml `xml:"spt-threshold>entry,omitempty"` + SsmAddressSpace []MulticastSsmAddressSpaceXml `xml:"ssm-address-space>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MulticastInterfaceGroupXml struct { + Description *string `xml:"description,omitempty"` + GroupPermission *MulticastInterfaceGroupGroupPermissionXml `xml:"group-permission,omitempty"` + Igmp *MulticastInterfaceGroupIgmpXml `xml:"igmp,omitempty"` + Interface *util.MemberType `xml:"interface,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Pim *MulticastInterfaceGroupPimXml `xml:"pim,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MulticastInterfaceGroupGroupPermissionXml struct { + AnySourceMulticast []MulticastInterfaceGroupGroupPermissionAnySourceMulticastXml `xml:"any-source-multicast>entry,omitempty"` + SourceSpecificMulticast []MulticastInterfaceGroupGroupPermissionSourceSpecificMulticastXml `xml:"source-specific-multicast>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MulticastInterfaceGroupGroupPermissionAnySourceMulticastXml struct { + GroupAddress *string `xml:"group-address,omitempty"` + Included *string `xml:"included,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type MulticastInterfaceGroupGroupPermissionSourceSpecificMulticastXml struct { + GroupAddress *string `xml:"group-address,omitempty"` + Included *string `xml:"included,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + SourceAddress *string `xml:"source-address,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MulticastInterfaceGroupIgmpXml struct { + Enable *string `xml:"enable,omitempty"` + ImmediateLeave *string `xml:"immediate-leave,omitempty"` + LastMemberQueryInterval *float64 `xml:"last-member-query-interval,omitempty"` + MaxGroups *string `xml:"max-groups,omitempty"` + MaxQueryResponseTime *float64 `xml:"max-query-response-time,omitempty"` + MaxSources *string `xml:"max-sources,omitempty"` + QueryInterval *int64 `xml:"query-interval,omitempty"` + Robustness *string `xml:"robustness,omitempty"` + RouterAlertPolicing *string `xml:"router-alert-policing,omitempty"` + Version *string `xml:"version,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MulticastInterfaceGroupPimXml struct { + AllowedNeighbors []MulticastInterfaceGroupPimAllowedNeighborsXml `xml:"allowed-neighbors>entry,omitempty"` + AssertInterval *int64 `xml:"assert-interval,omitempty"` + BsrBorder *string `xml:"bsr-border,omitempty"` + DrPriority *int64 `xml:"dr-priority,omitempty"` + Enable *string `xml:"enable,omitempty"` + HelloInterval *int64 `xml:"hello-interval,omitempty"` + JoinPruneInterval *int64 `xml:"join-prune-interval,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MulticastInterfaceGroupPimAllowedNeighborsXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type MulticastRpXml struct { + ExternalRp []MulticastRpExternalRpXml `xml:"external-rp>entry,omitempty"` + LocalRp *MulticastRpLocalRpXml `xml:"local-rp,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MulticastRpExternalRpXml struct { + GroupAddresses *util.MemberType `xml:"group-addresses,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Override *string `xml:"override,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MulticastRpLocalRpXml struct { + CandidateRp *MulticastRpLocalRpCandidateRpXml `xml:"candidate-rp,omitempty"` + StaticRp *MulticastRpLocalRpStaticRpXml `xml:"static-rp,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MulticastRpLocalRpCandidateRpXml struct { + Address *string `xml:"address,omitempty"` + AdvertisementInterval *int64 `xml:"advertisement-interval,omitempty"` + GroupAddresses *util.MemberType `xml:"group-addresses,omitempty"` + Interface *string `xml:"interface,omitempty"` + Priority *int64 `xml:"priority,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MulticastRpLocalRpStaticRpXml struct { + Address *string `xml:"address,omitempty"` + GroupAddresses *util.MemberType `xml:"group-addresses,omitempty"` + Interface *string `xml:"interface,omitempty"` + Override *string `xml:"override,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MulticastSptThresholdXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Threshold *string `xml:"threshold,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MulticastSsmAddressSpaceXml struct { + GroupAddress *string `xml:"group-address,omitempty"` + Included *string `xml:"included,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolXml struct { + Bgp *ProtocolBgpXml `xml:"bgp,omitempty"` + Ospf *ProtocolOspfXml `xml:"ospf,omitempty"` + Ospfv3 *ProtocolOspfv3Xml `xml:"ospfv3,omitempty"` + RedistProfile []ProtocolRedistProfileXml `xml:"redist-profile>entry,omitempty"` + RedistProfileIpv6 []ProtocolRedistProfileIpv6Xml `xml:"redist-profile-ipv6>entry,omitempty"` + Rip *ProtocolRipXml `xml:"rip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpXml struct { + AllowRedistDefaultRoute *string `xml:"allow-redist-default-route,omitempty"` + AuthProfile []ProtocolBgpAuthProfileXml `xml:"auth-profile>entry,omitempty"` + DampeningProfile []ProtocolBgpDampeningProfileXml `xml:"dampening-profile>entry,omitempty"` + EcmpMultiAs *string `xml:"ecmp-multi-as,omitempty"` + Enable *string `xml:"enable,omitempty"` + EnforceFirstAs *string `xml:"enforce-first-as,omitempty"` + GlobalBfd *ProtocolBgpGlobalBfdXml `xml:"global-bfd,omitempty"` + InstallRoute *string `xml:"install-route,omitempty"` + LocalAs *string `xml:"local-as,omitempty"` + PeerGroup []ProtocolBgpPeerGroupXml `xml:"peer-group>entry,omitempty"` + Policy *ProtocolBgpPolicyXml `xml:"policy,omitempty"` + RedistRules []ProtocolBgpRedistRulesXml `xml:"redist-rules>entry,omitempty"` + RejectDefaultRoute *string `xml:"reject-default-route,omitempty"` + RouterId *string `xml:"router-id,omitempty"` + RoutingOptions *ProtocolBgpRoutingOptionsXml `xml:"routing-options,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpAuthProfileXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Secret *string `xml:"secret,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpDampeningProfileXml struct { + Cutoff *float64 `xml:"cutoff,omitempty"` + DecayHalfLifeReachable *int64 `xml:"decay-half-life-reachable,omitempty"` + DecayHalfLifeUnreachable *int64 `xml:"decay-half-life-unreachable,omitempty"` + Enable *string `xml:"enable,omitempty"` + MaxHoldTime *int64 `xml:"max-hold-time,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Reuse *float64 `xml:"reuse,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpGlobalBfdXml struct { + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPeerGroupXml struct { + AggregatedConfedAsPath *string `xml:"aggregated-confed-as-path,omitempty"` + Enable *string `xml:"enable,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Peer []ProtocolBgpPeerGroupPeerXml `xml:"peer>entry,omitempty"` + SoftResetWithStoredInfo *string `xml:"soft-reset-with-stored-info,omitempty"` + Type *ProtocolBgpPeerGroupTypeXml `xml:"type,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPeerGroupPeerXml struct { + AddressFamilyIdentifier *string `xml:"address-family-identifier,omitempty"` + Bfd *ProtocolBgpPeerGroupPeerBfdXml `xml:"bfd,omitempty"` + ConnectionOptions *ProtocolBgpPeerGroupPeerConnectionOptionsXml `xml:"connection-options,omitempty"` + Enable *string `xml:"enable,omitempty"` + EnableMpBgp *string `xml:"enable-mp-bgp,omitempty"` + EnableSenderSideLoopDetection *string `xml:"enable-sender-side-loop-detection,omitempty"` + LocalAddress *ProtocolBgpPeerGroupPeerLocalAddressXml `xml:"local-address,omitempty"` + MaxPrefixes *string `xml:"max-prefixes,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + PeerAddress *ProtocolBgpPeerGroupPeerPeerAddressXml `xml:"peer-address,omitempty"` + PeerAs *string `xml:"peer-as,omitempty"` + PeeringType *string `xml:"peering-type,omitempty"` + ReflectorClient *string `xml:"reflector-client,omitempty"` + SubsequentAddressFamilyIdentifier *ProtocolBgpPeerGroupPeerSubsequentAddressFamilyIdentifierXml `xml:"subsequent-address-family-identifier,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPeerGroupPeerBfdXml struct { + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPeerGroupPeerConnectionOptionsXml struct { + Authentication *string `xml:"authentication,omitempty"` + HoldTime *string `xml:"hold-time,omitempty"` + IdleHoldTime *int64 `xml:"idle-hold-time,omitempty"` + IncomingBgpConnection *ProtocolBgpPeerGroupPeerConnectionOptionsIncomingBgpConnectionXml `xml:"incoming-bgp-connection,omitempty"` + KeepAliveInterval *string `xml:"keep-alive-interval,omitempty"` + MinRouteAdvInterval *int64 `xml:"min-route-adv-interval,omitempty"` + Multihop *int64 `xml:"multihop,omitempty"` + OpenDelayTime *int64 `xml:"open-delay-time,omitempty"` + OutgoingBgpConnection *ProtocolBgpPeerGroupPeerConnectionOptionsOutgoingBgpConnectionXml `xml:"outgoing-bgp-connection,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPeerGroupPeerConnectionOptionsIncomingBgpConnectionXml struct { + Allow *string `xml:"allow,omitempty"` + RemotePort *int64 `xml:"remote-port,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPeerGroupPeerConnectionOptionsOutgoingBgpConnectionXml struct { + Allow *string `xml:"allow,omitempty"` + LocalPort *int64 `xml:"local-port,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPeerGroupPeerLocalAddressXml struct { + Interface *string `xml:"interface,omitempty"` + Ip *string `xml:"ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPeerGroupPeerPeerAddressXml struct { + Fqdn *string `xml:"fqdn,omitempty"` + Ip *string `xml:"ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPeerGroupPeerSubsequentAddressFamilyIdentifierXml struct { + Multicast *string `xml:"multicast,omitempty"` + Unicast *string `xml:"unicast,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPeerGroupTypeXml struct { + Ebgp *ProtocolBgpPeerGroupTypeEbgpXml `xml:"ebgp,omitempty"` + EbgpConfed *ProtocolBgpPeerGroupTypeEbgpConfedXml `xml:"ebgp-confed,omitempty"` + Ibgp *ProtocolBgpPeerGroupTypeIbgpXml `xml:"ibgp,omitempty"` + IbgpConfed *ProtocolBgpPeerGroupTypeIbgpConfedXml `xml:"ibgp-confed,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPeerGroupTypeEbgpXml struct { + ExportNexthop *string `xml:"export-nexthop,omitempty"` + ImportNexthop *string `xml:"import-nexthop,omitempty"` + RemovePrivateAs *string `xml:"remove-private-as,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPeerGroupTypeEbgpConfedXml struct { + ExportNexthop *string `xml:"export-nexthop,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPeerGroupTypeIbgpXml struct { + ExportNexthop *string `xml:"export-nexthop,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPeerGroupTypeIbgpConfedXml struct { + ExportNexthop *string `xml:"export-nexthop,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyXml struct { + Aggregation *ProtocolBgpPolicyAggregationXml `xml:"aggregation,omitempty"` + ConditionalAdvertisement *ProtocolBgpPolicyConditionalAdvertisementXml `xml:"conditional-advertisement,omitempty"` + Export *ProtocolBgpPolicyExportXml `xml:"export,omitempty"` + Import *ProtocolBgpPolicyImportXml `xml:"import,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationXml struct { + Address []ProtocolBgpPolicyAggregationAddressXml `xml:"address>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressXml struct { + AdvertiseFilters []ProtocolBgpPolicyAggregationAddressAdvertiseFiltersXml `xml:"advertise-filters>entry,omitempty"` + AggregateRouteAttributes *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesXml `xml:"aggregate-route-attributes,omitempty"` + AsSet *string `xml:"as-set,omitempty"` + Enable *string `xml:"enable,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Prefix *string `xml:"prefix,omitempty"` + Summary *string `xml:"summary,omitempty"` + SuppressFilters []ProtocolBgpPolicyAggregationAddressSuppressFiltersXml `xml:"suppress-filters>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAdvertiseFiltersXml struct { + Enable *string `xml:"enable,omitempty"` + Match *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchXml `xml:"match,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchXml struct { + AddressPrefix []ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefixXml `xml:"address-prefix>entry,omitempty"` + AsPath *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAsPathXml `xml:"as-path,omitempty"` + Community *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchCommunityXml `xml:"community,omitempty"` + ExtendedCommunity *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchExtendedCommunityXml `xml:"extended-community,omitempty"` + FromPeer *util.MemberType `xml:"from-peer,omitempty"` + Med *int64 `xml:"med,omitempty"` + Nexthop *util.MemberType `xml:"nexthop,omitempty"` + RouteTable *string `xml:"route-table,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefixXml struct { + Exact *string `xml:"exact,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAsPathXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchCommunityXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchExtendedCommunityXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesXml struct { + AsPath *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathXml `xml:"as-path,omitempty"` + AsPathLimit *int64 `xml:"as-path-limit,omitempty"` + Community *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityXml `xml:"community,omitempty"` + ExtendedCommunity *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityXml `xml:"extended-community,omitempty"` + LocalPreference *int64 `xml:"local-preference,omitempty"` + Med *int64 `xml:"med,omitempty"` + Nexthop *string `xml:"nexthop,omitempty"` + Origin *string `xml:"origin,omitempty"` + Weight *int64 `xml:"weight,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathXml struct { + None *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathNoneXml `xml:"none,omitempty"` + Prepend *int64 `xml:"prepend,omitempty"` + Remove *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathRemoveXml `xml:"remove,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathRemoveXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityXml struct { + Append *util.MemberType `xml:"append,omitempty"` + None *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityNoneXml `xml:"none,omitempty"` + Overwrite *util.MemberType `xml:"overwrite,omitempty"` + RemoveAll *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityRemoveAllXml `xml:"remove-all,omitempty"` + RemoveRegex *string `xml:"remove-regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityRemoveAllXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityXml struct { + Append *util.MemberType `xml:"append,omitempty"` + None *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityNoneXml `xml:"none,omitempty"` + Overwrite *util.MemberType `xml:"overwrite,omitempty"` + RemoveAll *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityRemoveAllXml `xml:"remove-all,omitempty"` + RemoveRegex *string `xml:"remove-regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityRemoveAllXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressSuppressFiltersXml struct { + Enable *string `xml:"enable,omitempty"` + Match *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchXml `xml:"match,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchXml struct { + AddressPrefix []ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefixXml `xml:"address-prefix>entry,omitempty"` + AsPath *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAsPathXml `xml:"as-path,omitempty"` + Community *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchCommunityXml `xml:"community,omitempty"` + ExtendedCommunity *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchExtendedCommunityXml `xml:"extended-community,omitempty"` + FromPeer *util.MemberType `xml:"from-peer,omitempty"` + Med *int64 `xml:"med,omitempty"` + Nexthop *util.MemberType `xml:"nexthop,omitempty"` + RouteTable *string `xml:"route-table,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefixXml struct { + Exact *string `xml:"exact,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAsPathXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchCommunityXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchExtendedCommunityXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyConditionalAdvertisementXml struct { + Policy []ProtocolBgpPolicyConditionalAdvertisementPolicyXml `xml:"policy>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyXml struct { + AdvertiseFilters []ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersXml `xml:"advertise-filters>entry,omitempty"` + Enable *string `xml:"enable,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + NonExistFilters []ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersXml `xml:"non-exist-filters>entry,omitempty"` + UsedBy *util.MemberType `xml:"used-by,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersXml struct { + Enable *string `xml:"enable,omitempty"` + Match *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchXml `xml:"match,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchXml struct { + AddressPrefix []ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefixXml `xml:"address-prefix>entry,omitempty"` + AsPath *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAsPathXml `xml:"as-path,omitempty"` + Community *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchCommunityXml `xml:"community,omitempty"` + ExtendedCommunity *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchExtendedCommunityXml `xml:"extended-community,omitempty"` + FromPeer *util.MemberType `xml:"from-peer,omitempty"` + Med *int64 `xml:"med,omitempty"` + Nexthop *util.MemberType `xml:"nexthop,omitempty"` + RouteTable *string `xml:"route-table,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefixXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAsPathXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchCommunityXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchExtendedCommunityXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersXml struct { + Enable *string `xml:"enable,omitempty"` + Match *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchXml `xml:"match,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchXml struct { + AddressPrefix []ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefixXml `xml:"address-prefix>entry,omitempty"` + AsPath *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAsPathXml `xml:"as-path,omitempty"` + Community *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchCommunityXml `xml:"community,omitempty"` + ExtendedCommunity *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchExtendedCommunityXml `xml:"extended-community,omitempty"` + FromPeer *util.MemberType `xml:"from-peer,omitempty"` + Med *int64 `xml:"med,omitempty"` + Nexthop *util.MemberType `xml:"nexthop,omitempty"` + RouteTable *string `xml:"route-table,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefixXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAsPathXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchCommunityXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchExtendedCommunityXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportXml struct { + Rules []ProtocolBgpPolicyExportRulesXml `xml:"rules>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesXml struct { + Action *ProtocolBgpPolicyExportRulesActionXml `xml:"action,omitempty"` + Enable *string `xml:"enable,omitempty"` + Match *ProtocolBgpPolicyExportRulesMatchXml `xml:"match,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + UsedBy *util.MemberType `xml:"used-by,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesActionXml struct { + Allow *ProtocolBgpPolicyExportRulesActionAllowXml `xml:"allow,omitempty"` + Deny *ProtocolBgpPolicyExportRulesActionDenyXml `xml:"deny,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesActionAllowXml struct { + Update *ProtocolBgpPolicyExportRulesActionAllowUpdateXml `xml:"update,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateXml struct { + AsPath *ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathXml `xml:"as-path,omitempty"` + AsPathLimit *int64 `xml:"as-path-limit,omitempty"` + Community *ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityXml `xml:"community,omitempty"` + ExtendedCommunity *ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityXml `xml:"extended-community,omitempty"` + LocalPreference *int64 `xml:"local-preference,omitempty"` + Med *int64 `xml:"med,omitempty"` + Nexthop *string `xml:"nexthop,omitempty"` + Origin *string `xml:"origin,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathXml struct { + None *ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathNoneXml `xml:"none,omitempty"` + Prepend *int64 `xml:"prepend,omitempty"` + Remove *ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathRemoveXml `xml:"remove,omitempty"` + RemoveAndPrepend *int64 `xml:"remove-and-prepend,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathRemoveXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityXml struct { + Append *util.MemberType `xml:"append,omitempty"` + None *ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityNoneXml `xml:"none,omitempty"` + Overwrite *util.MemberType `xml:"overwrite,omitempty"` + RemoveAll *ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityRemoveAllXml `xml:"remove-all,omitempty"` + RemoveRegex *string `xml:"remove-regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityRemoveAllXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityXml struct { + Append *util.MemberType `xml:"append,omitempty"` + None *ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityNoneXml `xml:"none,omitempty"` + Overwrite *util.MemberType `xml:"overwrite,omitempty"` + RemoveAll *ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityRemoveAllXml `xml:"remove-all,omitempty"` + RemoveRegex *string `xml:"remove-regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityRemoveAllXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesActionDenyXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesMatchXml struct { + AddressPrefix []ProtocolBgpPolicyExportRulesMatchAddressPrefixXml `xml:"address-prefix>entry,omitempty"` + AsPath *ProtocolBgpPolicyExportRulesMatchAsPathXml `xml:"as-path,omitempty"` + Community *ProtocolBgpPolicyExportRulesMatchCommunityXml `xml:"community,omitempty"` + ExtendedCommunity *ProtocolBgpPolicyExportRulesMatchExtendedCommunityXml `xml:"extended-community,omitempty"` + FromPeer *util.MemberType `xml:"from-peer,omitempty"` + Med *int64 `xml:"med,omitempty"` + Nexthop *util.MemberType `xml:"nexthop,omitempty"` + RouteTable *string `xml:"route-table,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesMatchAddressPrefixXml struct { + Exact *string `xml:"exact,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesMatchAsPathXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesMatchCommunityXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyExportRulesMatchExtendedCommunityXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportXml struct { + Rules []ProtocolBgpPolicyImportRulesXml `xml:"rules>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesXml struct { + Action *ProtocolBgpPolicyImportRulesActionXml `xml:"action,omitempty"` + Enable *string `xml:"enable,omitempty"` + Match *ProtocolBgpPolicyImportRulesMatchXml `xml:"match,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + UsedBy *util.MemberType `xml:"used-by,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesActionXml struct { + Allow *ProtocolBgpPolicyImportRulesActionAllowXml `xml:"allow,omitempty"` + Deny *ProtocolBgpPolicyImportRulesActionDenyXml `xml:"deny,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesActionAllowXml struct { + Dampening *string `xml:"dampening,omitempty"` + Update *ProtocolBgpPolicyImportRulesActionAllowUpdateXml `xml:"update,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateXml struct { + AsPath *ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathXml `xml:"as-path,omitempty"` + AsPathLimit *int64 `xml:"as-path-limit,omitempty"` + Community *ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityXml `xml:"community,omitempty"` + ExtendedCommunity *ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityXml `xml:"extended-community,omitempty"` + LocalPreference *int64 `xml:"local-preference,omitempty"` + Med *int64 `xml:"med,omitempty"` + Nexthop *string `xml:"nexthop,omitempty"` + Origin *string `xml:"origin,omitempty"` + Weight *int64 `xml:"weight,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathXml struct { + None *ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathNoneXml `xml:"none,omitempty"` + Remove *ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathRemoveXml `xml:"remove,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathRemoveXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityXml struct { + Append *util.MemberType `xml:"append,omitempty"` + None *ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityNoneXml `xml:"none,omitempty"` + Overwrite *util.MemberType `xml:"overwrite,omitempty"` + RemoveAll *ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityRemoveAllXml `xml:"remove-all,omitempty"` + RemoveRegex *string `xml:"remove-regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityRemoveAllXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityXml struct { + Append *util.MemberType `xml:"append,omitempty"` + None *ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityNoneXml `xml:"none,omitempty"` + Overwrite *util.MemberType `xml:"overwrite,omitempty"` + RemoveAll *ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityRemoveAllXml `xml:"remove-all,omitempty"` + RemoveRegex *string `xml:"remove-regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityRemoveAllXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesActionDenyXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesMatchXml struct { + AddressPrefix []ProtocolBgpPolicyImportRulesMatchAddressPrefixXml `xml:"address-prefix>entry,omitempty"` + AsPath *ProtocolBgpPolicyImportRulesMatchAsPathXml `xml:"as-path,omitempty"` + Community *ProtocolBgpPolicyImportRulesMatchCommunityXml `xml:"community,omitempty"` + ExtendedCommunity *ProtocolBgpPolicyImportRulesMatchExtendedCommunityXml `xml:"extended-community,omitempty"` + FromPeer *util.MemberType `xml:"from-peer,omitempty"` + Med *int64 `xml:"med,omitempty"` + Nexthop *util.MemberType `xml:"nexthop,omitempty"` + RouteTable *string `xml:"route-table,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesMatchAddressPrefixXml struct { + Exact *string `xml:"exact,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesMatchAsPathXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesMatchCommunityXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpPolicyImportRulesMatchExtendedCommunityXml struct { + Regex *string `xml:"regex,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpRedistRulesXml struct { + AddressFamilyIdentifier *string `xml:"address-family-identifier,omitempty"` + Enable *string `xml:"enable,omitempty"` + Metric *int64 `xml:"metric,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + RouteTable *string `xml:"route-table,omitempty"` + SetAsPathLimit *int64 `xml:"set-as-path-limit,omitempty"` + SetCommunity *util.MemberType `xml:"set-community,omitempty"` + SetExtendedCommunity *util.MemberType `xml:"set-extended-community,omitempty"` + SetLocalPreference *int64 `xml:"set-local-preference,omitempty"` + SetMed *int64 `xml:"set-med,omitempty"` + SetOrigin *string `xml:"set-origin,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpRoutingOptionsXml struct { + Aggregate *ProtocolBgpRoutingOptionsAggregateXml `xml:"aggregate,omitempty"` + AsFormat *string `xml:"as-format,omitempty"` + ConfederationMemberAs *string `xml:"confederation-member-as,omitempty"` + DefaultLocalPreference *int64 `xml:"default-local-preference,omitempty"` + GracefulRestart *ProtocolBgpRoutingOptionsGracefulRestartXml `xml:"graceful-restart,omitempty"` + Med *ProtocolBgpRoutingOptionsMedXml `xml:"med,omitempty"` + ReflectorClusterId *string `xml:"reflector-cluster-id,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpRoutingOptionsAggregateXml struct { + AggregateMed *string `xml:"aggregate-med,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpRoutingOptionsGracefulRestartXml struct { + Enable *string `xml:"enable,omitempty"` + LocalRestartTime *int64 `xml:"local-restart-time,omitempty"` + MaxPeerRestartTime *int64 `xml:"max-peer-restart-time,omitempty"` + StaleRouteTime *int64 `xml:"stale-route-time,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolBgpRoutingOptionsMedXml struct { + AlwaysCompareMed *string `xml:"always-compare-med,omitempty"` + DeterministicMedComparison *string `xml:"deterministic-med-comparison,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfXml struct { + AllowRedistDefaultRoute *string `xml:"allow-redist-default-route,omitempty"` + Area []ProtocolOspfAreaXml `xml:"area>entry,omitempty"` + AuthProfile []ProtocolOspfAuthProfileXml `xml:"auth-profile>entry,omitempty"` + Enable *string `xml:"enable,omitempty"` + ExportRules []ProtocolOspfExportRulesXml `xml:"export-rules>entry,omitempty"` + GlobalBfd *ProtocolOspfGlobalBfdXml `xml:"global-bfd,omitempty"` + GracefulRestart *ProtocolOspfGracefulRestartXml `xml:"graceful-restart,omitempty"` + RejectDefaultRoute *string `xml:"reject-default-route,omitempty"` + Rfc1583 *string `xml:"rfc1583,omitempty"` + RouterId *string `xml:"router-id,omitempty"` + Timers *ProtocolOspfTimersXml `xml:"timers,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaXml struct { + Interface []ProtocolOspfAreaInterfaceXml `xml:"interface>entry,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Range []ProtocolOspfAreaRangeXml `xml:"range>entry,omitempty"` + Type *ProtocolOspfAreaTypeXml `xml:"type,omitempty"` + VirtualLink []ProtocolOspfAreaVirtualLinkXml `xml:"virtual-link>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaInterfaceXml struct { + Authentication *string `xml:"authentication,omitempty"` + Bfd *ProtocolOspfAreaInterfaceBfdXml `xml:"bfd,omitempty"` + DeadCounts *int64 `xml:"dead-counts,omitempty"` + Enable *string `xml:"enable,omitempty"` + GrDelay *int64 `xml:"gr-delay,omitempty"` + HelloInterval *int64 `xml:"hello-interval,omitempty"` + LinkType *ProtocolOspfAreaInterfaceLinkTypeXml `xml:"link-type,omitempty"` + Metric *int64 `xml:"metric,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Neighbor []ProtocolOspfAreaInterfaceNeighborXml `xml:"neighbor>entry,omitempty"` + Passive *string `xml:"passive,omitempty"` + Priority *int64 `xml:"priority,omitempty"` + RetransmitInterval *int64 `xml:"retransmit-interval,omitempty"` + TransitDelay *int64 `xml:"transit-delay,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaInterfaceBfdXml struct { + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaInterfaceLinkTypeXml struct { + Broadcast *ProtocolOspfAreaInterfaceLinkTypeBroadcastXml `xml:"broadcast,omitempty"` + P2mp *ProtocolOspfAreaInterfaceLinkTypeP2mpXml `xml:"p2mp,omitempty"` + P2p *ProtocolOspfAreaInterfaceLinkTypeP2pXml `xml:"p2p,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaInterfaceLinkTypeBroadcastXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaInterfaceLinkTypeP2mpXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaInterfaceLinkTypeP2pXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaInterfaceNeighborXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaRangeXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Advertise *ProtocolOspfAreaRangeAdvertiseXml `xml:"advertise,omitempty"` + Suppress *ProtocolOspfAreaRangeSuppressXml `xml:"suppress,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaRangeAdvertiseXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaRangeSuppressXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaTypeXml struct { + Normal *ProtocolOspfAreaTypeNormalXml `xml:"normal,omitempty"` + Nssa *ProtocolOspfAreaTypeNssaXml `xml:"nssa,omitempty"` + Stub *ProtocolOspfAreaTypeStubXml `xml:"stub,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaTypeNormalXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaTypeNssaXml struct { + AcceptSummary *string `xml:"accept-summary,omitempty"` + DefaultRoute *ProtocolOspfAreaTypeNssaDefaultRouteXml `xml:"default-route,omitempty"` + NssaExtRange []ProtocolOspfAreaTypeNssaNssaExtRangeXml `xml:"nssa-ext-range>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaTypeNssaDefaultRouteXml struct { + Advertise *ProtocolOspfAreaTypeNssaDefaultRouteAdvertiseXml `xml:"advertise,omitempty"` + Disable *ProtocolOspfAreaTypeNssaDefaultRouteDisableXml `xml:"disable,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaTypeNssaDefaultRouteAdvertiseXml struct { + Metric *int64 `xml:"metric,omitempty"` + Type *string `xml:"type,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaTypeNssaDefaultRouteDisableXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaTypeNssaNssaExtRangeXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Advertise *ProtocolOspfAreaTypeNssaNssaExtRangeAdvertiseXml `xml:"advertise,omitempty"` + Suppress *ProtocolOspfAreaTypeNssaNssaExtRangeSuppressXml `xml:"suppress,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaTypeNssaNssaExtRangeAdvertiseXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaTypeNssaNssaExtRangeSuppressXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaTypeStubXml struct { + AcceptSummary *string `xml:"accept-summary,omitempty"` + DefaultRoute *ProtocolOspfAreaTypeStubDefaultRouteXml `xml:"default-route,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaTypeStubDefaultRouteXml struct { + Advertise *ProtocolOspfAreaTypeStubDefaultRouteAdvertiseXml `xml:"advertise,omitempty"` + Disable *ProtocolOspfAreaTypeStubDefaultRouteDisableXml `xml:"disable,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaTypeStubDefaultRouteAdvertiseXml struct { + Metric *int64 `xml:"metric,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaTypeStubDefaultRouteDisableXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaVirtualLinkXml struct { + Authentication *string `xml:"authentication,omitempty"` + Bfd *ProtocolOspfAreaVirtualLinkBfdXml `xml:"bfd,omitempty"` + DeadCounts *int64 `xml:"dead-counts,omitempty"` + Enable *string `xml:"enable,omitempty"` + HelloInterval *int64 `xml:"hello-interval,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + NeighborId *string `xml:"neighbor-id,omitempty"` + RetransmitInterval *int64 `xml:"retransmit-interval,omitempty"` + TransitAreaId *string `xml:"transit-area-id,omitempty"` + TransitDelay *int64 `xml:"transit-delay,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAreaVirtualLinkBfdXml struct { + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAuthProfileXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Md5 []ProtocolOspfAuthProfileMd5Xml `xml:"md5>entry,omitempty"` + Password *string `xml:"password,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfAuthProfileMd5Xml struct { + Key *string `xml:"key,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Preferred *string `xml:"preferred,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfExportRulesXml struct { + Metric *int64 `xml:"metric,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + NewPathType *string `xml:"new-path-type,omitempty"` + NewTag *string `xml:"new-tag,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfGlobalBfdXml struct { + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfGracefulRestartXml struct { + Enable *string `xml:"enable,omitempty"` + GracePeriod *int64 `xml:"grace-period,omitempty"` + HelperEnable *string `xml:"helper-enable,omitempty"` + MaxNeighborRestartTime *int64 `xml:"max-neighbor-restart-time,omitempty"` + StrictLSAChecking *string `xml:"strict-LSA-checking,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfTimersXml struct { + LsaInterval *float64 `xml:"lsa-interval,omitempty"` + SpfCalculationDelay *float64 `xml:"spf-calculation-delay,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3Xml struct { + AllowRedistDefaultRoute *string `xml:"allow-redist-default-route,omitempty"` + Area []ProtocolOspfv3AreaXml `xml:"area>entry,omitempty"` + AuthProfile []ProtocolOspfv3AuthProfileXml `xml:"auth-profile>entry,omitempty"` + DisableTransitTraffic *string `xml:"disable-transit-traffic,omitempty"` + Enable *string `xml:"enable,omitempty"` + ExportRules []ProtocolOspfv3ExportRulesXml `xml:"export-rules>entry,omitempty"` + GlobalBfd *ProtocolOspfv3GlobalBfdXml `xml:"global-bfd,omitempty"` + GracefulRestart *ProtocolOspfv3GracefulRestartXml `xml:"graceful-restart,omitempty"` + RejectDefaultRoute *string `xml:"reject-default-route,omitempty"` + RouterId *string `xml:"router-id,omitempty"` + Timers *ProtocolOspfv3TimersXml `xml:"timers,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaXml struct { + Authentication *string `xml:"authentication,omitempty"` + Interface []ProtocolOspfv3AreaInterfaceXml `xml:"interface>entry,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Range []ProtocolOspfv3AreaRangeXml `xml:"range>entry,omitempty"` + Type *ProtocolOspfv3AreaTypeXml `xml:"type,omitempty"` + VirtualLink []ProtocolOspfv3AreaVirtualLinkXml `xml:"virtual-link>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaInterfaceXml struct { + Authentication *string `xml:"authentication,omitempty"` + Bfd *ProtocolOspfv3AreaInterfaceBfdXml `xml:"bfd,omitempty"` + DeadCounts *int64 `xml:"dead-counts,omitempty"` + Enable *string `xml:"enable,omitempty"` + GrDelay *int64 `xml:"gr-delay,omitempty"` + HelloInterval *int64 `xml:"hello-interval,omitempty"` + InstanceId *int64 `xml:"instance-id,omitempty"` + LinkType *ProtocolOspfv3AreaInterfaceLinkTypeXml `xml:"link-type,omitempty"` + Metric *int64 `xml:"metric,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Neighbor []ProtocolOspfv3AreaInterfaceNeighborXml `xml:"neighbor>entry,omitempty"` + Passive *string `xml:"passive,omitempty"` + Priority *int64 `xml:"priority,omitempty"` + RetransmitInterval *int64 `xml:"retransmit-interval,omitempty"` + TransitDelay *int64 `xml:"transit-delay,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaInterfaceBfdXml struct { + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaInterfaceLinkTypeXml struct { + Broadcast *ProtocolOspfv3AreaInterfaceLinkTypeBroadcastXml `xml:"broadcast,omitempty"` + P2mp *ProtocolOspfv3AreaInterfaceLinkTypeP2mpXml `xml:"p2mp,omitempty"` + P2p *ProtocolOspfv3AreaInterfaceLinkTypeP2pXml `xml:"p2p,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaInterfaceLinkTypeBroadcastXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaInterfaceLinkTypeP2mpXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaInterfaceLinkTypeP2pXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaInterfaceNeighborXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaRangeXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Advertise *ProtocolOspfv3AreaRangeAdvertiseXml `xml:"advertise,omitempty"` + Suppress *ProtocolOspfv3AreaRangeSuppressXml `xml:"suppress,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaRangeAdvertiseXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaRangeSuppressXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaTypeXml struct { + Normal *ProtocolOspfv3AreaTypeNormalXml `xml:"normal,omitempty"` + Nssa *ProtocolOspfv3AreaTypeNssaXml `xml:"nssa,omitempty"` + Stub *ProtocolOspfv3AreaTypeStubXml `xml:"stub,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaTypeNormalXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaTypeNssaXml struct { + AcceptSummary *string `xml:"accept-summary,omitempty"` + DefaultRoute *ProtocolOspfv3AreaTypeNssaDefaultRouteXml `xml:"default-route,omitempty"` + NssaExtRange []ProtocolOspfv3AreaTypeNssaNssaExtRangeXml `xml:"nssa-ext-range>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaTypeNssaDefaultRouteXml struct { + Advertise *ProtocolOspfv3AreaTypeNssaDefaultRouteAdvertiseXml `xml:"advertise,omitempty"` + Disable *ProtocolOspfv3AreaTypeNssaDefaultRouteDisableXml `xml:"disable,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaTypeNssaDefaultRouteAdvertiseXml struct { + Metric *int64 `xml:"metric,omitempty"` + Type *string `xml:"type,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaTypeNssaDefaultRouteDisableXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaTypeNssaNssaExtRangeXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Advertise *ProtocolOspfv3AreaTypeNssaNssaExtRangeAdvertiseXml `xml:"advertise,omitempty"` + Suppress *ProtocolOspfv3AreaTypeNssaNssaExtRangeSuppressXml `xml:"suppress,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaTypeNssaNssaExtRangeAdvertiseXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaTypeNssaNssaExtRangeSuppressXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaTypeStubXml struct { + AcceptSummary *string `xml:"accept-summary,omitempty"` + DefaultRoute *ProtocolOspfv3AreaTypeStubDefaultRouteXml `xml:"default-route,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaTypeStubDefaultRouteXml struct { + Advertise *ProtocolOspfv3AreaTypeStubDefaultRouteAdvertiseXml `xml:"advertise,omitempty"` + Disable *ProtocolOspfv3AreaTypeStubDefaultRouteDisableXml `xml:"disable,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaTypeStubDefaultRouteAdvertiseXml struct { + Metric *int64 `xml:"metric,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaTypeStubDefaultRouteDisableXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaVirtualLinkXml struct { + Authentication *string `xml:"authentication,omitempty"` + Bfd *ProtocolOspfv3AreaVirtualLinkBfdXml `xml:"bfd,omitempty"` + DeadCounts *int64 `xml:"dead-counts,omitempty"` + Enable *string `xml:"enable,omitempty"` + HelloInterval *int64 `xml:"hello-interval,omitempty"` + InstanceId *int64 `xml:"instance-id,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + NeighborId *string `xml:"neighbor-id,omitempty"` + RetransmitInterval *int64 `xml:"retransmit-interval,omitempty"` + TransitAreaId *string `xml:"transit-area-id,omitempty"` + TransitDelay *int64 `xml:"transit-delay,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AreaVirtualLinkBfdXml struct { + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Spi *string `xml:"spi,omitempty"` + Ah *ProtocolOspfv3AuthProfileAhXml `xml:"ah,omitempty"` + Esp *ProtocolOspfv3AuthProfileEspXml `xml:"esp,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileAhXml struct { + Md5 *ProtocolOspfv3AuthProfileAhMd5Xml `xml:"md5,omitempty"` + Sha1 *ProtocolOspfv3AuthProfileAhSha1Xml `xml:"sha1,omitempty"` + Sha256 *ProtocolOspfv3AuthProfileAhSha256Xml `xml:"sha256,omitempty"` + Sha384 *ProtocolOspfv3AuthProfileAhSha384Xml `xml:"sha384,omitempty"` + Sha512 *ProtocolOspfv3AuthProfileAhSha512Xml `xml:"sha512,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileAhMd5Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileAhSha1Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileAhSha256Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileAhSha384Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileAhSha512Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileEspXml struct { + Authentication *ProtocolOspfv3AuthProfileEspAuthenticationXml `xml:"authentication,omitempty"` + Encryption *ProtocolOspfv3AuthProfileEspEncryptionXml `xml:"encryption,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileEspAuthenticationXml struct { + Md5 *ProtocolOspfv3AuthProfileEspAuthenticationMd5Xml `xml:"md5,omitempty"` + None *ProtocolOspfv3AuthProfileEspAuthenticationNoneXml `xml:"none,omitempty"` + Sha1 *ProtocolOspfv3AuthProfileEspAuthenticationSha1Xml `xml:"sha1,omitempty"` + Sha256 *ProtocolOspfv3AuthProfileEspAuthenticationSha256Xml `xml:"sha256,omitempty"` + Sha384 *ProtocolOspfv3AuthProfileEspAuthenticationSha384Xml `xml:"sha384,omitempty"` + Sha512 *ProtocolOspfv3AuthProfileEspAuthenticationSha512Xml `xml:"sha512,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileEspAuthenticationMd5Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileEspAuthenticationNoneXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileEspAuthenticationSha1Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileEspAuthenticationSha256Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileEspAuthenticationSha384Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileEspAuthenticationSha512Xml struct { + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3AuthProfileEspEncryptionXml struct { + Algorithm *string `xml:"algorithm,omitempty"` + Key *string `xml:"key,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3ExportRulesXml struct { + Metric *int64 `xml:"metric,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + NewPathType *string `xml:"new-path-type,omitempty"` + NewTag *string `xml:"new-tag,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3GlobalBfdXml struct { + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3GracefulRestartXml struct { + Enable *string `xml:"enable,omitempty"` + GracePeriod *int64 `xml:"grace-period,omitempty"` + HelperEnable *string `xml:"helper-enable,omitempty"` + MaxNeighborRestartTime *int64 `xml:"max-neighbor-restart-time,omitempty"` + StrictLSAChecking *string `xml:"strict-LSA-checking,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolOspfv3TimersXml struct { + LsaInterval *float64 `xml:"lsa-interval,omitempty"` + SpfCalculationDelay *float64 `xml:"spf-calculation-delay,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRedistProfileXml struct { + Action *ProtocolRedistProfileActionXml `xml:"action,omitempty"` + Filter *ProtocolRedistProfileFilterXml `xml:"filter,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Priority *int64 `xml:"priority,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRedistProfileActionXml struct { + NoRedist *ProtocolRedistProfileActionNoRedistXml `xml:"no-redist,omitempty"` + Redist *ProtocolRedistProfileActionRedistXml `xml:"redist,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRedistProfileActionNoRedistXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolRedistProfileActionRedistXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolRedistProfileFilterXml struct { + Bgp *ProtocolRedistProfileFilterBgpXml `xml:"bgp,omitempty"` + Destination *util.MemberType `xml:"destination,omitempty"` + Interface *util.MemberType `xml:"interface,omitempty"` + Nexthop *util.MemberType `xml:"nexthop,omitempty"` + Ospf *ProtocolRedistProfileFilterOspfXml `xml:"ospf,omitempty"` + Type *util.MemberType `xml:"type,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRedistProfileFilterBgpXml struct { + Community *util.MemberType `xml:"community,omitempty"` + ExtendedCommunity *util.MemberType `xml:"extended-community,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRedistProfileFilterOspfXml struct { + Area *util.MemberType `xml:"area,omitempty"` + PathType *util.MemberType `xml:"path-type,omitempty"` + Tag *util.MemberType `xml:"tag,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRedistProfileIpv6Xml struct { + Action *ProtocolRedistProfileIpv6ActionXml `xml:"action,omitempty"` + Filter *ProtocolRedistProfileIpv6FilterXml `xml:"filter,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Priority *int64 `xml:"priority,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRedistProfileIpv6ActionXml struct { + NoRedist *ProtocolRedistProfileIpv6ActionNoRedistXml `xml:"no-redist,omitempty"` + Redist *ProtocolRedistProfileIpv6ActionRedistXml `xml:"redist,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRedistProfileIpv6ActionNoRedistXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolRedistProfileIpv6ActionRedistXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolRedistProfileIpv6FilterXml struct { + Bgp *ProtocolRedistProfileIpv6FilterBgpXml `xml:"bgp,omitempty"` + Destination *util.MemberType `xml:"destination,omitempty"` + Interface *util.MemberType `xml:"interface,omitempty"` + Nexthop *util.MemberType `xml:"nexthop,omitempty"` + Ospfv3 *ProtocolRedistProfileIpv6FilterOspfv3Xml `xml:"ospfv3,omitempty"` + Type *util.MemberType `xml:"type,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRedistProfileIpv6FilterBgpXml struct { + Community *util.MemberType `xml:"community,omitempty"` + ExtendedCommunity *util.MemberType `xml:"extended-community,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRedistProfileIpv6FilterOspfv3Xml struct { + Area *util.MemberType `xml:"area,omitempty"` + PathType *util.MemberType `xml:"path-type,omitempty"` + Tag *util.MemberType `xml:"tag,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRipXml struct { + AllowRedistDefaultRoute *string `xml:"allow-redist-default-route,omitempty"` + AuthProfile []ProtocolRipAuthProfileXml `xml:"auth-profile>entry,omitempty"` + Enable *string `xml:"enable,omitempty"` + ExportRules []ProtocolRipExportRulesXml `xml:"export-rules>entry,omitempty"` + GlobalBfd *ProtocolRipGlobalBfdXml `xml:"global-bfd,omitempty"` + Interface []ProtocolRipInterfaceXml `xml:"interface>entry,omitempty"` + RejectDefaultRoute *string `xml:"reject-default-route,omitempty"` + Timers *ProtocolRipTimersXml `xml:"timers,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRipAuthProfileXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Md5 []ProtocolRipAuthProfileMd5Xml `xml:"md5>entry,omitempty"` + Password *string `xml:"password,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRipAuthProfileMd5Xml struct { + Key *string `xml:"key,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Preferred *string `xml:"preferred,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRipExportRulesXml struct { + Metric *int64 `xml:"metric,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRipGlobalBfdXml struct { + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRipInterfaceXml struct { + Authentication *string `xml:"authentication,omitempty"` + Bfd *ProtocolRipInterfaceBfdXml `xml:"bfd,omitempty"` + DefaultRoute *ProtocolRipInterfaceDefaultRouteXml `xml:"default-route,omitempty"` + Enable *string `xml:"enable,omitempty"` + Mode *string `xml:"mode,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRipInterfaceBfdXml struct { + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRipInterfaceDefaultRouteXml struct { + Advertise *ProtocolRipInterfaceDefaultRouteAdvertiseXml `xml:"advertise,omitempty"` + Disable *ProtocolRipInterfaceDefaultRouteDisableXml `xml:"disable,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRipInterfaceDefaultRouteAdvertiseXml struct { + Metric *int64 `xml:"metric,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ProtocolRipInterfaceDefaultRouteDisableXml struct { + Misc []generic.Xml `xml:",any"` +} +type ProtocolRipTimersXml struct { + DeleteIntervals *int64 `xml:"delete-intervals,omitempty"` + ExpireIntervals *int64 `xml:"expire-intervals,omitempty"` + IntervalSeconds *int64 `xml:"interval-seconds,omitempty"` + UpdateIntervals *int64 `xml:"update-intervals,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableXml struct { + Ip *RoutingTableIpXml `xml:"ip,omitempty"` + Ipv6 *RoutingTableIpv6Xml `xml:"ipv6,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpXml struct { + StaticRoute []RoutingTableIpStaticRouteXml `xml:"static-route>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpStaticRouteXml struct { + AdminDist *int64 `xml:"admin-dist,omitempty"` + Bfd *RoutingTableIpStaticRouteBfdXml `xml:"bfd,omitempty"` + Destination *string `xml:"destination,omitempty"` + Interface *string `xml:"interface,omitempty"` + Metric *int64 `xml:"metric,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Nexthop *RoutingTableIpStaticRouteNexthopXml `xml:"nexthop,omitempty"` + PathMonitor *RoutingTableIpStaticRoutePathMonitorXml `xml:"path-monitor,omitempty"` + RouteTable *RoutingTableIpStaticRouteRouteTableXml `xml:"route-table,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpStaticRouteBfdXml struct { + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpStaticRouteNexthopXml struct { + Discard *RoutingTableIpStaticRouteNexthopDiscardXml `xml:"discard,omitempty"` + Fqdn *string `xml:"fqdn,omitempty"` + IpAddress *string `xml:"ip-address,omitempty"` + NextVr *string `xml:"next-vr,omitempty"` + Receive *RoutingTableIpStaticRouteNexthopReceiveXml `xml:"receive,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpStaticRouteNexthopDiscardXml struct { + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpStaticRouteNexthopReceiveXml struct { + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpStaticRoutePathMonitorXml struct { + Enable *string `xml:"enable,omitempty"` + FailureCondition *string `xml:"failure-condition,omitempty"` + HoldTime *int64 `xml:"hold-time,omitempty"` + MonitorDestinations []RoutingTableIpStaticRoutePathMonitorMonitorDestinationsXml `xml:"monitor-destinations>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpStaticRoutePathMonitorMonitorDestinationsXml struct { + Count *int64 `xml:"count,omitempty"` + Destination *string `xml:"destination,omitempty"` + Enable *string `xml:"enable,omitempty"` + Interval *int64 `xml:"interval,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Source *string `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpStaticRouteRouteTableXml struct { + Both *RoutingTableIpStaticRouteRouteTableBothXml `xml:"both,omitempty"` + Multicast *RoutingTableIpStaticRouteRouteTableMulticastXml `xml:"multicast,omitempty"` + NoInstall *RoutingTableIpStaticRouteRouteTableNoInstallXml `xml:"no-install,omitempty"` + Unicast *RoutingTableIpStaticRouteRouteTableUnicastXml `xml:"unicast,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpStaticRouteRouteTableBothXml struct { + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpStaticRouteRouteTableMulticastXml struct { + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpStaticRouteRouteTableNoInstallXml struct { + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpStaticRouteRouteTableUnicastXml struct { + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpv6Xml struct { + StaticRoute []RoutingTableIpv6StaticRouteXml `xml:"static-route>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpv6StaticRouteXml struct { + AdminDist *int64 `xml:"admin-dist,omitempty"` + Bfd *RoutingTableIpv6StaticRouteBfdXml `xml:"bfd,omitempty"` + Destination *string `xml:"destination,omitempty"` + Interface *string `xml:"interface,omitempty"` + Metric *int64 `xml:"metric,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Nexthop *RoutingTableIpv6StaticRouteNexthopXml `xml:"nexthop,omitempty"` + Option *RoutingTableIpv6StaticRouteOptionXml `xml:"option,omitempty"` + PathMonitor *RoutingTableIpv6StaticRoutePathMonitorXml `xml:"path-monitor,omitempty"` + RouteTable *RoutingTableIpv6StaticRouteRouteTableXml `xml:"route-table,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpv6StaticRouteBfdXml struct { + Profile *string `xml:"profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpv6StaticRouteNexthopXml struct { + Discard *RoutingTableIpv6StaticRouteNexthopDiscardXml `xml:"discard,omitempty"` + Ipv6Address *string `xml:"ipv6-address,omitempty"` + NextVr *string `xml:"next-vr,omitempty"` + Receive *RoutingTableIpv6StaticRouteNexthopReceiveXml `xml:"receive,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpv6StaticRouteNexthopDiscardXml struct { + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpv6StaticRouteNexthopReceiveXml struct { + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpv6StaticRouteOptionXml struct { + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpv6StaticRoutePathMonitorXml struct { + Enable *string `xml:"enable,omitempty"` + FailureCondition *string `xml:"failure-condition,omitempty"` + HoldTime *int64 `xml:"hold-time,omitempty"` + MonitorDestinations []RoutingTableIpv6StaticRoutePathMonitorMonitorDestinationsXml `xml:"monitor-destinations>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpv6StaticRoutePathMonitorMonitorDestinationsXml struct { + Count *int64 `xml:"count,omitempty"` + Destination *string `xml:"destination,omitempty"` + Enable *string `xml:"enable,omitempty"` + Interval *int64 `xml:"interval,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Source *string `xml:"source,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpv6StaticRouteRouteTableXml struct { + NoInstall *RoutingTableIpv6StaticRouteRouteTableNoInstallXml `xml:"no-install,omitempty"` + Unicast *RoutingTableIpv6StaticRouteRouteTableUnicastXml `xml:"unicast,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpv6StaticRouteRouteTableNoInstallXml struct { + Misc []generic.Xml `xml:",any"` +} +type RoutingTableIpv6StaticRouteRouteTableUnicastXml struct { + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "admin_dists" || v == "AdminDists" { + return e.AdminDists, nil + } + if v == "ecmp" || v == "Ecmp" { + return e.Ecmp, nil + } + if v == "interface" || v == "Interface" { + return e.Interface, nil + } + if v == "interface|LENGTH" || v == "Interface|LENGTH" { + return int64(len(e.Interface)), nil + } + if v == "multicast" || v == "Multicast" { + return e.Multicast, nil + } + if v == "protocol" || v == "Protocol" { + return e.Protocol, nil + } + if v == "routing_table" || v == "RoutingTable" { + return e.RoutingTable, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + var nestedAdminDists *AdminDistsXml + if o.AdminDists != nil { + nestedAdminDists = &AdminDistsXml{} + if _, ok := o.Misc["AdminDists"]; ok { + nestedAdminDists.Misc = o.Misc["AdminDists"] + } + if o.AdminDists.OspfExt != nil { + nestedAdminDists.OspfExt = o.AdminDists.OspfExt + } + if o.AdminDists.OspfInt != nil { + nestedAdminDists.OspfInt = o.AdminDists.OspfInt + } + if o.AdminDists.Ospfv3Ext != nil { + nestedAdminDists.Ospfv3Ext = o.AdminDists.Ospfv3Ext + } + if o.AdminDists.Rip != nil { + nestedAdminDists.Rip = o.AdminDists.Rip + } + if o.AdminDists.StaticIpv6 != nil { + nestedAdminDists.StaticIpv6 = o.AdminDists.StaticIpv6 + } + if o.AdminDists.Ibgp != nil { + nestedAdminDists.Ibgp = o.AdminDists.Ibgp + } + if o.AdminDists.Ospfv3Int != nil { + nestedAdminDists.Ospfv3Int = o.AdminDists.Ospfv3Int + } + if o.AdminDists.Static != nil { + nestedAdminDists.Static = o.AdminDists.Static + } + if o.AdminDists.Ebgp != nil { + nestedAdminDists.Ebgp = o.AdminDists.Ebgp + } + } + entry.AdminDists = nestedAdminDists + + var nestedEcmp *EcmpXml + if o.Ecmp != nil { + nestedEcmp = &EcmpXml{} + if _, ok := o.Misc["Ecmp"]; ok { + nestedEcmp.Misc = o.Misc["Ecmp"] + } + if o.Ecmp.StrictSourcePath != nil { + nestedEcmp.StrictSourcePath = util.YesNo(o.Ecmp.StrictSourcePath, nil) + } + if o.Ecmp.SymmetricReturn != nil { + nestedEcmp.SymmetricReturn = util.YesNo(o.Ecmp.SymmetricReturn, nil) + } + if o.Ecmp.Algorithm != nil { + nestedEcmp.Algorithm = &EcmpAlgorithmXml{} + if _, ok := o.Misc["EcmpAlgorithm"]; ok { + nestedEcmp.Algorithm.Misc = o.Misc["EcmpAlgorithm"] + } + if o.Ecmp.Algorithm.BalancedRoundRobin != nil { + nestedEcmp.Algorithm.BalancedRoundRobin = &EcmpAlgorithmBalancedRoundRobinXml{} + if _, ok := o.Misc["EcmpAlgorithmBalancedRoundRobin"]; ok { + nestedEcmp.Algorithm.BalancedRoundRobin.Misc = o.Misc["EcmpAlgorithmBalancedRoundRobin"] + } + } + if o.Ecmp.Algorithm.IpHash != nil { + nestedEcmp.Algorithm.IpHash = &EcmpAlgorithmIpHashXml{} + if _, ok := o.Misc["EcmpAlgorithmIpHash"]; ok { + nestedEcmp.Algorithm.IpHash.Misc = o.Misc["EcmpAlgorithmIpHash"] + } + if o.Ecmp.Algorithm.IpHash.HashSeed != nil { + nestedEcmp.Algorithm.IpHash.HashSeed = o.Ecmp.Algorithm.IpHash.HashSeed + } + if o.Ecmp.Algorithm.IpHash.SrcOnly != nil { + nestedEcmp.Algorithm.IpHash.SrcOnly = util.YesNo(o.Ecmp.Algorithm.IpHash.SrcOnly, nil) + } + if o.Ecmp.Algorithm.IpHash.UsePort != nil { + nestedEcmp.Algorithm.IpHash.UsePort = util.YesNo(o.Ecmp.Algorithm.IpHash.UsePort, nil) + } + } + if o.Ecmp.Algorithm.IpModulo != nil { + nestedEcmp.Algorithm.IpModulo = &EcmpAlgorithmIpModuloXml{} + if _, ok := o.Misc["EcmpAlgorithmIpModulo"]; ok { + nestedEcmp.Algorithm.IpModulo.Misc = o.Misc["EcmpAlgorithmIpModulo"] + } + } + if o.Ecmp.Algorithm.WeightedRoundRobin != nil { + nestedEcmp.Algorithm.WeightedRoundRobin = &EcmpAlgorithmWeightedRoundRobinXml{} + if _, ok := o.Misc["EcmpAlgorithmWeightedRoundRobin"]; ok { + nestedEcmp.Algorithm.WeightedRoundRobin.Misc = o.Misc["EcmpAlgorithmWeightedRoundRobin"] + } + if o.Ecmp.Algorithm.WeightedRoundRobin.Interface != nil { + nestedEcmp.Algorithm.WeightedRoundRobin.Interface = []EcmpAlgorithmWeightedRoundRobinInterfaceXml{} + for _, oEcmpAlgorithmWeightedRoundRobinInterface := range o.Ecmp.Algorithm.WeightedRoundRobin.Interface { + nestedEcmpAlgorithmWeightedRoundRobinInterface := EcmpAlgorithmWeightedRoundRobinInterfaceXml{} + if _, ok := o.Misc["EcmpAlgorithmWeightedRoundRobinInterface"]; ok { + nestedEcmpAlgorithmWeightedRoundRobinInterface.Misc = o.Misc["EcmpAlgorithmWeightedRoundRobinInterface"] + } + if oEcmpAlgorithmWeightedRoundRobinInterface.Name != "" { + nestedEcmpAlgorithmWeightedRoundRobinInterface.Name = oEcmpAlgorithmWeightedRoundRobinInterface.Name + } + if oEcmpAlgorithmWeightedRoundRobinInterface.Weight != nil { + nestedEcmpAlgorithmWeightedRoundRobinInterface.Weight = oEcmpAlgorithmWeightedRoundRobinInterface.Weight + } + nestedEcmp.Algorithm.WeightedRoundRobin.Interface = append(nestedEcmp.Algorithm.WeightedRoundRobin.Interface, nestedEcmpAlgorithmWeightedRoundRobinInterface) + } + } + } + } + if o.Ecmp.Enable != nil { + nestedEcmp.Enable = util.YesNo(o.Ecmp.Enable, nil) + } + if o.Ecmp.MaxPath != nil { + nestedEcmp.MaxPath = o.Ecmp.MaxPath + } + } + entry.Ecmp = nestedEcmp + + entry.Interface = util.StrToMem(o.Interface) + var nestedMulticast *MulticastXml + if o.Multicast != nil { + nestedMulticast = &MulticastXml{} + if _, ok := o.Misc["Multicast"]; ok { + nestedMulticast.Misc = o.Misc["Multicast"] + } + if o.Multicast.SsmAddressSpace != nil { + nestedMulticast.SsmAddressSpace = []MulticastSsmAddressSpaceXml{} + for _, oMulticastSsmAddressSpace := range o.Multicast.SsmAddressSpace { + nestedMulticastSsmAddressSpace := MulticastSsmAddressSpaceXml{} + if _, ok := o.Misc["MulticastSsmAddressSpace"]; ok { + nestedMulticastSsmAddressSpace.Misc = o.Misc["MulticastSsmAddressSpace"] + } + if oMulticastSsmAddressSpace.GroupAddress != nil { + nestedMulticastSsmAddressSpace.GroupAddress = oMulticastSsmAddressSpace.GroupAddress + } + if oMulticastSsmAddressSpace.Included != nil { + nestedMulticastSsmAddressSpace.Included = util.YesNo(oMulticastSsmAddressSpace.Included, nil) + } + if oMulticastSsmAddressSpace.Name != "" { + nestedMulticastSsmAddressSpace.Name = oMulticastSsmAddressSpace.Name + } + nestedMulticast.SsmAddressSpace = append(nestedMulticast.SsmAddressSpace, nestedMulticastSsmAddressSpace) + } + } + if o.Multicast.Enable != nil { + nestedMulticast.Enable = util.YesNo(o.Multicast.Enable, nil) + } + if o.Multicast.InterfaceGroup != nil { + nestedMulticast.InterfaceGroup = []MulticastInterfaceGroupXml{} + for _, oMulticastInterfaceGroup := range o.Multicast.InterfaceGroup { + nestedMulticastInterfaceGroup := MulticastInterfaceGroupXml{} + if _, ok := o.Misc["MulticastInterfaceGroup"]; ok { + nestedMulticastInterfaceGroup.Misc = o.Misc["MulticastInterfaceGroup"] + } + if oMulticastInterfaceGroup.Interface != nil { + nestedMulticastInterfaceGroup.Interface = util.StrToMem(oMulticastInterfaceGroup.Interface) + } + if oMulticastInterfaceGroup.GroupPermission != nil { + nestedMulticastInterfaceGroup.GroupPermission = &MulticastInterfaceGroupGroupPermissionXml{} + if _, ok := o.Misc["MulticastInterfaceGroupGroupPermission"]; ok { + nestedMulticastInterfaceGroup.GroupPermission.Misc = o.Misc["MulticastInterfaceGroupGroupPermission"] + } + if oMulticastInterfaceGroup.GroupPermission.AnySourceMulticast != nil { + nestedMulticastInterfaceGroup.GroupPermission.AnySourceMulticast = []MulticastInterfaceGroupGroupPermissionAnySourceMulticastXml{} + for _, oMulticastInterfaceGroupGroupPermissionAnySourceMulticast := range oMulticastInterfaceGroup.GroupPermission.AnySourceMulticast { + nestedMulticastInterfaceGroupGroupPermissionAnySourceMulticast := MulticastInterfaceGroupGroupPermissionAnySourceMulticastXml{} + if _, ok := o.Misc["MulticastInterfaceGroupGroupPermissionAnySourceMulticast"]; ok { + nestedMulticastInterfaceGroupGroupPermissionAnySourceMulticast.Misc = o.Misc["MulticastInterfaceGroupGroupPermissionAnySourceMulticast"] + } + if oMulticastInterfaceGroupGroupPermissionAnySourceMulticast.GroupAddress != nil { + nestedMulticastInterfaceGroupGroupPermissionAnySourceMulticast.GroupAddress = oMulticastInterfaceGroupGroupPermissionAnySourceMulticast.GroupAddress + } + if oMulticastInterfaceGroupGroupPermissionAnySourceMulticast.Included != nil { + nestedMulticastInterfaceGroupGroupPermissionAnySourceMulticast.Included = util.YesNo(oMulticastInterfaceGroupGroupPermissionAnySourceMulticast.Included, nil) + } + if oMulticastInterfaceGroupGroupPermissionAnySourceMulticast.Name != "" { + nestedMulticastInterfaceGroupGroupPermissionAnySourceMulticast.Name = oMulticastInterfaceGroupGroupPermissionAnySourceMulticast.Name + } + nestedMulticastInterfaceGroup.GroupPermission.AnySourceMulticast = append(nestedMulticastInterfaceGroup.GroupPermission.AnySourceMulticast, nestedMulticastInterfaceGroupGroupPermissionAnySourceMulticast) + } + } + if oMulticastInterfaceGroup.GroupPermission.SourceSpecificMulticast != nil { + nestedMulticastInterfaceGroup.GroupPermission.SourceSpecificMulticast = []MulticastInterfaceGroupGroupPermissionSourceSpecificMulticastXml{} + for _, oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast := range oMulticastInterfaceGroup.GroupPermission.SourceSpecificMulticast { + nestedMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast := MulticastInterfaceGroupGroupPermissionSourceSpecificMulticastXml{} + if _, ok := o.Misc["MulticastInterfaceGroupGroupPermissionSourceSpecificMulticast"]; ok { + nestedMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.Misc = o.Misc["MulticastInterfaceGroupGroupPermissionSourceSpecificMulticast"] + } + if oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.GroupAddress != nil { + nestedMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.GroupAddress = oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.GroupAddress + } + if oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.SourceAddress != nil { + nestedMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.SourceAddress = oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.SourceAddress + } + if oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.Included != nil { + nestedMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.Included = util.YesNo(oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.Included, nil) + } + if oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.Name != "" { + nestedMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.Name = oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.Name + } + nestedMulticastInterfaceGroup.GroupPermission.SourceSpecificMulticast = append(nestedMulticastInterfaceGroup.GroupPermission.SourceSpecificMulticast, nestedMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast) + } + } + } + if oMulticastInterfaceGroup.Igmp != nil { + nestedMulticastInterfaceGroup.Igmp = &MulticastInterfaceGroupIgmpXml{} + if _, ok := o.Misc["MulticastInterfaceGroupIgmp"]; ok { + nestedMulticastInterfaceGroup.Igmp.Misc = o.Misc["MulticastInterfaceGroupIgmp"] + } + if oMulticastInterfaceGroup.Igmp.Enable != nil { + nestedMulticastInterfaceGroup.Igmp.Enable = util.YesNo(oMulticastInterfaceGroup.Igmp.Enable, nil) + } + if oMulticastInterfaceGroup.Igmp.Version != nil { + nestedMulticastInterfaceGroup.Igmp.Version = oMulticastInterfaceGroup.Igmp.Version + } + if oMulticastInterfaceGroup.Igmp.LastMemberQueryInterval != nil { + nestedMulticastInterfaceGroup.Igmp.LastMemberQueryInterval = oMulticastInterfaceGroup.Igmp.LastMemberQueryInterval + } + if oMulticastInterfaceGroup.Igmp.Robustness != nil { + nestedMulticastInterfaceGroup.Igmp.Robustness = oMulticastInterfaceGroup.Igmp.Robustness + } + if oMulticastInterfaceGroup.Igmp.RouterAlertPolicing != nil { + nestedMulticastInterfaceGroup.Igmp.RouterAlertPolicing = util.YesNo(oMulticastInterfaceGroup.Igmp.RouterAlertPolicing, nil) + } + if oMulticastInterfaceGroup.Igmp.MaxQueryResponseTime != nil { + nestedMulticastInterfaceGroup.Igmp.MaxQueryResponseTime = oMulticastInterfaceGroup.Igmp.MaxQueryResponseTime + } + if oMulticastInterfaceGroup.Igmp.QueryInterval != nil { + nestedMulticastInterfaceGroup.Igmp.QueryInterval = oMulticastInterfaceGroup.Igmp.QueryInterval + } + if oMulticastInterfaceGroup.Igmp.ImmediateLeave != nil { + nestedMulticastInterfaceGroup.Igmp.ImmediateLeave = util.YesNo(oMulticastInterfaceGroup.Igmp.ImmediateLeave, nil) + } + if oMulticastInterfaceGroup.Igmp.MaxGroups != nil { + nestedMulticastInterfaceGroup.Igmp.MaxGroups = oMulticastInterfaceGroup.Igmp.MaxGroups + } + if oMulticastInterfaceGroup.Igmp.MaxSources != nil { + nestedMulticastInterfaceGroup.Igmp.MaxSources = oMulticastInterfaceGroup.Igmp.MaxSources + } + } + if oMulticastInterfaceGroup.Pim != nil { + nestedMulticastInterfaceGroup.Pim = &MulticastInterfaceGroupPimXml{} + if _, ok := o.Misc["MulticastInterfaceGroupPim"]; ok { + nestedMulticastInterfaceGroup.Pim.Misc = o.Misc["MulticastInterfaceGroupPim"] + } + if oMulticastInterfaceGroup.Pim.Enable != nil { + nestedMulticastInterfaceGroup.Pim.Enable = util.YesNo(oMulticastInterfaceGroup.Pim.Enable, nil) + } + if oMulticastInterfaceGroup.Pim.AssertInterval != nil { + nestedMulticastInterfaceGroup.Pim.AssertInterval = oMulticastInterfaceGroup.Pim.AssertInterval + } + if oMulticastInterfaceGroup.Pim.HelloInterval != nil { + nestedMulticastInterfaceGroup.Pim.HelloInterval = oMulticastInterfaceGroup.Pim.HelloInterval + } + if oMulticastInterfaceGroup.Pim.JoinPruneInterval != nil { + nestedMulticastInterfaceGroup.Pim.JoinPruneInterval = oMulticastInterfaceGroup.Pim.JoinPruneInterval + } + if oMulticastInterfaceGroup.Pim.DrPriority != nil { + nestedMulticastInterfaceGroup.Pim.DrPriority = oMulticastInterfaceGroup.Pim.DrPriority + } + if oMulticastInterfaceGroup.Pim.BsrBorder != nil { + nestedMulticastInterfaceGroup.Pim.BsrBorder = util.YesNo(oMulticastInterfaceGroup.Pim.BsrBorder, nil) + } + if oMulticastInterfaceGroup.Pim.AllowedNeighbors != nil { + nestedMulticastInterfaceGroup.Pim.AllowedNeighbors = []MulticastInterfaceGroupPimAllowedNeighborsXml{} + for _, oMulticastInterfaceGroupPimAllowedNeighbors := range oMulticastInterfaceGroup.Pim.AllowedNeighbors { + nestedMulticastInterfaceGroupPimAllowedNeighbors := MulticastInterfaceGroupPimAllowedNeighborsXml{} + if _, ok := o.Misc["MulticastInterfaceGroupPimAllowedNeighbors"]; ok { + nestedMulticastInterfaceGroupPimAllowedNeighbors.Misc = o.Misc["MulticastInterfaceGroupPimAllowedNeighbors"] + } + if oMulticastInterfaceGroupPimAllowedNeighbors.Name != "" { + nestedMulticastInterfaceGroupPimAllowedNeighbors.Name = oMulticastInterfaceGroupPimAllowedNeighbors.Name + } + nestedMulticastInterfaceGroup.Pim.AllowedNeighbors = append(nestedMulticastInterfaceGroup.Pim.AllowedNeighbors, nestedMulticastInterfaceGroupPimAllowedNeighbors) + } + } + } + if oMulticastInterfaceGroup.Name != "" { + nestedMulticastInterfaceGroup.Name = oMulticastInterfaceGroup.Name + } + if oMulticastInterfaceGroup.Description != nil { + nestedMulticastInterfaceGroup.Description = oMulticastInterfaceGroup.Description + } + nestedMulticast.InterfaceGroup = append(nestedMulticast.InterfaceGroup, nestedMulticastInterfaceGroup) + } + } + if o.Multicast.RouteAgeoutTime != nil { + nestedMulticast.RouteAgeoutTime = o.Multicast.RouteAgeoutTime + } + if o.Multicast.Rp != nil { + nestedMulticast.Rp = &MulticastRpXml{} + if _, ok := o.Misc["MulticastRp"]; ok { + nestedMulticast.Rp.Misc = o.Misc["MulticastRp"] + } + if o.Multicast.Rp.ExternalRp != nil { + nestedMulticast.Rp.ExternalRp = []MulticastRpExternalRpXml{} + for _, oMulticastRpExternalRp := range o.Multicast.Rp.ExternalRp { + nestedMulticastRpExternalRp := MulticastRpExternalRpXml{} + if _, ok := o.Misc["MulticastRpExternalRp"]; ok { + nestedMulticastRpExternalRp.Misc = o.Misc["MulticastRpExternalRp"] + } + if oMulticastRpExternalRp.GroupAddresses != nil { + nestedMulticastRpExternalRp.GroupAddresses = util.StrToMem(oMulticastRpExternalRp.GroupAddresses) + } + if oMulticastRpExternalRp.Override != nil { + nestedMulticastRpExternalRp.Override = util.YesNo(oMulticastRpExternalRp.Override, nil) + } + if oMulticastRpExternalRp.Name != "" { + nestedMulticastRpExternalRp.Name = oMulticastRpExternalRp.Name + } + nestedMulticast.Rp.ExternalRp = append(nestedMulticast.Rp.ExternalRp, nestedMulticastRpExternalRp) + } + } + if o.Multicast.Rp.LocalRp != nil { + nestedMulticast.Rp.LocalRp = &MulticastRpLocalRpXml{} + if _, ok := o.Misc["MulticastRpLocalRp"]; ok { + nestedMulticast.Rp.LocalRp.Misc = o.Misc["MulticastRpLocalRp"] + } + if o.Multicast.Rp.LocalRp.CandidateRp != nil { + nestedMulticast.Rp.LocalRp.CandidateRp = &MulticastRpLocalRpCandidateRpXml{} + if _, ok := o.Misc["MulticastRpLocalRpCandidateRp"]; ok { + nestedMulticast.Rp.LocalRp.CandidateRp.Misc = o.Misc["MulticastRpLocalRpCandidateRp"] + } + if o.Multicast.Rp.LocalRp.CandidateRp.Address != nil { + nestedMulticast.Rp.LocalRp.CandidateRp.Address = o.Multicast.Rp.LocalRp.CandidateRp.Address + } + if o.Multicast.Rp.LocalRp.CandidateRp.AdvertisementInterval != nil { + nestedMulticast.Rp.LocalRp.CandidateRp.AdvertisementInterval = o.Multicast.Rp.LocalRp.CandidateRp.AdvertisementInterval + } + if o.Multicast.Rp.LocalRp.CandidateRp.GroupAddresses != nil { + nestedMulticast.Rp.LocalRp.CandidateRp.GroupAddresses = util.StrToMem(o.Multicast.Rp.LocalRp.CandidateRp.GroupAddresses) + } + if o.Multicast.Rp.LocalRp.CandidateRp.Interface != nil { + nestedMulticast.Rp.LocalRp.CandidateRp.Interface = o.Multicast.Rp.LocalRp.CandidateRp.Interface + } + if o.Multicast.Rp.LocalRp.CandidateRp.Priority != nil { + nestedMulticast.Rp.LocalRp.CandidateRp.Priority = o.Multicast.Rp.LocalRp.CandidateRp.Priority + } + } + if o.Multicast.Rp.LocalRp.StaticRp != nil { + nestedMulticast.Rp.LocalRp.StaticRp = &MulticastRpLocalRpStaticRpXml{} + if _, ok := o.Misc["MulticastRpLocalRpStaticRp"]; ok { + nestedMulticast.Rp.LocalRp.StaticRp.Misc = o.Misc["MulticastRpLocalRpStaticRp"] + } + if o.Multicast.Rp.LocalRp.StaticRp.Interface != nil { + nestedMulticast.Rp.LocalRp.StaticRp.Interface = o.Multicast.Rp.LocalRp.StaticRp.Interface + } + if o.Multicast.Rp.LocalRp.StaticRp.Override != nil { + nestedMulticast.Rp.LocalRp.StaticRp.Override = util.YesNo(o.Multicast.Rp.LocalRp.StaticRp.Override, nil) + } + if o.Multicast.Rp.LocalRp.StaticRp.Address != nil { + nestedMulticast.Rp.LocalRp.StaticRp.Address = o.Multicast.Rp.LocalRp.StaticRp.Address + } + if o.Multicast.Rp.LocalRp.StaticRp.GroupAddresses != nil { + nestedMulticast.Rp.LocalRp.StaticRp.GroupAddresses = util.StrToMem(o.Multicast.Rp.LocalRp.StaticRp.GroupAddresses) + } + } + } + } + if o.Multicast.SptThreshold != nil { + nestedMulticast.SptThreshold = []MulticastSptThresholdXml{} + for _, oMulticastSptThreshold := range o.Multicast.SptThreshold { + nestedMulticastSptThreshold := MulticastSptThresholdXml{} + if _, ok := o.Misc["MulticastSptThreshold"]; ok { + nestedMulticastSptThreshold.Misc = o.Misc["MulticastSptThreshold"] + } + if oMulticastSptThreshold.Name != "" { + nestedMulticastSptThreshold.Name = oMulticastSptThreshold.Name + } + if oMulticastSptThreshold.Threshold != nil { + nestedMulticastSptThreshold.Threshold = oMulticastSptThreshold.Threshold + } + nestedMulticast.SptThreshold = append(nestedMulticast.SptThreshold, nestedMulticastSptThreshold) + } + } + } + entry.Multicast = nestedMulticast + + var nestedProtocol *ProtocolXml + if o.Protocol != nil { + nestedProtocol = &ProtocolXml{} + if _, ok := o.Misc["Protocol"]; ok { + nestedProtocol.Misc = o.Misc["Protocol"] + } + if o.Protocol.Bgp != nil { + nestedProtocol.Bgp = &ProtocolBgpXml{} + if _, ok := o.Misc["ProtocolBgp"]; ok { + nestedProtocol.Bgp.Misc = o.Misc["ProtocolBgp"] + } + if o.Protocol.Bgp.AuthProfile != nil { + nestedProtocol.Bgp.AuthProfile = []ProtocolBgpAuthProfileXml{} + for _, oProtocolBgpAuthProfile := range o.Protocol.Bgp.AuthProfile { + nestedProtocolBgpAuthProfile := ProtocolBgpAuthProfileXml{} + if _, ok := o.Misc["ProtocolBgpAuthProfile"]; ok { + nestedProtocolBgpAuthProfile.Misc = o.Misc["ProtocolBgpAuthProfile"] + } + if oProtocolBgpAuthProfile.Secret != nil { + nestedProtocolBgpAuthProfile.Secret = oProtocolBgpAuthProfile.Secret + } + if oProtocolBgpAuthProfile.Name != "" { + nestedProtocolBgpAuthProfile.Name = oProtocolBgpAuthProfile.Name + } + nestedProtocol.Bgp.AuthProfile = append(nestedProtocol.Bgp.AuthProfile, nestedProtocolBgpAuthProfile) + } + } + if o.Protocol.Bgp.Enable != nil { + nestedProtocol.Bgp.Enable = util.YesNo(o.Protocol.Bgp.Enable, nil) + } + if o.Protocol.Bgp.InstallRoute != nil { + nestedProtocol.Bgp.InstallRoute = util.YesNo(o.Protocol.Bgp.InstallRoute, nil) + } + if o.Protocol.Bgp.RoutingOptions != nil { + nestedProtocol.Bgp.RoutingOptions = &ProtocolBgpRoutingOptionsXml{} + if _, ok := o.Misc["ProtocolBgpRoutingOptions"]; ok { + nestedProtocol.Bgp.RoutingOptions.Misc = o.Misc["ProtocolBgpRoutingOptions"] + } + if o.Protocol.Bgp.RoutingOptions.DefaultLocalPreference != nil { + nestedProtocol.Bgp.RoutingOptions.DefaultLocalPreference = o.Protocol.Bgp.RoutingOptions.DefaultLocalPreference + } + if o.Protocol.Bgp.RoutingOptions.GracefulRestart != nil { + nestedProtocol.Bgp.RoutingOptions.GracefulRestart = &ProtocolBgpRoutingOptionsGracefulRestartXml{} + if _, ok := o.Misc["ProtocolBgpRoutingOptionsGracefulRestart"]; ok { + nestedProtocol.Bgp.RoutingOptions.GracefulRestart.Misc = o.Misc["ProtocolBgpRoutingOptionsGracefulRestart"] + } + if o.Protocol.Bgp.RoutingOptions.GracefulRestart.Enable != nil { + nestedProtocol.Bgp.RoutingOptions.GracefulRestart.Enable = util.YesNo(o.Protocol.Bgp.RoutingOptions.GracefulRestart.Enable, nil) + } + if o.Protocol.Bgp.RoutingOptions.GracefulRestart.LocalRestartTime != nil { + nestedProtocol.Bgp.RoutingOptions.GracefulRestart.LocalRestartTime = o.Protocol.Bgp.RoutingOptions.GracefulRestart.LocalRestartTime + } + if o.Protocol.Bgp.RoutingOptions.GracefulRestart.MaxPeerRestartTime != nil { + nestedProtocol.Bgp.RoutingOptions.GracefulRestart.MaxPeerRestartTime = o.Protocol.Bgp.RoutingOptions.GracefulRestart.MaxPeerRestartTime + } + if o.Protocol.Bgp.RoutingOptions.GracefulRestart.StaleRouteTime != nil { + nestedProtocol.Bgp.RoutingOptions.GracefulRestart.StaleRouteTime = o.Protocol.Bgp.RoutingOptions.GracefulRestart.StaleRouteTime + } + } + if o.Protocol.Bgp.RoutingOptions.Med != nil { + nestedProtocol.Bgp.RoutingOptions.Med = &ProtocolBgpRoutingOptionsMedXml{} + if _, ok := o.Misc["ProtocolBgpRoutingOptionsMed"]; ok { + nestedProtocol.Bgp.RoutingOptions.Med.Misc = o.Misc["ProtocolBgpRoutingOptionsMed"] + } + if o.Protocol.Bgp.RoutingOptions.Med.AlwaysCompareMed != nil { + nestedProtocol.Bgp.RoutingOptions.Med.AlwaysCompareMed = util.YesNo(o.Protocol.Bgp.RoutingOptions.Med.AlwaysCompareMed, nil) + } + if o.Protocol.Bgp.RoutingOptions.Med.DeterministicMedComparison != nil { + nestedProtocol.Bgp.RoutingOptions.Med.DeterministicMedComparison = util.YesNo(o.Protocol.Bgp.RoutingOptions.Med.DeterministicMedComparison, nil) + } + } + if o.Protocol.Bgp.RoutingOptions.ReflectorClusterId != nil { + nestedProtocol.Bgp.RoutingOptions.ReflectorClusterId = o.Protocol.Bgp.RoutingOptions.ReflectorClusterId + } + if o.Protocol.Bgp.RoutingOptions.Aggregate != nil { + nestedProtocol.Bgp.RoutingOptions.Aggregate = &ProtocolBgpRoutingOptionsAggregateXml{} + if _, ok := o.Misc["ProtocolBgpRoutingOptionsAggregate"]; ok { + nestedProtocol.Bgp.RoutingOptions.Aggregate.Misc = o.Misc["ProtocolBgpRoutingOptionsAggregate"] + } + if o.Protocol.Bgp.RoutingOptions.Aggregate.AggregateMed != nil { + nestedProtocol.Bgp.RoutingOptions.Aggregate.AggregateMed = util.YesNo(o.Protocol.Bgp.RoutingOptions.Aggregate.AggregateMed, nil) + } + } + if o.Protocol.Bgp.RoutingOptions.AsFormat != nil { + nestedProtocol.Bgp.RoutingOptions.AsFormat = o.Protocol.Bgp.RoutingOptions.AsFormat + } + if o.Protocol.Bgp.RoutingOptions.ConfederationMemberAs != nil { + nestedProtocol.Bgp.RoutingOptions.ConfederationMemberAs = o.Protocol.Bgp.RoutingOptions.ConfederationMemberAs + } + } + if o.Protocol.Bgp.AllowRedistDefaultRoute != nil { + nestedProtocol.Bgp.AllowRedistDefaultRoute = util.YesNo(o.Protocol.Bgp.AllowRedistDefaultRoute, nil) + } + if o.Protocol.Bgp.EcmpMultiAs != nil { + nestedProtocol.Bgp.EcmpMultiAs = util.YesNo(o.Protocol.Bgp.EcmpMultiAs, nil) + } + if o.Protocol.Bgp.GlobalBfd != nil { + nestedProtocol.Bgp.GlobalBfd = &ProtocolBgpGlobalBfdXml{} + if _, ok := o.Misc["ProtocolBgpGlobalBfd"]; ok { + nestedProtocol.Bgp.GlobalBfd.Misc = o.Misc["ProtocolBgpGlobalBfd"] + } + if o.Protocol.Bgp.GlobalBfd.Profile != nil { + nestedProtocol.Bgp.GlobalBfd.Profile = o.Protocol.Bgp.GlobalBfd.Profile + } + } + if o.Protocol.Bgp.LocalAs != nil { + nestedProtocol.Bgp.LocalAs = o.Protocol.Bgp.LocalAs + } + if o.Protocol.Bgp.RouterId != nil { + nestedProtocol.Bgp.RouterId = o.Protocol.Bgp.RouterId + } + if o.Protocol.Bgp.EnforceFirstAs != nil { + nestedProtocol.Bgp.EnforceFirstAs = util.YesNo(o.Protocol.Bgp.EnforceFirstAs, nil) + } + if o.Protocol.Bgp.PeerGroup != nil { + nestedProtocol.Bgp.PeerGroup = []ProtocolBgpPeerGroupXml{} + for _, oProtocolBgpPeerGroup := range o.Protocol.Bgp.PeerGroup { + nestedProtocolBgpPeerGroup := ProtocolBgpPeerGroupXml{} + if _, ok := o.Misc["ProtocolBgpPeerGroup"]; ok { + nestedProtocolBgpPeerGroup.Misc = o.Misc["ProtocolBgpPeerGroup"] + } + if oProtocolBgpPeerGroup.Enable != nil { + nestedProtocolBgpPeerGroup.Enable = util.YesNo(oProtocolBgpPeerGroup.Enable, nil) + } + if oProtocolBgpPeerGroup.AggregatedConfedAsPath != nil { + nestedProtocolBgpPeerGroup.AggregatedConfedAsPath = util.YesNo(oProtocolBgpPeerGroup.AggregatedConfedAsPath, nil) + } + if oProtocolBgpPeerGroup.SoftResetWithStoredInfo != nil { + nestedProtocolBgpPeerGroup.SoftResetWithStoredInfo = util.YesNo(oProtocolBgpPeerGroup.SoftResetWithStoredInfo, nil) + } + if oProtocolBgpPeerGroup.Type != nil { + nestedProtocolBgpPeerGroup.Type = &ProtocolBgpPeerGroupTypeXml{} + if _, ok := o.Misc["ProtocolBgpPeerGroupType"]; ok { + nestedProtocolBgpPeerGroup.Type.Misc = o.Misc["ProtocolBgpPeerGroupType"] + } + if oProtocolBgpPeerGroup.Type.Ibgp != nil { + nestedProtocolBgpPeerGroup.Type.Ibgp = &ProtocolBgpPeerGroupTypeIbgpXml{} + if _, ok := o.Misc["ProtocolBgpPeerGroupTypeIbgp"]; ok { + nestedProtocolBgpPeerGroup.Type.Ibgp.Misc = o.Misc["ProtocolBgpPeerGroupTypeIbgp"] + } + if oProtocolBgpPeerGroup.Type.Ibgp.ExportNexthop != nil { + nestedProtocolBgpPeerGroup.Type.Ibgp.ExportNexthop = oProtocolBgpPeerGroup.Type.Ibgp.ExportNexthop + } + } + if oProtocolBgpPeerGroup.Type.EbgpConfed != nil { + nestedProtocolBgpPeerGroup.Type.EbgpConfed = &ProtocolBgpPeerGroupTypeEbgpConfedXml{} + if _, ok := o.Misc["ProtocolBgpPeerGroupTypeEbgpConfed"]; ok { + nestedProtocolBgpPeerGroup.Type.EbgpConfed.Misc = o.Misc["ProtocolBgpPeerGroupTypeEbgpConfed"] + } + if oProtocolBgpPeerGroup.Type.EbgpConfed.ExportNexthop != nil { + nestedProtocolBgpPeerGroup.Type.EbgpConfed.ExportNexthop = oProtocolBgpPeerGroup.Type.EbgpConfed.ExportNexthop + } + } + if oProtocolBgpPeerGroup.Type.IbgpConfed != nil { + nestedProtocolBgpPeerGroup.Type.IbgpConfed = &ProtocolBgpPeerGroupTypeIbgpConfedXml{} + if _, ok := o.Misc["ProtocolBgpPeerGroupTypeIbgpConfed"]; ok { + nestedProtocolBgpPeerGroup.Type.IbgpConfed.Misc = o.Misc["ProtocolBgpPeerGroupTypeIbgpConfed"] + } + if oProtocolBgpPeerGroup.Type.IbgpConfed.ExportNexthop != nil { + nestedProtocolBgpPeerGroup.Type.IbgpConfed.ExportNexthop = oProtocolBgpPeerGroup.Type.IbgpConfed.ExportNexthop + } + } + if oProtocolBgpPeerGroup.Type.Ebgp != nil { + nestedProtocolBgpPeerGroup.Type.Ebgp = &ProtocolBgpPeerGroupTypeEbgpXml{} + if _, ok := o.Misc["ProtocolBgpPeerGroupTypeEbgp"]; ok { + nestedProtocolBgpPeerGroup.Type.Ebgp.Misc = o.Misc["ProtocolBgpPeerGroupTypeEbgp"] + } + if oProtocolBgpPeerGroup.Type.Ebgp.ImportNexthop != nil { + nestedProtocolBgpPeerGroup.Type.Ebgp.ImportNexthop = oProtocolBgpPeerGroup.Type.Ebgp.ImportNexthop + } + if oProtocolBgpPeerGroup.Type.Ebgp.ExportNexthop != nil { + nestedProtocolBgpPeerGroup.Type.Ebgp.ExportNexthop = oProtocolBgpPeerGroup.Type.Ebgp.ExportNexthop + } + if oProtocolBgpPeerGroup.Type.Ebgp.RemovePrivateAs != nil { + nestedProtocolBgpPeerGroup.Type.Ebgp.RemovePrivateAs = util.YesNo(oProtocolBgpPeerGroup.Type.Ebgp.RemovePrivateAs, nil) + } + } + } + if oProtocolBgpPeerGroup.Peer != nil { + nestedProtocolBgpPeerGroup.Peer = []ProtocolBgpPeerGroupPeerXml{} + for _, oProtocolBgpPeerGroupPeer := range oProtocolBgpPeerGroup.Peer { + nestedProtocolBgpPeerGroupPeer := ProtocolBgpPeerGroupPeerXml{} + if _, ok := o.Misc["ProtocolBgpPeerGroupPeer"]; ok { + nestedProtocolBgpPeerGroupPeer.Misc = o.Misc["ProtocolBgpPeerGroupPeer"] + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions = &ProtocolBgpPeerGroupPeerConnectionOptionsXml{} + if _, ok := o.Misc["ProtocolBgpPeerGroupPeerConnectionOptions"]; ok { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.Misc = o.Misc["ProtocolBgpPeerGroupPeerConnectionOptions"] + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection = &ProtocolBgpPeerGroupPeerConnectionOptionsOutgoingBgpConnectionXml{} + if _, ok := o.Misc["ProtocolBgpPeerGroupPeerConnectionOptionsOutgoingBgpConnection"]; ok { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection.Misc = o.Misc["ProtocolBgpPeerGroupPeerConnectionOptionsOutgoingBgpConnection"] + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection.LocalPort != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection.LocalPort = oProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection.LocalPort + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection.Allow != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection.Allow = util.YesNo(oProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection.Allow, nil) + } + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.Authentication != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.Authentication = oProtocolBgpPeerGroupPeer.ConnectionOptions.Authentication + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.MinRouteAdvInterval != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.MinRouteAdvInterval = oProtocolBgpPeerGroupPeer.ConnectionOptions.MinRouteAdvInterval + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.Multihop != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.Multihop = oProtocolBgpPeerGroupPeer.ConnectionOptions.Multihop + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.OpenDelayTime != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.OpenDelayTime = oProtocolBgpPeerGroupPeer.ConnectionOptions.OpenDelayTime + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.KeepAliveInterval != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.KeepAliveInterval = oProtocolBgpPeerGroupPeer.ConnectionOptions.KeepAliveInterval + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.HoldTime != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.HoldTime = oProtocolBgpPeerGroupPeer.ConnectionOptions.HoldTime + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.IdleHoldTime != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.IdleHoldTime = oProtocolBgpPeerGroupPeer.ConnectionOptions.IdleHoldTime + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection = &ProtocolBgpPeerGroupPeerConnectionOptionsIncomingBgpConnectionXml{} + if _, ok := o.Misc["ProtocolBgpPeerGroupPeerConnectionOptionsIncomingBgpConnection"]; ok { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection.Misc = o.Misc["ProtocolBgpPeerGroupPeerConnectionOptionsIncomingBgpConnection"] + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection.RemotePort != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection.RemotePort = oProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection.RemotePort + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection.Allow != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection.Allow = util.YesNo(oProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection.Allow, nil) + } + } + } + if oProtocolBgpPeerGroupPeer.PeerAs != nil { + nestedProtocolBgpPeerGroupPeer.PeerAs = oProtocolBgpPeerGroupPeer.PeerAs + } + if oProtocolBgpPeerGroupPeer.ReflectorClient != nil { + nestedProtocolBgpPeerGroupPeer.ReflectorClient = oProtocolBgpPeerGroupPeer.ReflectorClient + } + if oProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier != nil { + nestedProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier = &ProtocolBgpPeerGroupPeerSubsequentAddressFamilyIdentifierXml{} + if _, ok := o.Misc["ProtocolBgpPeerGroupPeerSubsequentAddressFamilyIdentifier"]; ok { + nestedProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier.Misc = o.Misc["ProtocolBgpPeerGroupPeerSubsequentAddressFamilyIdentifier"] + } + if oProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier.Unicast != nil { + nestedProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier.Unicast = util.YesNo(oProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier.Unicast, nil) + } + if oProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier.Multicast != nil { + nestedProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier.Multicast = util.YesNo(oProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier.Multicast, nil) + } + } + if oProtocolBgpPeerGroupPeer.EnableMpBgp != nil { + nestedProtocolBgpPeerGroupPeer.EnableMpBgp = util.YesNo(oProtocolBgpPeerGroupPeer.EnableMpBgp, nil) + } + if oProtocolBgpPeerGroupPeer.AddressFamilyIdentifier != nil { + nestedProtocolBgpPeerGroupPeer.AddressFamilyIdentifier = oProtocolBgpPeerGroupPeer.AddressFamilyIdentifier + } + if oProtocolBgpPeerGroupPeer.Name != "" { + nestedProtocolBgpPeerGroupPeer.Name = oProtocolBgpPeerGroupPeer.Name + } + if oProtocolBgpPeerGroupPeer.MaxPrefixes != nil { + nestedProtocolBgpPeerGroupPeer.MaxPrefixes = oProtocolBgpPeerGroupPeer.MaxPrefixes + } + if oProtocolBgpPeerGroupPeer.PeerAddress != nil { + nestedProtocolBgpPeerGroupPeer.PeerAddress = &ProtocolBgpPeerGroupPeerPeerAddressXml{} + if _, ok := o.Misc["ProtocolBgpPeerGroupPeerPeerAddress"]; ok { + nestedProtocolBgpPeerGroupPeer.PeerAddress.Misc = o.Misc["ProtocolBgpPeerGroupPeerPeerAddress"] + } + if oProtocolBgpPeerGroupPeer.PeerAddress.Ip != nil { + nestedProtocolBgpPeerGroupPeer.PeerAddress.Ip = oProtocolBgpPeerGroupPeer.PeerAddress.Ip + } + if oProtocolBgpPeerGroupPeer.PeerAddress.Fqdn != nil { + nestedProtocolBgpPeerGroupPeer.PeerAddress.Fqdn = oProtocolBgpPeerGroupPeer.PeerAddress.Fqdn + } + } + if oProtocolBgpPeerGroupPeer.Bfd != nil { + nestedProtocolBgpPeerGroupPeer.Bfd = &ProtocolBgpPeerGroupPeerBfdXml{} + if _, ok := o.Misc["ProtocolBgpPeerGroupPeerBfd"]; ok { + nestedProtocolBgpPeerGroupPeer.Bfd.Misc = o.Misc["ProtocolBgpPeerGroupPeerBfd"] + } + if oProtocolBgpPeerGroupPeer.Bfd.Profile != nil { + nestedProtocolBgpPeerGroupPeer.Bfd.Profile = oProtocolBgpPeerGroupPeer.Bfd.Profile + } + } + if oProtocolBgpPeerGroupPeer.LocalAddress != nil { + nestedProtocolBgpPeerGroupPeer.LocalAddress = &ProtocolBgpPeerGroupPeerLocalAddressXml{} + if _, ok := o.Misc["ProtocolBgpPeerGroupPeerLocalAddress"]; ok { + nestedProtocolBgpPeerGroupPeer.LocalAddress.Misc = o.Misc["ProtocolBgpPeerGroupPeerLocalAddress"] + } + if oProtocolBgpPeerGroupPeer.LocalAddress.Interface != nil { + nestedProtocolBgpPeerGroupPeer.LocalAddress.Interface = oProtocolBgpPeerGroupPeer.LocalAddress.Interface + } + if oProtocolBgpPeerGroupPeer.LocalAddress.Ip != nil { + nestedProtocolBgpPeerGroupPeer.LocalAddress.Ip = oProtocolBgpPeerGroupPeer.LocalAddress.Ip + } + } + if oProtocolBgpPeerGroupPeer.Enable != nil { + nestedProtocolBgpPeerGroupPeer.Enable = util.YesNo(oProtocolBgpPeerGroupPeer.Enable, nil) + } + if oProtocolBgpPeerGroupPeer.EnableSenderSideLoopDetection != nil { + nestedProtocolBgpPeerGroupPeer.EnableSenderSideLoopDetection = util.YesNo(oProtocolBgpPeerGroupPeer.EnableSenderSideLoopDetection, nil) + } + if oProtocolBgpPeerGroupPeer.PeeringType != nil { + nestedProtocolBgpPeerGroupPeer.PeeringType = oProtocolBgpPeerGroupPeer.PeeringType + } + nestedProtocolBgpPeerGroup.Peer = append(nestedProtocolBgpPeerGroup.Peer, nestedProtocolBgpPeerGroupPeer) + } + } + if oProtocolBgpPeerGroup.Name != "" { + nestedProtocolBgpPeerGroup.Name = oProtocolBgpPeerGroup.Name + } + nestedProtocol.Bgp.PeerGroup = append(nestedProtocol.Bgp.PeerGroup, nestedProtocolBgpPeerGroup) + } + } + if o.Protocol.Bgp.RedistRules != nil { + nestedProtocol.Bgp.RedistRules = []ProtocolBgpRedistRulesXml{} + for _, oProtocolBgpRedistRules := range o.Protocol.Bgp.RedistRules { + nestedProtocolBgpRedistRules := ProtocolBgpRedistRulesXml{} + if _, ok := o.Misc["ProtocolBgpRedistRules"]; ok { + nestedProtocolBgpRedistRules.Misc = o.Misc["ProtocolBgpRedistRules"] + } + if oProtocolBgpRedistRules.RouteTable != nil { + nestedProtocolBgpRedistRules.RouteTable = oProtocolBgpRedistRules.RouteTable + } + if oProtocolBgpRedistRules.Enable != nil { + nestedProtocolBgpRedistRules.Enable = util.YesNo(oProtocolBgpRedistRules.Enable, nil) + } + if oProtocolBgpRedistRules.SetMed != nil { + nestedProtocolBgpRedistRules.SetMed = oProtocolBgpRedistRules.SetMed + } + if oProtocolBgpRedistRules.SetLocalPreference != nil { + nestedProtocolBgpRedistRules.SetLocalPreference = oProtocolBgpRedistRules.SetLocalPreference + } + if oProtocolBgpRedistRules.SetAsPathLimit != nil { + nestedProtocolBgpRedistRules.SetAsPathLimit = oProtocolBgpRedistRules.SetAsPathLimit + } + if oProtocolBgpRedistRules.Metric != nil { + nestedProtocolBgpRedistRules.Metric = oProtocolBgpRedistRules.Metric + } + if oProtocolBgpRedistRules.SetCommunity != nil { + nestedProtocolBgpRedistRules.SetCommunity = util.StrToMem(oProtocolBgpRedistRules.SetCommunity) + } + if oProtocolBgpRedistRules.AddressFamilyIdentifier != nil { + nestedProtocolBgpRedistRules.AddressFamilyIdentifier = oProtocolBgpRedistRules.AddressFamilyIdentifier + } + if oProtocolBgpRedistRules.SetOrigin != nil { + nestedProtocolBgpRedistRules.SetOrigin = oProtocolBgpRedistRules.SetOrigin + } + if oProtocolBgpRedistRules.SetExtendedCommunity != nil { + nestedProtocolBgpRedistRules.SetExtendedCommunity = util.StrToMem(oProtocolBgpRedistRules.SetExtendedCommunity) + } + if oProtocolBgpRedistRules.Name != "" { + nestedProtocolBgpRedistRules.Name = oProtocolBgpRedistRules.Name + } + nestedProtocol.Bgp.RedistRules = append(nestedProtocol.Bgp.RedistRules, nestedProtocolBgpRedistRules) + } + } + if o.Protocol.Bgp.RejectDefaultRoute != nil { + nestedProtocol.Bgp.RejectDefaultRoute = util.YesNo(o.Protocol.Bgp.RejectDefaultRoute, nil) + } + if o.Protocol.Bgp.DampeningProfile != nil { + nestedProtocol.Bgp.DampeningProfile = []ProtocolBgpDampeningProfileXml{} + for _, oProtocolBgpDampeningProfile := range o.Protocol.Bgp.DampeningProfile { + nestedProtocolBgpDampeningProfile := ProtocolBgpDampeningProfileXml{} + if _, ok := o.Misc["ProtocolBgpDampeningProfile"]; ok { + nestedProtocolBgpDampeningProfile.Misc = o.Misc["ProtocolBgpDampeningProfile"] + } + if oProtocolBgpDampeningProfile.Enable != nil { + nestedProtocolBgpDampeningProfile.Enable = util.YesNo(oProtocolBgpDampeningProfile.Enable, nil) + } + if oProtocolBgpDampeningProfile.Cutoff != nil { + nestedProtocolBgpDampeningProfile.Cutoff = oProtocolBgpDampeningProfile.Cutoff + } + if oProtocolBgpDampeningProfile.Reuse != nil { + nestedProtocolBgpDampeningProfile.Reuse = oProtocolBgpDampeningProfile.Reuse + } + if oProtocolBgpDampeningProfile.MaxHoldTime != nil { + nestedProtocolBgpDampeningProfile.MaxHoldTime = oProtocolBgpDampeningProfile.MaxHoldTime + } + if oProtocolBgpDampeningProfile.DecayHalfLifeReachable != nil { + nestedProtocolBgpDampeningProfile.DecayHalfLifeReachable = oProtocolBgpDampeningProfile.DecayHalfLifeReachable + } + if oProtocolBgpDampeningProfile.DecayHalfLifeUnreachable != nil { + nestedProtocolBgpDampeningProfile.DecayHalfLifeUnreachable = oProtocolBgpDampeningProfile.DecayHalfLifeUnreachable + } + if oProtocolBgpDampeningProfile.Name != "" { + nestedProtocolBgpDampeningProfile.Name = oProtocolBgpDampeningProfile.Name + } + nestedProtocol.Bgp.DampeningProfile = append(nestedProtocol.Bgp.DampeningProfile, nestedProtocolBgpDampeningProfile) + } + } + if o.Protocol.Bgp.Policy != nil { + nestedProtocol.Bgp.Policy = &ProtocolBgpPolicyXml{} + if _, ok := o.Misc["ProtocolBgpPolicy"]; ok { + nestedProtocol.Bgp.Policy.Misc = o.Misc["ProtocolBgpPolicy"] + } + if o.Protocol.Bgp.Policy.Aggregation != nil { + nestedProtocol.Bgp.Policy.Aggregation = &ProtocolBgpPolicyAggregationXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregation"]; ok { + nestedProtocol.Bgp.Policy.Aggregation.Misc = o.Misc["ProtocolBgpPolicyAggregation"] + } + if o.Protocol.Bgp.Policy.Aggregation.Address != nil { + nestedProtocol.Bgp.Policy.Aggregation.Address = []ProtocolBgpPolicyAggregationAddressXml{} + for _, oProtocolBgpPolicyAggregationAddress := range o.Protocol.Bgp.Policy.Aggregation.Address { + nestedProtocolBgpPolicyAggregationAddress := ProtocolBgpPolicyAggregationAddressXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddress"]; ok { + nestedProtocolBgpPolicyAggregationAddress.Misc = o.Misc["ProtocolBgpPolicyAggregationAddress"] + } + if oProtocolBgpPolicyAggregationAddress.Name != "" { + nestedProtocolBgpPolicyAggregationAddress.Name = oProtocolBgpPolicyAggregationAddress.Name + } + if oProtocolBgpPolicyAggregationAddress.Prefix != nil { + nestedProtocolBgpPolicyAggregationAddress.Prefix = oProtocolBgpPolicyAggregationAddress.Prefix + } + if oProtocolBgpPolicyAggregationAddress.Enable != nil { + nestedProtocolBgpPolicyAggregationAddress.Enable = util.YesNo(oProtocolBgpPolicyAggregationAddress.Enable, nil) + } + if oProtocolBgpPolicyAggregationAddress.Summary != nil { + nestedProtocolBgpPolicyAggregationAddress.Summary = util.YesNo(oProtocolBgpPolicyAggregationAddress.Summary, nil) + } + if oProtocolBgpPolicyAggregationAddress.AsSet != nil { + nestedProtocolBgpPolicyAggregationAddress.AsSet = util.YesNo(oProtocolBgpPolicyAggregationAddress.AsSet, nil) + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributes"]; ok { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributes"] + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.LocalPreference != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.LocalPreference = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.LocalPreference + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Med != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Med = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Med + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Weight != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Weight = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Weight + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Nexthop != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Nexthop = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Nexthop + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Origin != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Origin = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Origin + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPathLimit != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPathLimit = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPathLimit + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPath"]; ok { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPath"] + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Prepend != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Prepend = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Prepend + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.None != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.None = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathNoneXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathNone"]; ok { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.None.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathNone"] + } + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Remove != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Remove = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathRemoveXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathRemove"]; ok { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Remove.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathRemove"] + } + } + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunity"]; ok { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunity"] + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.Append != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.Append = util.StrToMem(oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.Append) + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.Overwrite != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.Overwrite = util.StrToMem(oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.Overwrite) + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.None != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.None = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityNoneXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityNone"]; ok { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.None.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityNone"] + } + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.RemoveAll != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.RemoveAll = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityRemoveAllXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityRemoveAll"]; ok { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.RemoveAll.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityRemoveAll"] + } + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.RemoveRegex != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.RemoveRegex = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.RemoveRegex + } + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunity"]; ok { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunity"] + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.None != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.None = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityNoneXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityNone"]; ok { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.None.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityNone"] + } + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.RemoveAll != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.RemoveAll = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityRemoveAllXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityRemoveAll"]; ok { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.RemoveAll.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityRemoveAll"] + } + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.RemoveRegex != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.RemoveRegex = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.RemoveRegex + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.Append != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.Append = util.StrToMem(oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.Append) + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.Overwrite != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.Overwrite = util.StrToMem(oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.Overwrite) + } + } + } + if oProtocolBgpPolicyAggregationAddress.SuppressFilters != nil { + nestedProtocolBgpPolicyAggregationAddress.SuppressFilters = []ProtocolBgpPolicyAggregationAddressSuppressFiltersXml{} + for _, oProtocolBgpPolicyAggregationAddressSuppressFilters := range oProtocolBgpPolicyAggregationAddress.SuppressFilters { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters := ProtocolBgpPolicyAggregationAddressSuppressFiltersXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressSuppressFilters"]; ok { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressSuppressFilters"] + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match = &ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressSuppressFiltersMatch"]; ok { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressSuppressFiltersMatch"] + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Community != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Community = &ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchCommunity"]; ok { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Community.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchCommunity"] + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Community.Regex != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Community.Regex = oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Community.Regex + } + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.ExtendedCommunity != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.ExtendedCommunity = &ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchExtendedCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchExtendedCommunity"]; ok { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.ExtendedCommunity.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchExtendedCommunity"] + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.ExtendedCommunity.Regex != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.ExtendedCommunity.Regex = oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.ExtendedCommunity.Regex + } + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.RouteTable != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.RouteTable = oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.RouteTable + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Med != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Med = oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Med + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AddressPrefix != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AddressPrefix = []ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefixXml{} + for _, oProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix := range oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AddressPrefix { + nestedProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix := ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefixXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix"]; ok { + nestedProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix"] + } + if oProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix.Exact != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix.Exact = util.YesNo(oProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix.Exact, nil) + } + if oProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix.Name != "" { + nestedProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix.Name = oProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix.Name + } + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AddressPrefix = append(nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AddressPrefix, nestedProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix) + } + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Nexthop != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Nexthop = util.StrToMem(oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Nexthop) + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.FromPeer != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.FromPeer = util.StrToMem(oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.FromPeer) + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AsPath != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AsPath = &ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAsPathXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAsPath"]; ok { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AsPath.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAsPath"] + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AsPath.Regex != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AsPath.Regex = oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AsPath.Regex + } + } + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Name != "" { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Name = oProtocolBgpPolicyAggregationAddressSuppressFilters.Name + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Enable != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Enable = util.YesNo(oProtocolBgpPolicyAggregationAddressSuppressFilters.Enable, nil) + } + nestedProtocolBgpPolicyAggregationAddress.SuppressFilters = append(nestedProtocolBgpPolicyAggregationAddress.SuppressFilters, nestedProtocolBgpPolicyAggregationAddressSuppressFilters) + } + } + if oProtocolBgpPolicyAggregationAddress.AdvertiseFilters != nil { + nestedProtocolBgpPolicyAggregationAddress.AdvertiseFilters = []ProtocolBgpPolicyAggregationAddressAdvertiseFiltersXml{} + for _, oProtocolBgpPolicyAggregationAddressAdvertiseFilters := range oProtocolBgpPolicyAggregationAddress.AdvertiseFilters { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters := ProtocolBgpPolicyAggregationAddressAdvertiseFiltersXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFilters"]; ok { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFilters"] + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Enable != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Enable = util.YesNo(oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Enable, nil) + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match = &ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatch"]; ok { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatch"] + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AsPath != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AsPath = &ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAsPathXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAsPath"]; ok { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AsPath.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAsPath"] + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AsPath.Regex != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AsPath.Regex = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AsPath.Regex + } + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Community != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Community = &ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchCommunity"]; ok { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Community.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchCommunity"] + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Community.Regex != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Community.Regex = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Community.Regex + } + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.ExtendedCommunity != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.ExtendedCommunity = &ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchExtendedCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchExtendedCommunity"]; ok { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.ExtendedCommunity.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchExtendedCommunity"] + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.ExtendedCommunity.Regex != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.ExtendedCommunity.Regex = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.ExtendedCommunity.Regex + } + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.RouteTable != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.RouteTable = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.RouteTable + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Med != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Med = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Med + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AddressPrefix != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AddressPrefix = []ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefixXml{} + for _, oProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix := range oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AddressPrefix { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix := ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefixXml{} + if _, ok := o.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix"]; ok { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix.Misc = o.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix"] + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix.Exact != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix.Exact = util.YesNo(oProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix.Exact, nil) + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix.Name != "" { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix.Name = oProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix.Name + } + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AddressPrefix = append(nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AddressPrefix, nestedProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix) + } + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Nexthop != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Nexthop = util.StrToMem(oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Nexthop) + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.FromPeer != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.FromPeer = util.StrToMem(oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.FromPeer) + } + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Name != "" { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Name = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Name + } + nestedProtocolBgpPolicyAggregationAddress.AdvertiseFilters = append(nestedProtocolBgpPolicyAggregationAddress.AdvertiseFilters, nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters) + } + } + nestedProtocol.Bgp.Policy.Aggregation.Address = append(nestedProtocol.Bgp.Policy.Aggregation.Address, nestedProtocolBgpPolicyAggregationAddress) + } + } + } + if o.Protocol.Bgp.Policy.ConditionalAdvertisement != nil { + nestedProtocol.Bgp.Policy.ConditionalAdvertisement = &ProtocolBgpPolicyConditionalAdvertisementXml{} + if _, ok := o.Misc["ProtocolBgpPolicyConditionalAdvertisement"]; ok { + nestedProtocol.Bgp.Policy.ConditionalAdvertisement.Misc = o.Misc["ProtocolBgpPolicyConditionalAdvertisement"] + } + if o.Protocol.Bgp.Policy.ConditionalAdvertisement.Policy != nil { + nestedProtocol.Bgp.Policy.ConditionalAdvertisement.Policy = []ProtocolBgpPolicyConditionalAdvertisementPolicyXml{} + for _, oProtocolBgpPolicyConditionalAdvertisementPolicy := range o.Protocol.Bgp.Policy.ConditionalAdvertisement.Policy { + nestedProtocolBgpPolicyConditionalAdvertisementPolicy := ProtocolBgpPolicyConditionalAdvertisementPolicyXml{} + if _, ok := o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicy"]; ok { + nestedProtocolBgpPolicyConditionalAdvertisementPolicy.Misc = o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicy"] + } + if oProtocolBgpPolicyConditionalAdvertisementPolicy.Enable != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicy.Enable = util.YesNo(oProtocolBgpPolicyConditionalAdvertisementPolicy.Enable, nil) + } + if oProtocolBgpPolicyConditionalAdvertisementPolicy.UsedBy != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicy.UsedBy = util.StrToMem(oProtocolBgpPolicyConditionalAdvertisementPolicy.UsedBy) + } + if oProtocolBgpPolicyConditionalAdvertisementPolicy.NonExistFilters != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicy.NonExistFilters = []ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersXml{} + for _, oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters := range oProtocolBgpPolicyConditionalAdvertisementPolicy.NonExistFilters { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters := ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersXml{} + if _, ok := o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters"]; ok { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Misc = o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters"] + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Enable != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Enable = util.YesNo(oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Enable, nil) + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match = &ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchXml{} + if _, ok := o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatch"]; ok { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Misc = o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatch"] + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Community != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Community = &ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchCommunity"]; ok { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Community.Misc = o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchCommunity"] + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Community.Regex != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Community.Regex = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Community.Regex + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.ExtendedCommunity != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.ExtendedCommunity = &ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchExtendedCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchExtendedCommunity"]; ok { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.ExtendedCommunity.Misc = o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchExtendedCommunity"] + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.ExtendedCommunity.Regex != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.ExtendedCommunity.Regex = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.ExtendedCommunity.Regex + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.RouteTable != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.RouteTable = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.RouteTable + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Med != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Med = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Med + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AddressPrefix != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AddressPrefix = []ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefixXml{} + for _, oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix := range oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AddressPrefix { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix := ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefixXml{} + if _, ok := o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix"]; ok { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix.Misc = o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix"] + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix.Name != "" { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix.Name = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix.Name + } + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AddressPrefix = append(nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AddressPrefix, nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix) + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Nexthop != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Nexthop = util.StrToMem(oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Nexthop) + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.FromPeer != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.FromPeer = util.StrToMem(oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.FromPeer) + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AsPath != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AsPath = &ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAsPathXml{} + if _, ok := o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAsPath"]; ok { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AsPath.Misc = o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAsPath"] + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AsPath.Regex != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AsPath.Regex = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AsPath.Regex + } + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Name != "" { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Name = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Name + } + nestedProtocolBgpPolicyConditionalAdvertisementPolicy.NonExistFilters = append(nestedProtocolBgpPolicyConditionalAdvertisementPolicy.NonExistFilters, nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters) + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicy.AdvertiseFilters != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicy.AdvertiseFilters = []ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersXml{} + for _, oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters := range oProtocolBgpPolicyConditionalAdvertisementPolicy.AdvertiseFilters { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters := ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersXml{} + if _, ok := o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters"]; ok { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Misc = o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters"] + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Enable != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Enable = util.YesNo(oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Enable, nil) + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match = &ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchXml{} + if _, ok := o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatch"]; ok { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Misc = o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatch"] + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.ExtendedCommunity != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.ExtendedCommunity = &ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchExtendedCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchExtendedCommunity"]; ok { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.ExtendedCommunity.Misc = o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchExtendedCommunity"] + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.ExtendedCommunity.Regex != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.ExtendedCommunity.Regex = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.ExtendedCommunity.Regex + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.RouteTable != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.RouteTable = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.RouteTable + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Med != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Med = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Med + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AddressPrefix != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AddressPrefix = []ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefixXml{} + for _, oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix := range oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AddressPrefix { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix := ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefixXml{} + if _, ok := o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix"]; ok { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix.Misc = o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix"] + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix.Name != "" { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix.Name = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix.Name + } + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AddressPrefix = append(nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AddressPrefix, nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix) + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Nexthop != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Nexthop = util.StrToMem(oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Nexthop) + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.FromPeer != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.FromPeer = util.StrToMem(oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.FromPeer) + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AsPath != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AsPath = &ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAsPathXml{} + if _, ok := o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAsPath"]; ok { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AsPath.Misc = o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAsPath"] + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AsPath.Regex != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AsPath.Regex = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AsPath.Regex + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Community != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Community = &ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchCommunity"]; ok { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Community.Misc = o.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchCommunity"] + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Community.Regex != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Community.Regex = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Community.Regex + } + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Name != "" { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Name = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Name + } + nestedProtocolBgpPolicyConditionalAdvertisementPolicy.AdvertiseFilters = append(nestedProtocolBgpPolicyConditionalAdvertisementPolicy.AdvertiseFilters, nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters) + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicy.Name != "" { + nestedProtocolBgpPolicyConditionalAdvertisementPolicy.Name = oProtocolBgpPolicyConditionalAdvertisementPolicy.Name + } + nestedProtocol.Bgp.Policy.ConditionalAdvertisement.Policy = append(nestedProtocol.Bgp.Policy.ConditionalAdvertisement.Policy, nestedProtocolBgpPolicyConditionalAdvertisementPolicy) + } + } + } + if o.Protocol.Bgp.Policy.Export != nil { + nestedProtocol.Bgp.Policy.Export = &ProtocolBgpPolicyExportXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExport"]; ok { + nestedProtocol.Bgp.Policy.Export.Misc = o.Misc["ProtocolBgpPolicyExport"] + } + if o.Protocol.Bgp.Policy.Export.Rules != nil { + nestedProtocol.Bgp.Policy.Export.Rules = []ProtocolBgpPolicyExportRulesXml{} + for _, oProtocolBgpPolicyExportRules := range o.Protocol.Bgp.Policy.Export.Rules { + nestedProtocolBgpPolicyExportRules := ProtocolBgpPolicyExportRulesXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRules"]; ok { + nestedProtocolBgpPolicyExportRules.Misc = o.Misc["ProtocolBgpPolicyExportRules"] + } + if oProtocolBgpPolicyExportRules.Enable != nil { + nestedProtocolBgpPolicyExportRules.Enable = util.YesNo(oProtocolBgpPolicyExportRules.Enable, nil) + } + if oProtocolBgpPolicyExportRules.UsedBy != nil { + nestedProtocolBgpPolicyExportRules.UsedBy = util.StrToMem(oProtocolBgpPolicyExportRules.UsedBy) + } + if oProtocolBgpPolicyExportRules.Match != nil { + nestedProtocolBgpPolicyExportRules.Match = &ProtocolBgpPolicyExportRulesMatchXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesMatch"]; ok { + nestedProtocolBgpPolicyExportRules.Match.Misc = o.Misc["ProtocolBgpPolicyExportRulesMatch"] + } + if oProtocolBgpPolicyExportRules.Match.AddressPrefix != nil { + nestedProtocolBgpPolicyExportRules.Match.AddressPrefix = []ProtocolBgpPolicyExportRulesMatchAddressPrefixXml{} + for _, oProtocolBgpPolicyExportRulesMatchAddressPrefix := range oProtocolBgpPolicyExportRules.Match.AddressPrefix { + nestedProtocolBgpPolicyExportRulesMatchAddressPrefix := ProtocolBgpPolicyExportRulesMatchAddressPrefixXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesMatchAddressPrefix"]; ok { + nestedProtocolBgpPolicyExportRulesMatchAddressPrefix.Misc = o.Misc["ProtocolBgpPolicyExportRulesMatchAddressPrefix"] + } + if oProtocolBgpPolicyExportRulesMatchAddressPrefix.Exact != nil { + nestedProtocolBgpPolicyExportRulesMatchAddressPrefix.Exact = util.YesNo(oProtocolBgpPolicyExportRulesMatchAddressPrefix.Exact, nil) + } + if oProtocolBgpPolicyExportRulesMatchAddressPrefix.Name != "" { + nestedProtocolBgpPolicyExportRulesMatchAddressPrefix.Name = oProtocolBgpPolicyExportRulesMatchAddressPrefix.Name + } + nestedProtocolBgpPolicyExportRules.Match.AddressPrefix = append(nestedProtocolBgpPolicyExportRules.Match.AddressPrefix, nestedProtocolBgpPolicyExportRulesMatchAddressPrefix) + } + } + if oProtocolBgpPolicyExportRules.Match.Nexthop != nil { + nestedProtocolBgpPolicyExportRules.Match.Nexthop = util.StrToMem(oProtocolBgpPolicyExportRules.Match.Nexthop) + } + if oProtocolBgpPolicyExportRules.Match.FromPeer != nil { + nestedProtocolBgpPolicyExportRules.Match.FromPeer = util.StrToMem(oProtocolBgpPolicyExportRules.Match.FromPeer) + } + if oProtocolBgpPolicyExportRules.Match.AsPath != nil { + nestedProtocolBgpPolicyExportRules.Match.AsPath = &ProtocolBgpPolicyExportRulesMatchAsPathXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesMatchAsPath"]; ok { + nestedProtocolBgpPolicyExportRules.Match.AsPath.Misc = o.Misc["ProtocolBgpPolicyExportRulesMatchAsPath"] + } + if oProtocolBgpPolicyExportRules.Match.AsPath.Regex != nil { + nestedProtocolBgpPolicyExportRules.Match.AsPath.Regex = oProtocolBgpPolicyExportRules.Match.AsPath.Regex + } + } + if oProtocolBgpPolicyExportRules.Match.Community != nil { + nestedProtocolBgpPolicyExportRules.Match.Community = &ProtocolBgpPolicyExportRulesMatchCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesMatchCommunity"]; ok { + nestedProtocolBgpPolicyExportRules.Match.Community.Misc = o.Misc["ProtocolBgpPolicyExportRulesMatchCommunity"] + } + if oProtocolBgpPolicyExportRules.Match.Community.Regex != nil { + nestedProtocolBgpPolicyExportRules.Match.Community.Regex = oProtocolBgpPolicyExportRules.Match.Community.Regex + } + } + if oProtocolBgpPolicyExportRules.Match.ExtendedCommunity != nil { + nestedProtocolBgpPolicyExportRules.Match.ExtendedCommunity = &ProtocolBgpPolicyExportRulesMatchExtendedCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesMatchExtendedCommunity"]; ok { + nestedProtocolBgpPolicyExportRules.Match.ExtendedCommunity.Misc = o.Misc["ProtocolBgpPolicyExportRulesMatchExtendedCommunity"] + } + if oProtocolBgpPolicyExportRules.Match.ExtendedCommunity.Regex != nil { + nestedProtocolBgpPolicyExportRules.Match.ExtendedCommunity.Regex = oProtocolBgpPolicyExportRules.Match.ExtendedCommunity.Regex + } + } + if oProtocolBgpPolicyExportRules.Match.RouteTable != nil { + nestedProtocolBgpPolicyExportRules.Match.RouteTable = oProtocolBgpPolicyExportRules.Match.RouteTable + } + if oProtocolBgpPolicyExportRules.Match.Med != nil { + nestedProtocolBgpPolicyExportRules.Match.Med = oProtocolBgpPolicyExportRules.Match.Med + } + } + if oProtocolBgpPolicyExportRules.Action != nil { + nestedProtocolBgpPolicyExportRules.Action = &ProtocolBgpPolicyExportRulesActionXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesAction"]; ok { + nestedProtocolBgpPolicyExportRules.Action.Misc = o.Misc["ProtocolBgpPolicyExportRulesAction"] + } + if oProtocolBgpPolicyExportRules.Action.Deny != nil { + nestedProtocolBgpPolicyExportRules.Action.Deny = &ProtocolBgpPolicyExportRulesActionDenyXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesActionDeny"]; ok { + nestedProtocolBgpPolicyExportRules.Action.Deny.Misc = o.Misc["ProtocolBgpPolicyExportRulesActionDeny"] + } + } + if oProtocolBgpPolicyExportRules.Action.Allow != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow = &ProtocolBgpPolicyExportRulesActionAllowXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesActionAllow"]; ok { + nestedProtocolBgpPolicyExportRules.Action.Allow.Misc = o.Misc["ProtocolBgpPolicyExportRulesActionAllow"] + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update = &ProtocolBgpPolicyExportRulesActionAllowUpdateXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdate"]; ok { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Misc = o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdate"] + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Med != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Med = oProtocolBgpPolicyExportRules.Action.Allow.Update.Med + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Nexthop != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Nexthop = oProtocolBgpPolicyExportRules.Action.Allow.Update.Nexthop + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Origin != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Origin = oProtocolBgpPolicyExportRules.Action.Allow.Update.Origin + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPathLimit != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.AsPathLimit = oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPathLimit + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath = &ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateAsPath"]; ok { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Misc = o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateAsPath"] + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.None != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.None = &ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathNoneXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathNone"]; ok { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.None.Misc = o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathNone"] + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Remove != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Remove = &ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathRemoveXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathRemove"]; ok { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Remove.Misc = o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathRemove"] + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Prepend != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Prepend = oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Prepend + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.RemoveAndPrepend != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.RemoveAndPrepend = oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.RemoveAndPrepend + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Community != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Community = &ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateCommunity"]; ok { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Community.Misc = o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateCommunity"] + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.Overwrite != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Community.Overwrite = util.StrToMem(oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.Overwrite) + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.None != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Community.None = &ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityNoneXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityNone"]; ok { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Community.None.Misc = o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityNone"] + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.RemoveAll != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Community.RemoveAll = &ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityRemoveAllXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityRemoveAll"]; ok { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Community.RemoveAll.Misc = o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityRemoveAll"] + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.RemoveRegex != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Community.RemoveRegex = oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.RemoveRegex + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.Append != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Community.Append = util.StrToMem(oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.Append) + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity = &ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunity"]; ok { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.Misc = o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunity"] + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.None != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.None = &ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityNoneXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityNone"]; ok { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.None.Misc = o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityNone"] + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.RemoveAll != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.RemoveAll = &ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityRemoveAllXml{} + if _, ok := o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityRemoveAll"]; ok { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.RemoveAll.Misc = o.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityRemoveAll"] + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.RemoveRegex != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.RemoveRegex = oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.RemoveRegex + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.Append != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.Append = util.StrToMem(oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.Append) + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.Overwrite != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.Overwrite = util.StrToMem(oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.Overwrite) + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.LocalPreference != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.LocalPreference = oProtocolBgpPolicyExportRules.Action.Allow.Update.LocalPreference + } + } + } + } + if oProtocolBgpPolicyExportRules.Name != "" { + nestedProtocolBgpPolicyExportRules.Name = oProtocolBgpPolicyExportRules.Name + } + nestedProtocol.Bgp.Policy.Export.Rules = append(nestedProtocol.Bgp.Policy.Export.Rules, nestedProtocolBgpPolicyExportRules) + } + } + } + if o.Protocol.Bgp.Policy.Import != nil { + nestedProtocol.Bgp.Policy.Import = &ProtocolBgpPolicyImportXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImport"]; ok { + nestedProtocol.Bgp.Policy.Import.Misc = o.Misc["ProtocolBgpPolicyImport"] + } + if o.Protocol.Bgp.Policy.Import.Rules != nil { + nestedProtocol.Bgp.Policy.Import.Rules = []ProtocolBgpPolicyImportRulesXml{} + for _, oProtocolBgpPolicyImportRules := range o.Protocol.Bgp.Policy.Import.Rules { + nestedProtocolBgpPolicyImportRules := ProtocolBgpPolicyImportRulesXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRules"]; ok { + nestedProtocolBgpPolicyImportRules.Misc = o.Misc["ProtocolBgpPolicyImportRules"] + } + if oProtocolBgpPolicyImportRules.Name != "" { + nestedProtocolBgpPolicyImportRules.Name = oProtocolBgpPolicyImportRules.Name + } + if oProtocolBgpPolicyImportRules.Enable != nil { + nestedProtocolBgpPolicyImportRules.Enable = util.YesNo(oProtocolBgpPolicyImportRules.Enable, nil) + } + if oProtocolBgpPolicyImportRules.UsedBy != nil { + nestedProtocolBgpPolicyImportRules.UsedBy = util.StrToMem(oProtocolBgpPolicyImportRules.UsedBy) + } + if oProtocolBgpPolicyImportRules.Match != nil { + nestedProtocolBgpPolicyImportRules.Match = &ProtocolBgpPolicyImportRulesMatchXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesMatch"]; ok { + nestedProtocolBgpPolicyImportRules.Match.Misc = o.Misc["ProtocolBgpPolicyImportRulesMatch"] + } + if oProtocolBgpPolicyImportRules.Match.FromPeer != nil { + nestedProtocolBgpPolicyImportRules.Match.FromPeer = util.StrToMem(oProtocolBgpPolicyImportRules.Match.FromPeer) + } + if oProtocolBgpPolicyImportRules.Match.AsPath != nil { + nestedProtocolBgpPolicyImportRules.Match.AsPath = &ProtocolBgpPolicyImportRulesMatchAsPathXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesMatchAsPath"]; ok { + nestedProtocolBgpPolicyImportRules.Match.AsPath.Misc = o.Misc["ProtocolBgpPolicyImportRulesMatchAsPath"] + } + if oProtocolBgpPolicyImportRules.Match.AsPath.Regex != nil { + nestedProtocolBgpPolicyImportRules.Match.AsPath.Regex = oProtocolBgpPolicyImportRules.Match.AsPath.Regex + } + } + if oProtocolBgpPolicyImportRules.Match.Community != nil { + nestedProtocolBgpPolicyImportRules.Match.Community = &ProtocolBgpPolicyImportRulesMatchCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesMatchCommunity"]; ok { + nestedProtocolBgpPolicyImportRules.Match.Community.Misc = o.Misc["ProtocolBgpPolicyImportRulesMatchCommunity"] + } + if oProtocolBgpPolicyImportRules.Match.Community.Regex != nil { + nestedProtocolBgpPolicyImportRules.Match.Community.Regex = oProtocolBgpPolicyImportRules.Match.Community.Regex + } + } + if oProtocolBgpPolicyImportRules.Match.ExtendedCommunity != nil { + nestedProtocolBgpPolicyImportRules.Match.ExtendedCommunity = &ProtocolBgpPolicyImportRulesMatchExtendedCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesMatchExtendedCommunity"]; ok { + nestedProtocolBgpPolicyImportRules.Match.ExtendedCommunity.Misc = o.Misc["ProtocolBgpPolicyImportRulesMatchExtendedCommunity"] + } + if oProtocolBgpPolicyImportRules.Match.ExtendedCommunity.Regex != nil { + nestedProtocolBgpPolicyImportRules.Match.ExtendedCommunity.Regex = oProtocolBgpPolicyImportRules.Match.ExtendedCommunity.Regex + } + } + if oProtocolBgpPolicyImportRules.Match.RouteTable != nil { + nestedProtocolBgpPolicyImportRules.Match.RouteTable = oProtocolBgpPolicyImportRules.Match.RouteTable + } + if oProtocolBgpPolicyImportRules.Match.Med != nil { + nestedProtocolBgpPolicyImportRules.Match.Med = oProtocolBgpPolicyImportRules.Match.Med + } + if oProtocolBgpPolicyImportRules.Match.AddressPrefix != nil { + nestedProtocolBgpPolicyImportRules.Match.AddressPrefix = []ProtocolBgpPolicyImportRulesMatchAddressPrefixXml{} + for _, oProtocolBgpPolicyImportRulesMatchAddressPrefix := range oProtocolBgpPolicyImportRules.Match.AddressPrefix { + nestedProtocolBgpPolicyImportRulesMatchAddressPrefix := ProtocolBgpPolicyImportRulesMatchAddressPrefixXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesMatchAddressPrefix"]; ok { + nestedProtocolBgpPolicyImportRulesMatchAddressPrefix.Misc = o.Misc["ProtocolBgpPolicyImportRulesMatchAddressPrefix"] + } + if oProtocolBgpPolicyImportRulesMatchAddressPrefix.Exact != nil { + nestedProtocolBgpPolicyImportRulesMatchAddressPrefix.Exact = util.YesNo(oProtocolBgpPolicyImportRulesMatchAddressPrefix.Exact, nil) + } + if oProtocolBgpPolicyImportRulesMatchAddressPrefix.Name != "" { + nestedProtocolBgpPolicyImportRulesMatchAddressPrefix.Name = oProtocolBgpPolicyImportRulesMatchAddressPrefix.Name + } + nestedProtocolBgpPolicyImportRules.Match.AddressPrefix = append(nestedProtocolBgpPolicyImportRules.Match.AddressPrefix, nestedProtocolBgpPolicyImportRulesMatchAddressPrefix) + } + } + if oProtocolBgpPolicyImportRules.Match.Nexthop != nil { + nestedProtocolBgpPolicyImportRules.Match.Nexthop = util.StrToMem(oProtocolBgpPolicyImportRules.Match.Nexthop) + } + } + if oProtocolBgpPolicyImportRules.Action != nil { + nestedProtocolBgpPolicyImportRules.Action = &ProtocolBgpPolicyImportRulesActionXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesAction"]; ok { + nestedProtocolBgpPolicyImportRules.Action.Misc = o.Misc["ProtocolBgpPolicyImportRulesAction"] + } + if oProtocolBgpPolicyImportRules.Action.Deny != nil { + nestedProtocolBgpPolicyImportRules.Action.Deny = &ProtocolBgpPolicyImportRulesActionDenyXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesActionDeny"]; ok { + nestedProtocolBgpPolicyImportRules.Action.Deny.Misc = o.Misc["ProtocolBgpPolicyImportRulesActionDeny"] + } + } + if oProtocolBgpPolicyImportRules.Action.Allow != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow = &ProtocolBgpPolicyImportRulesActionAllowXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesActionAllow"]; ok { + nestedProtocolBgpPolicyImportRules.Action.Allow.Misc = o.Misc["ProtocolBgpPolicyImportRulesActionAllow"] + } + if oProtocolBgpPolicyImportRules.Action.Allow.Dampening != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Dampening = oProtocolBgpPolicyImportRules.Action.Allow.Dampening + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update = &ProtocolBgpPolicyImportRulesActionAllowUpdateXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdate"]; ok { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Misc = o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdate"] + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.LocalPreference != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.LocalPreference = oProtocolBgpPolicyImportRules.Action.Allow.Update.LocalPreference + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Weight != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Weight = oProtocolBgpPolicyImportRules.Action.Allow.Update.Weight + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Nexthop != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Nexthop = oProtocolBgpPolicyImportRules.Action.Allow.Update.Nexthop + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath = &ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateAsPath"]; ok { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.Misc = o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateAsPath"] + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.None != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.None = &ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathNoneXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathNone"]; ok { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.None.Misc = o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathNone"] + } + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.Remove != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.Remove = &ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathRemoveXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathRemove"]; ok { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.Remove.Misc = o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathRemove"] + } + } + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Med != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Med = oProtocolBgpPolicyImportRules.Action.Allow.Update.Med + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Origin != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Origin = oProtocolBgpPolicyImportRules.Action.Allow.Update.Origin + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPathLimit != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.AsPathLimit = oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPathLimit + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Community != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Community = &ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateCommunity"]; ok { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Community.Misc = o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateCommunity"] + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.Append != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Community.Append = util.StrToMem(oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.Append) + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.Overwrite != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Community.Overwrite = util.StrToMem(oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.Overwrite) + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.None != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Community.None = &ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityNoneXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityNone"]; ok { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Community.None.Misc = o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityNone"] + } + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.RemoveAll != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Community.RemoveAll = &ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityRemoveAllXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityRemoveAll"]; ok { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Community.RemoveAll.Misc = o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityRemoveAll"] + } + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.RemoveRegex != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Community.RemoveRegex = oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.RemoveRegex + } + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity = &ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunity"]; ok { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.Misc = o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunity"] + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.Append != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.Append = util.StrToMem(oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.Append) + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.Overwrite != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.Overwrite = util.StrToMem(oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.Overwrite) + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.None != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.None = &ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityNoneXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityNone"]; ok { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.None.Misc = o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityNone"] + } + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.RemoveAll != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.RemoveAll = &ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityRemoveAllXml{} + if _, ok := o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityRemoveAll"]; ok { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.RemoveAll.Misc = o.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityRemoveAll"] + } + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.RemoveRegex != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.RemoveRegex = oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.RemoveRegex + } + } + } + } + } + nestedProtocol.Bgp.Policy.Import.Rules = append(nestedProtocol.Bgp.Policy.Import.Rules, nestedProtocolBgpPolicyImportRules) + } + } + } + } + } + if o.Protocol.Ospf != nil { + nestedProtocol.Ospf = &ProtocolOspfXml{} + if _, ok := o.Misc["ProtocolOspf"]; ok { + nestedProtocol.Ospf.Misc = o.Misc["ProtocolOspf"] + } + if o.Protocol.Ospf.Area != nil { + nestedProtocol.Ospf.Area = []ProtocolOspfAreaXml{} + for _, oProtocolOspfArea := range o.Protocol.Ospf.Area { + nestedProtocolOspfArea := ProtocolOspfAreaXml{} + if _, ok := o.Misc["ProtocolOspfArea"]; ok { + nestedProtocolOspfArea.Misc = o.Misc["ProtocolOspfArea"] + } + if oProtocolOspfArea.VirtualLink != nil { + nestedProtocolOspfArea.VirtualLink = []ProtocolOspfAreaVirtualLinkXml{} + for _, oProtocolOspfAreaVirtualLink := range oProtocolOspfArea.VirtualLink { + nestedProtocolOspfAreaVirtualLink := ProtocolOspfAreaVirtualLinkXml{} + if _, ok := o.Misc["ProtocolOspfAreaVirtualLink"]; ok { + nestedProtocolOspfAreaVirtualLink.Misc = o.Misc["ProtocolOspfAreaVirtualLink"] + } + if oProtocolOspfAreaVirtualLink.TransitAreaId != nil { + nestedProtocolOspfAreaVirtualLink.TransitAreaId = oProtocolOspfAreaVirtualLink.TransitAreaId + } + if oProtocolOspfAreaVirtualLink.Enable != nil { + nestedProtocolOspfAreaVirtualLink.Enable = util.YesNo(oProtocolOspfAreaVirtualLink.Enable, nil) + } + if oProtocolOspfAreaVirtualLink.HelloInterval != nil { + nestedProtocolOspfAreaVirtualLink.HelloInterval = oProtocolOspfAreaVirtualLink.HelloInterval + } + if oProtocolOspfAreaVirtualLink.RetransmitInterval != nil { + nestedProtocolOspfAreaVirtualLink.RetransmitInterval = oProtocolOspfAreaVirtualLink.RetransmitInterval + } + if oProtocolOspfAreaVirtualLink.TransitDelay != nil { + nestedProtocolOspfAreaVirtualLink.TransitDelay = oProtocolOspfAreaVirtualLink.TransitDelay + } + if oProtocolOspfAreaVirtualLink.Name != "" { + nestedProtocolOspfAreaVirtualLink.Name = oProtocolOspfAreaVirtualLink.Name + } + if oProtocolOspfAreaVirtualLink.NeighborId != nil { + nestedProtocolOspfAreaVirtualLink.NeighborId = oProtocolOspfAreaVirtualLink.NeighborId + } + if oProtocolOspfAreaVirtualLink.DeadCounts != nil { + nestedProtocolOspfAreaVirtualLink.DeadCounts = oProtocolOspfAreaVirtualLink.DeadCounts + } + if oProtocolOspfAreaVirtualLink.Authentication != nil { + nestedProtocolOspfAreaVirtualLink.Authentication = oProtocolOspfAreaVirtualLink.Authentication + } + if oProtocolOspfAreaVirtualLink.Bfd != nil { + nestedProtocolOspfAreaVirtualLink.Bfd = &ProtocolOspfAreaVirtualLinkBfdXml{} + if _, ok := o.Misc["ProtocolOspfAreaVirtualLinkBfd"]; ok { + nestedProtocolOspfAreaVirtualLink.Bfd.Misc = o.Misc["ProtocolOspfAreaVirtualLinkBfd"] + } + if oProtocolOspfAreaVirtualLink.Bfd.Profile != nil { + nestedProtocolOspfAreaVirtualLink.Bfd.Profile = oProtocolOspfAreaVirtualLink.Bfd.Profile + } + } + nestedProtocolOspfArea.VirtualLink = append(nestedProtocolOspfArea.VirtualLink, nestedProtocolOspfAreaVirtualLink) + } + } + if oProtocolOspfArea.Name != "" { + nestedProtocolOspfArea.Name = oProtocolOspfArea.Name + } + if oProtocolOspfArea.Type != nil { + nestedProtocolOspfArea.Type = &ProtocolOspfAreaTypeXml{} + if _, ok := o.Misc["ProtocolOspfAreaType"]; ok { + nestedProtocolOspfArea.Type.Misc = o.Misc["ProtocolOspfAreaType"] + } + if oProtocolOspfArea.Type.Nssa != nil { + nestedProtocolOspfArea.Type.Nssa = &ProtocolOspfAreaTypeNssaXml{} + if _, ok := o.Misc["ProtocolOspfAreaTypeNssa"]; ok { + nestedProtocolOspfArea.Type.Nssa.Misc = o.Misc["ProtocolOspfAreaTypeNssa"] + } + if oProtocolOspfArea.Type.Nssa.AcceptSummary != nil { + nestedProtocolOspfArea.Type.Nssa.AcceptSummary = util.YesNo(oProtocolOspfArea.Type.Nssa.AcceptSummary, nil) + } + if oProtocolOspfArea.Type.Nssa.DefaultRoute != nil { + nestedProtocolOspfArea.Type.Nssa.DefaultRoute = &ProtocolOspfAreaTypeNssaDefaultRouteXml{} + if _, ok := o.Misc["ProtocolOspfAreaTypeNssaDefaultRoute"]; ok { + nestedProtocolOspfArea.Type.Nssa.DefaultRoute.Misc = o.Misc["ProtocolOspfAreaTypeNssaDefaultRoute"] + } + if oProtocolOspfArea.Type.Nssa.DefaultRoute.Disable != nil { + nestedProtocolOspfArea.Type.Nssa.DefaultRoute.Disable = &ProtocolOspfAreaTypeNssaDefaultRouteDisableXml{} + if _, ok := o.Misc["ProtocolOspfAreaTypeNssaDefaultRouteDisable"]; ok { + nestedProtocolOspfArea.Type.Nssa.DefaultRoute.Disable.Misc = o.Misc["ProtocolOspfAreaTypeNssaDefaultRouteDisable"] + } + } + if oProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise != nil { + nestedProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise = &ProtocolOspfAreaTypeNssaDefaultRouteAdvertiseXml{} + if _, ok := o.Misc["ProtocolOspfAreaTypeNssaDefaultRouteAdvertise"]; ok { + nestedProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise.Misc = o.Misc["ProtocolOspfAreaTypeNssaDefaultRouteAdvertise"] + } + if oProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise.Type != nil { + nestedProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise.Type = oProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise.Type + } + if oProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise.Metric != nil { + nestedProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise.Metric = oProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise.Metric + } + } + } + if oProtocolOspfArea.Type.Nssa.NssaExtRange != nil { + nestedProtocolOspfArea.Type.Nssa.NssaExtRange = []ProtocolOspfAreaTypeNssaNssaExtRangeXml{} + for _, oProtocolOspfAreaTypeNssaNssaExtRange := range oProtocolOspfArea.Type.Nssa.NssaExtRange { + nestedProtocolOspfAreaTypeNssaNssaExtRange := ProtocolOspfAreaTypeNssaNssaExtRangeXml{} + if _, ok := o.Misc["ProtocolOspfAreaTypeNssaNssaExtRange"]; ok { + nestedProtocolOspfAreaTypeNssaNssaExtRange.Misc = o.Misc["ProtocolOspfAreaTypeNssaNssaExtRange"] + } + if oProtocolOspfAreaTypeNssaNssaExtRange.Name != "" { + nestedProtocolOspfAreaTypeNssaNssaExtRange.Name = oProtocolOspfAreaTypeNssaNssaExtRange.Name + } + if oProtocolOspfAreaTypeNssaNssaExtRange.Advertise != nil { + nestedProtocolOspfAreaTypeNssaNssaExtRange.Advertise = &ProtocolOspfAreaTypeNssaNssaExtRangeAdvertiseXml{} + if _, ok := o.Misc["ProtocolOspfAreaTypeNssaNssaExtRangeAdvertise"]; ok { + nestedProtocolOspfAreaTypeNssaNssaExtRange.Advertise.Misc = o.Misc["ProtocolOspfAreaTypeNssaNssaExtRangeAdvertise"] + } + } + if oProtocolOspfAreaTypeNssaNssaExtRange.Suppress != nil { + nestedProtocolOspfAreaTypeNssaNssaExtRange.Suppress = &ProtocolOspfAreaTypeNssaNssaExtRangeSuppressXml{} + if _, ok := o.Misc["ProtocolOspfAreaTypeNssaNssaExtRangeSuppress"]; ok { + nestedProtocolOspfAreaTypeNssaNssaExtRange.Suppress.Misc = o.Misc["ProtocolOspfAreaTypeNssaNssaExtRangeSuppress"] + } + } + nestedProtocolOspfArea.Type.Nssa.NssaExtRange = append(nestedProtocolOspfArea.Type.Nssa.NssaExtRange, nestedProtocolOspfAreaTypeNssaNssaExtRange) + } + } + } + if oProtocolOspfArea.Type.Normal != nil { + nestedProtocolOspfArea.Type.Normal = &ProtocolOspfAreaTypeNormalXml{} + if _, ok := o.Misc["ProtocolOspfAreaTypeNormal"]; ok { + nestedProtocolOspfArea.Type.Normal.Misc = o.Misc["ProtocolOspfAreaTypeNormal"] + } + } + if oProtocolOspfArea.Type.Stub != nil { + nestedProtocolOspfArea.Type.Stub = &ProtocolOspfAreaTypeStubXml{} + if _, ok := o.Misc["ProtocolOspfAreaTypeStub"]; ok { + nestedProtocolOspfArea.Type.Stub.Misc = o.Misc["ProtocolOspfAreaTypeStub"] + } + if oProtocolOspfArea.Type.Stub.AcceptSummary != nil { + nestedProtocolOspfArea.Type.Stub.AcceptSummary = util.YesNo(oProtocolOspfArea.Type.Stub.AcceptSummary, nil) + } + if oProtocolOspfArea.Type.Stub.DefaultRoute != nil { + nestedProtocolOspfArea.Type.Stub.DefaultRoute = &ProtocolOspfAreaTypeStubDefaultRouteXml{} + if _, ok := o.Misc["ProtocolOspfAreaTypeStubDefaultRoute"]; ok { + nestedProtocolOspfArea.Type.Stub.DefaultRoute.Misc = o.Misc["ProtocolOspfAreaTypeStubDefaultRoute"] + } + if oProtocolOspfArea.Type.Stub.DefaultRoute.Disable != nil { + nestedProtocolOspfArea.Type.Stub.DefaultRoute.Disable = &ProtocolOspfAreaTypeStubDefaultRouteDisableXml{} + if _, ok := o.Misc["ProtocolOspfAreaTypeStubDefaultRouteDisable"]; ok { + nestedProtocolOspfArea.Type.Stub.DefaultRoute.Disable.Misc = o.Misc["ProtocolOspfAreaTypeStubDefaultRouteDisable"] + } + } + if oProtocolOspfArea.Type.Stub.DefaultRoute.Advertise != nil { + nestedProtocolOspfArea.Type.Stub.DefaultRoute.Advertise = &ProtocolOspfAreaTypeStubDefaultRouteAdvertiseXml{} + if _, ok := o.Misc["ProtocolOspfAreaTypeStubDefaultRouteAdvertise"]; ok { + nestedProtocolOspfArea.Type.Stub.DefaultRoute.Advertise.Misc = o.Misc["ProtocolOspfAreaTypeStubDefaultRouteAdvertise"] + } + if oProtocolOspfArea.Type.Stub.DefaultRoute.Advertise.Metric != nil { + nestedProtocolOspfArea.Type.Stub.DefaultRoute.Advertise.Metric = oProtocolOspfArea.Type.Stub.DefaultRoute.Advertise.Metric + } + } + } + } + } + if oProtocolOspfArea.Range != nil { + nestedProtocolOspfArea.Range = []ProtocolOspfAreaRangeXml{} + for _, oProtocolOspfAreaRange := range oProtocolOspfArea.Range { + nestedProtocolOspfAreaRange := ProtocolOspfAreaRangeXml{} + if _, ok := o.Misc["ProtocolOspfAreaRange"]; ok { + nestedProtocolOspfAreaRange.Misc = o.Misc["ProtocolOspfAreaRange"] + } + if oProtocolOspfAreaRange.Name != "" { + nestedProtocolOspfAreaRange.Name = oProtocolOspfAreaRange.Name + } + if oProtocolOspfAreaRange.Advertise != nil { + nestedProtocolOspfAreaRange.Advertise = &ProtocolOspfAreaRangeAdvertiseXml{} + if _, ok := o.Misc["ProtocolOspfAreaRangeAdvertise"]; ok { + nestedProtocolOspfAreaRange.Advertise.Misc = o.Misc["ProtocolOspfAreaRangeAdvertise"] + } + } + if oProtocolOspfAreaRange.Suppress != nil { + nestedProtocolOspfAreaRange.Suppress = &ProtocolOspfAreaRangeSuppressXml{} + if _, ok := o.Misc["ProtocolOspfAreaRangeSuppress"]; ok { + nestedProtocolOspfAreaRange.Suppress.Misc = o.Misc["ProtocolOspfAreaRangeSuppress"] + } + } + nestedProtocolOspfArea.Range = append(nestedProtocolOspfArea.Range, nestedProtocolOspfAreaRange) + } + } + if oProtocolOspfArea.Interface != nil { + nestedProtocolOspfArea.Interface = []ProtocolOspfAreaInterfaceXml{} + for _, oProtocolOspfAreaInterface := range oProtocolOspfArea.Interface { + nestedProtocolOspfAreaInterface := ProtocolOspfAreaInterfaceXml{} + if _, ok := o.Misc["ProtocolOspfAreaInterface"]; ok { + nestedProtocolOspfAreaInterface.Misc = o.Misc["ProtocolOspfAreaInterface"] + } + if oProtocolOspfAreaInterface.Metric != nil { + nestedProtocolOspfAreaInterface.Metric = oProtocolOspfAreaInterface.Metric + } + if oProtocolOspfAreaInterface.TransitDelay != nil { + nestedProtocolOspfAreaInterface.TransitDelay = oProtocolOspfAreaInterface.TransitDelay + } + if oProtocolOspfAreaInterface.Priority != nil { + nestedProtocolOspfAreaInterface.Priority = oProtocolOspfAreaInterface.Priority + } + if oProtocolOspfAreaInterface.HelloInterval != nil { + nestedProtocolOspfAreaInterface.HelloInterval = oProtocolOspfAreaInterface.HelloInterval + } + if oProtocolOspfAreaInterface.Authentication != nil { + nestedProtocolOspfAreaInterface.Authentication = oProtocolOspfAreaInterface.Authentication + } + if oProtocolOspfAreaInterface.GrDelay != nil { + nestedProtocolOspfAreaInterface.GrDelay = oProtocolOspfAreaInterface.GrDelay + } + if oProtocolOspfAreaInterface.Enable != nil { + nestedProtocolOspfAreaInterface.Enable = util.YesNo(oProtocolOspfAreaInterface.Enable, nil) + } + if oProtocolOspfAreaInterface.DeadCounts != nil { + nestedProtocolOspfAreaInterface.DeadCounts = oProtocolOspfAreaInterface.DeadCounts + } + if oProtocolOspfAreaInterface.Neighbor != nil { + nestedProtocolOspfAreaInterface.Neighbor = []ProtocolOspfAreaInterfaceNeighborXml{} + for _, oProtocolOspfAreaInterfaceNeighbor := range oProtocolOspfAreaInterface.Neighbor { + nestedProtocolOspfAreaInterfaceNeighbor := ProtocolOspfAreaInterfaceNeighborXml{} + if _, ok := o.Misc["ProtocolOspfAreaInterfaceNeighbor"]; ok { + nestedProtocolOspfAreaInterfaceNeighbor.Misc = o.Misc["ProtocolOspfAreaInterfaceNeighbor"] + } + if oProtocolOspfAreaInterfaceNeighbor.Name != "" { + nestedProtocolOspfAreaInterfaceNeighbor.Name = oProtocolOspfAreaInterfaceNeighbor.Name + } + nestedProtocolOspfAreaInterface.Neighbor = append(nestedProtocolOspfAreaInterface.Neighbor, nestedProtocolOspfAreaInterfaceNeighbor) + } + } + if oProtocolOspfAreaInterface.Name != "" { + nestedProtocolOspfAreaInterface.Name = oProtocolOspfAreaInterface.Name + } + if oProtocolOspfAreaInterface.Passive != nil { + nestedProtocolOspfAreaInterface.Passive = util.YesNo(oProtocolOspfAreaInterface.Passive, nil) + } + if oProtocolOspfAreaInterface.RetransmitInterval != nil { + nestedProtocolOspfAreaInterface.RetransmitInterval = oProtocolOspfAreaInterface.RetransmitInterval + } + if oProtocolOspfAreaInterface.LinkType != nil { + nestedProtocolOspfAreaInterface.LinkType = &ProtocolOspfAreaInterfaceLinkTypeXml{} + if _, ok := o.Misc["ProtocolOspfAreaInterfaceLinkType"]; ok { + nestedProtocolOspfAreaInterface.LinkType.Misc = o.Misc["ProtocolOspfAreaInterfaceLinkType"] + } + if oProtocolOspfAreaInterface.LinkType.Broadcast != nil { + nestedProtocolOspfAreaInterface.LinkType.Broadcast = &ProtocolOspfAreaInterfaceLinkTypeBroadcastXml{} + if _, ok := o.Misc["ProtocolOspfAreaInterfaceLinkTypeBroadcast"]; ok { + nestedProtocolOspfAreaInterface.LinkType.Broadcast.Misc = o.Misc["ProtocolOspfAreaInterfaceLinkTypeBroadcast"] + } + } + if oProtocolOspfAreaInterface.LinkType.P2p != nil { + nestedProtocolOspfAreaInterface.LinkType.P2p = &ProtocolOspfAreaInterfaceLinkTypeP2pXml{} + if _, ok := o.Misc["ProtocolOspfAreaInterfaceLinkTypeP2p"]; ok { + nestedProtocolOspfAreaInterface.LinkType.P2p.Misc = o.Misc["ProtocolOspfAreaInterfaceLinkTypeP2p"] + } + } + if oProtocolOspfAreaInterface.LinkType.P2mp != nil { + nestedProtocolOspfAreaInterface.LinkType.P2mp = &ProtocolOspfAreaInterfaceLinkTypeP2mpXml{} + if _, ok := o.Misc["ProtocolOspfAreaInterfaceLinkTypeP2mp"]; ok { + nestedProtocolOspfAreaInterface.LinkType.P2mp.Misc = o.Misc["ProtocolOspfAreaInterfaceLinkTypeP2mp"] + } + } + } + if oProtocolOspfAreaInterface.Bfd != nil { + nestedProtocolOspfAreaInterface.Bfd = &ProtocolOspfAreaInterfaceBfdXml{} + if _, ok := o.Misc["ProtocolOspfAreaInterfaceBfd"]; ok { + nestedProtocolOspfAreaInterface.Bfd.Misc = o.Misc["ProtocolOspfAreaInterfaceBfd"] + } + if oProtocolOspfAreaInterface.Bfd.Profile != nil { + nestedProtocolOspfAreaInterface.Bfd.Profile = oProtocolOspfAreaInterface.Bfd.Profile + } + } + nestedProtocolOspfArea.Interface = append(nestedProtocolOspfArea.Interface, nestedProtocolOspfAreaInterface) + } + } + nestedProtocol.Ospf.Area = append(nestedProtocol.Ospf.Area, nestedProtocolOspfArea) + } + } + if o.Protocol.Ospf.AuthProfile != nil { + nestedProtocol.Ospf.AuthProfile = []ProtocolOspfAuthProfileXml{} + for _, oProtocolOspfAuthProfile := range o.Protocol.Ospf.AuthProfile { + nestedProtocolOspfAuthProfile := ProtocolOspfAuthProfileXml{} + if _, ok := o.Misc["ProtocolOspfAuthProfile"]; ok { + nestedProtocolOspfAuthProfile.Misc = o.Misc["ProtocolOspfAuthProfile"] + } + if oProtocolOspfAuthProfile.Name != "" { + nestedProtocolOspfAuthProfile.Name = oProtocolOspfAuthProfile.Name + } + if oProtocolOspfAuthProfile.Password != nil { + nestedProtocolOspfAuthProfile.Password = oProtocolOspfAuthProfile.Password + } + if oProtocolOspfAuthProfile.Md5 != nil { + nestedProtocolOspfAuthProfile.Md5 = []ProtocolOspfAuthProfileMd5Xml{} + for _, oProtocolOspfAuthProfileMd5 := range oProtocolOspfAuthProfile.Md5 { + nestedProtocolOspfAuthProfileMd5 := ProtocolOspfAuthProfileMd5Xml{} + if _, ok := o.Misc["ProtocolOspfAuthProfileMd5"]; ok { + nestedProtocolOspfAuthProfileMd5.Misc = o.Misc["ProtocolOspfAuthProfileMd5"] + } + if oProtocolOspfAuthProfileMd5.Key != nil { + nestedProtocolOspfAuthProfileMd5.Key = oProtocolOspfAuthProfileMd5.Key + } + if oProtocolOspfAuthProfileMd5.Preferred != nil { + nestedProtocolOspfAuthProfileMd5.Preferred = util.YesNo(oProtocolOspfAuthProfileMd5.Preferred, nil) + } + if oProtocolOspfAuthProfileMd5.Name != "" { + nestedProtocolOspfAuthProfileMd5.Name = oProtocolOspfAuthProfileMd5.Name + } + nestedProtocolOspfAuthProfile.Md5 = append(nestedProtocolOspfAuthProfile.Md5, nestedProtocolOspfAuthProfileMd5) + } + } + nestedProtocol.Ospf.AuthProfile = append(nestedProtocol.Ospf.AuthProfile, nestedProtocolOspfAuthProfile) + } + } + if o.Protocol.Ospf.Enable != nil { + nestedProtocol.Ospf.Enable = util.YesNo(o.Protocol.Ospf.Enable, nil) + } + if o.Protocol.Ospf.ExportRules != nil { + nestedProtocol.Ospf.ExportRules = []ProtocolOspfExportRulesXml{} + for _, oProtocolOspfExportRules := range o.Protocol.Ospf.ExportRules { + nestedProtocolOspfExportRules := ProtocolOspfExportRulesXml{} + if _, ok := o.Misc["ProtocolOspfExportRules"]; ok { + nestedProtocolOspfExportRules.Misc = o.Misc["ProtocolOspfExportRules"] + } + if oProtocolOspfExportRules.NewTag != nil { + nestedProtocolOspfExportRules.NewTag = oProtocolOspfExportRules.NewTag + } + if oProtocolOspfExportRules.Metric != nil { + nestedProtocolOspfExportRules.Metric = oProtocolOspfExportRules.Metric + } + if oProtocolOspfExportRules.Name != "" { + nestedProtocolOspfExportRules.Name = oProtocolOspfExportRules.Name + } + if oProtocolOspfExportRules.NewPathType != nil { + nestedProtocolOspfExportRules.NewPathType = oProtocolOspfExportRules.NewPathType + } + nestedProtocol.Ospf.ExportRules = append(nestedProtocol.Ospf.ExportRules, nestedProtocolOspfExportRules) + } + } + if o.Protocol.Ospf.RouterId != nil { + nestedProtocol.Ospf.RouterId = o.Protocol.Ospf.RouterId + } + if o.Protocol.Ospf.Timers != nil { + nestedProtocol.Ospf.Timers = &ProtocolOspfTimersXml{} + if _, ok := o.Misc["ProtocolOspfTimers"]; ok { + nestedProtocol.Ospf.Timers.Misc = o.Misc["ProtocolOspfTimers"] + } + if o.Protocol.Ospf.Timers.LsaInterval != nil { + nestedProtocol.Ospf.Timers.LsaInterval = o.Protocol.Ospf.Timers.LsaInterval + } + if o.Protocol.Ospf.Timers.SpfCalculationDelay != nil { + nestedProtocol.Ospf.Timers.SpfCalculationDelay = o.Protocol.Ospf.Timers.SpfCalculationDelay + } + } + if o.Protocol.Ospf.AllowRedistDefaultRoute != nil { + nestedProtocol.Ospf.AllowRedistDefaultRoute = util.YesNo(o.Protocol.Ospf.AllowRedistDefaultRoute, nil) + } + if o.Protocol.Ospf.GlobalBfd != nil { + nestedProtocol.Ospf.GlobalBfd = &ProtocolOspfGlobalBfdXml{} + if _, ok := o.Misc["ProtocolOspfGlobalBfd"]; ok { + nestedProtocol.Ospf.GlobalBfd.Misc = o.Misc["ProtocolOspfGlobalBfd"] + } + if o.Protocol.Ospf.GlobalBfd.Profile != nil { + nestedProtocol.Ospf.GlobalBfd.Profile = o.Protocol.Ospf.GlobalBfd.Profile + } + } + if o.Protocol.Ospf.GracefulRestart != nil { + nestedProtocol.Ospf.GracefulRestart = &ProtocolOspfGracefulRestartXml{} + if _, ok := o.Misc["ProtocolOspfGracefulRestart"]; ok { + nestedProtocol.Ospf.GracefulRestart.Misc = o.Misc["ProtocolOspfGracefulRestart"] + } + if o.Protocol.Ospf.GracefulRestart.Enable != nil { + nestedProtocol.Ospf.GracefulRestart.Enable = util.YesNo(o.Protocol.Ospf.GracefulRestart.Enable, nil) + } + if o.Protocol.Ospf.GracefulRestart.GracePeriod != nil { + nestedProtocol.Ospf.GracefulRestart.GracePeriod = o.Protocol.Ospf.GracefulRestart.GracePeriod + } + if o.Protocol.Ospf.GracefulRestart.HelperEnable != nil { + nestedProtocol.Ospf.GracefulRestart.HelperEnable = util.YesNo(o.Protocol.Ospf.GracefulRestart.HelperEnable, nil) + } + if o.Protocol.Ospf.GracefulRestart.MaxNeighborRestartTime != nil { + nestedProtocol.Ospf.GracefulRestart.MaxNeighborRestartTime = o.Protocol.Ospf.GracefulRestart.MaxNeighborRestartTime + } + if o.Protocol.Ospf.GracefulRestart.StrictLSAChecking != nil { + nestedProtocol.Ospf.GracefulRestart.StrictLSAChecking = util.YesNo(o.Protocol.Ospf.GracefulRestart.StrictLSAChecking, nil) + } + } + if o.Protocol.Ospf.RejectDefaultRoute != nil { + nestedProtocol.Ospf.RejectDefaultRoute = util.YesNo(o.Protocol.Ospf.RejectDefaultRoute, nil) + } + if o.Protocol.Ospf.Rfc1583 != nil { + nestedProtocol.Ospf.Rfc1583 = util.YesNo(o.Protocol.Ospf.Rfc1583, nil) + } + } + if o.Protocol.Ospfv3 != nil { + nestedProtocol.Ospfv3 = &ProtocolOspfv3Xml{} + if _, ok := o.Misc["ProtocolOspfv3"]; ok { + nestedProtocol.Ospfv3.Misc = o.Misc["ProtocolOspfv3"] + } + if o.Protocol.Ospfv3.Enable != nil { + nestedProtocol.Ospfv3.Enable = util.YesNo(o.Protocol.Ospfv3.Enable, nil) + } + if o.Protocol.Ospfv3.RouterId != nil { + nestedProtocol.Ospfv3.RouterId = o.Protocol.Ospfv3.RouterId + } + if o.Protocol.Ospfv3.Timers != nil { + nestedProtocol.Ospfv3.Timers = &ProtocolOspfv3TimersXml{} + if _, ok := o.Misc["ProtocolOspfv3Timers"]; ok { + nestedProtocol.Ospfv3.Timers.Misc = o.Misc["ProtocolOspfv3Timers"] + } + if o.Protocol.Ospfv3.Timers.LsaInterval != nil { + nestedProtocol.Ospfv3.Timers.LsaInterval = o.Protocol.Ospfv3.Timers.LsaInterval + } + if o.Protocol.Ospfv3.Timers.SpfCalculationDelay != nil { + nestedProtocol.Ospfv3.Timers.SpfCalculationDelay = o.Protocol.Ospfv3.Timers.SpfCalculationDelay + } + } + if o.Protocol.Ospfv3.AllowRedistDefaultRoute != nil { + nestedProtocol.Ospfv3.AllowRedistDefaultRoute = util.YesNo(o.Protocol.Ospfv3.AllowRedistDefaultRoute, nil) + } + if o.Protocol.Ospfv3.AuthProfile != nil { + nestedProtocol.Ospfv3.AuthProfile = []ProtocolOspfv3AuthProfileXml{} + for _, oProtocolOspfv3AuthProfile := range o.Protocol.Ospfv3.AuthProfile { + nestedProtocolOspfv3AuthProfile := ProtocolOspfv3AuthProfileXml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfile"]; ok { + nestedProtocolOspfv3AuthProfile.Misc = o.Misc["ProtocolOspfv3AuthProfile"] + } + if oProtocolOspfv3AuthProfile.Spi != nil { + nestedProtocolOspfv3AuthProfile.Spi = oProtocolOspfv3AuthProfile.Spi + } + if oProtocolOspfv3AuthProfile.Name != "" { + nestedProtocolOspfv3AuthProfile.Name = oProtocolOspfv3AuthProfile.Name + } + if oProtocolOspfv3AuthProfile.Esp != nil { + nestedProtocolOspfv3AuthProfile.Esp = &ProtocolOspfv3AuthProfileEspXml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfileEsp"]; ok { + nestedProtocolOspfv3AuthProfile.Esp.Misc = o.Misc["ProtocolOspfv3AuthProfileEsp"] + } + if oProtocolOspfv3AuthProfile.Esp.Authentication != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication = &ProtocolOspfv3AuthProfileEspAuthenticationXml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfileEspAuthentication"]; ok { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Misc = o.Misc["ProtocolOspfv3AuthProfileEspAuthentication"] + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.None != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.None = &ProtocolOspfv3AuthProfileEspAuthenticationNoneXml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfileEspAuthenticationNone"]; ok { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.None.Misc = o.Misc["ProtocolOspfv3AuthProfileEspAuthenticationNone"] + } + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Md5 != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Md5 = &ProtocolOspfv3AuthProfileEspAuthenticationMd5Xml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfileEspAuthenticationMd5"]; ok { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Md5.Misc = o.Misc["ProtocolOspfv3AuthProfileEspAuthenticationMd5"] + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Md5.Key != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Md5.Key = oProtocolOspfv3AuthProfile.Esp.Authentication.Md5.Key + } + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha1 != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha1 = &ProtocolOspfv3AuthProfileEspAuthenticationSha1Xml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfileEspAuthenticationSha1"]; ok { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha1.Misc = o.Misc["ProtocolOspfv3AuthProfileEspAuthenticationSha1"] + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha1.Key != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha1.Key = oProtocolOspfv3AuthProfile.Esp.Authentication.Sha1.Key + } + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha256 != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha256 = &ProtocolOspfv3AuthProfileEspAuthenticationSha256Xml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfileEspAuthenticationSha256"]; ok { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha256.Misc = o.Misc["ProtocolOspfv3AuthProfileEspAuthenticationSha256"] + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha256.Key != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha256.Key = oProtocolOspfv3AuthProfile.Esp.Authentication.Sha256.Key + } + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha384 != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha384 = &ProtocolOspfv3AuthProfileEspAuthenticationSha384Xml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfileEspAuthenticationSha384"]; ok { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha384.Misc = o.Misc["ProtocolOspfv3AuthProfileEspAuthenticationSha384"] + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha384.Key != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha384.Key = oProtocolOspfv3AuthProfile.Esp.Authentication.Sha384.Key + } + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha512 != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha512 = &ProtocolOspfv3AuthProfileEspAuthenticationSha512Xml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfileEspAuthenticationSha512"]; ok { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha512.Misc = o.Misc["ProtocolOspfv3AuthProfileEspAuthenticationSha512"] + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha512.Key != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha512.Key = oProtocolOspfv3AuthProfile.Esp.Authentication.Sha512.Key + } + } + } + if oProtocolOspfv3AuthProfile.Esp.Encryption != nil { + nestedProtocolOspfv3AuthProfile.Esp.Encryption = &ProtocolOspfv3AuthProfileEspEncryptionXml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfileEspEncryption"]; ok { + nestedProtocolOspfv3AuthProfile.Esp.Encryption.Misc = o.Misc["ProtocolOspfv3AuthProfileEspEncryption"] + } + if oProtocolOspfv3AuthProfile.Esp.Encryption.Algorithm != nil { + nestedProtocolOspfv3AuthProfile.Esp.Encryption.Algorithm = oProtocolOspfv3AuthProfile.Esp.Encryption.Algorithm + } + if oProtocolOspfv3AuthProfile.Esp.Encryption.Key != nil { + nestedProtocolOspfv3AuthProfile.Esp.Encryption.Key = oProtocolOspfv3AuthProfile.Esp.Encryption.Key + } + } + } + if oProtocolOspfv3AuthProfile.Ah != nil { + nestedProtocolOspfv3AuthProfile.Ah = &ProtocolOspfv3AuthProfileAhXml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfileAh"]; ok { + nestedProtocolOspfv3AuthProfile.Ah.Misc = o.Misc["ProtocolOspfv3AuthProfileAh"] + } + if oProtocolOspfv3AuthProfile.Ah.Sha256 != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha256 = &ProtocolOspfv3AuthProfileAhSha256Xml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfileAhSha256"]; ok { + nestedProtocolOspfv3AuthProfile.Ah.Sha256.Misc = o.Misc["ProtocolOspfv3AuthProfileAhSha256"] + } + if oProtocolOspfv3AuthProfile.Ah.Sha256.Key != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha256.Key = oProtocolOspfv3AuthProfile.Ah.Sha256.Key + } + } + if oProtocolOspfv3AuthProfile.Ah.Sha384 != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha384 = &ProtocolOspfv3AuthProfileAhSha384Xml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfileAhSha384"]; ok { + nestedProtocolOspfv3AuthProfile.Ah.Sha384.Misc = o.Misc["ProtocolOspfv3AuthProfileAhSha384"] + } + if oProtocolOspfv3AuthProfile.Ah.Sha384.Key != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha384.Key = oProtocolOspfv3AuthProfile.Ah.Sha384.Key + } + } + if oProtocolOspfv3AuthProfile.Ah.Sha512 != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha512 = &ProtocolOspfv3AuthProfileAhSha512Xml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfileAhSha512"]; ok { + nestedProtocolOspfv3AuthProfile.Ah.Sha512.Misc = o.Misc["ProtocolOspfv3AuthProfileAhSha512"] + } + if oProtocolOspfv3AuthProfile.Ah.Sha512.Key != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha512.Key = oProtocolOspfv3AuthProfile.Ah.Sha512.Key + } + } + if oProtocolOspfv3AuthProfile.Ah.Md5 != nil { + nestedProtocolOspfv3AuthProfile.Ah.Md5 = &ProtocolOspfv3AuthProfileAhMd5Xml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfileAhMd5"]; ok { + nestedProtocolOspfv3AuthProfile.Ah.Md5.Misc = o.Misc["ProtocolOspfv3AuthProfileAhMd5"] + } + if oProtocolOspfv3AuthProfile.Ah.Md5.Key != nil { + nestedProtocolOspfv3AuthProfile.Ah.Md5.Key = oProtocolOspfv3AuthProfile.Ah.Md5.Key + } + } + if oProtocolOspfv3AuthProfile.Ah.Sha1 != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha1 = &ProtocolOspfv3AuthProfileAhSha1Xml{} + if _, ok := o.Misc["ProtocolOspfv3AuthProfileAhSha1"]; ok { + nestedProtocolOspfv3AuthProfile.Ah.Sha1.Misc = o.Misc["ProtocolOspfv3AuthProfileAhSha1"] + } + if oProtocolOspfv3AuthProfile.Ah.Sha1.Key != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha1.Key = oProtocolOspfv3AuthProfile.Ah.Sha1.Key + } + } + } + nestedProtocol.Ospfv3.AuthProfile = append(nestedProtocol.Ospfv3.AuthProfile, nestedProtocolOspfv3AuthProfile) + } + } + if o.Protocol.Ospfv3.DisableTransitTraffic != nil { + nestedProtocol.Ospfv3.DisableTransitTraffic = util.YesNo(o.Protocol.Ospfv3.DisableTransitTraffic, nil) + } + if o.Protocol.Ospfv3.ExportRules != nil { + nestedProtocol.Ospfv3.ExportRules = []ProtocolOspfv3ExportRulesXml{} + for _, oProtocolOspfv3ExportRules := range o.Protocol.Ospfv3.ExportRules { + nestedProtocolOspfv3ExportRules := ProtocolOspfv3ExportRulesXml{} + if _, ok := o.Misc["ProtocolOspfv3ExportRules"]; ok { + nestedProtocolOspfv3ExportRules.Misc = o.Misc["ProtocolOspfv3ExportRules"] + } + if oProtocolOspfv3ExportRules.NewPathType != nil { + nestedProtocolOspfv3ExportRules.NewPathType = oProtocolOspfv3ExportRules.NewPathType + } + if oProtocolOspfv3ExportRules.NewTag != nil { + nestedProtocolOspfv3ExportRules.NewTag = oProtocolOspfv3ExportRules.NewTag + } + if oProtocolOspfv3ExportRules.Metric != nil { + nestedProtocolOspfv3ExportRules.Metric = oProtocolOspfv3ExportRules.Metric + } + if oProtocolOspfv3ExportRules.Name != "" { + nestedProtocolOspfv3ExportRules.Name = oProtocolOspfv3ExportRules.Name + } + nestedProtocol.Ospfv3.ExportRules = append(nestedProtocol.Ospfv3.ExportRules, nestedProtocolOspfv3ExportRules) + } + } + if o.Protocol.Ospfv3.GlobalBfd != nil { + nestedProtocol.Ospfv3.GlobalBfd = &ProtocolOspfv3GlobalBfdXml{} + if _, ok := o.Misc["ProtocolOspfv3GlobalBfd"]; ok { + nestedProtocol.Ospfv3.GlobalBfd.Misc = o.Misc["ProtocolOspfv3GlobalBfd"] + } + if o.Protocol.Ospfv3.GlobalBfd.Profile != nil { + nestedProtocol.Ospfv3.GlobalBfd.Profile = o.Protocol.Ospfv3.GlobalBfd.Profile + } + } + if o.Protocol.Ospfv3.GracefulRestart != nil { + nestedProtocol.Ospfv3.GracefulRestart = &ProtocolOspfv3GracefulRestartXml{} + if _, ok := o.Misc["ProtocolOspfv3GracefulRestart"]; ok { + nestedProtocol.Ospfv3.GracefulRestart.Misc = o.Misc["ProtocolOspfv3GracefulRestart"] + } + if o.Protocol.Ospfv3.GracefulRestart.HelperEnable != nil { + nestedProtocol.Ospfv3.GracefulRestart.HelperEnable = util.YesNo(o.Protocol.Ospfv3.GracefulRestart.HelperEnable, nil) + } + if o.Protocol.Ospfv3.GracefulRestart.MaxNeighborRestartTime != nil { + nestedProtocol.Ospfv3.GracefulRestart.MaxNeighborRestartTime = o.Protocol.Ospfv3.GracefulRestart.MaxNeighborRestartTime + } + if o.Protocol.Ospfv3.GracefulRestart.StrictLSAChecking != nil { + nestedProtocol.Ospfv3.GracefulRestart.StrictLSAChecking = util.YesNo(o.Protocol.Ospfv3.GracefulRestart.StrictLSAChecking, nil) + } + if o.Protocol.Ospfv3.GracefulRestart.Enable != nil { + nestedProtocol.Ospfv3.GracefulRestart.Enable = util.YesNo(o.Protocol.Ospfv3.GracefulRestart.Enable, nil) + } + if o.Protocol.Ospfv3.GracefulRestart.GracePeriod != nil { + nestedProtocol.Ospfv3.GracefulRestart.GracePeriod = o.Protocol.Ospfv3.GracefulRestart.GracePeriod + } + } + if o.Protocol.Ospfv3.RejectDefaultRoute != nil { + nestedProtocol.Ospfv3.RejectDefaultRoute = util.YesNo(o.Protocol.Ospfv3.RejectDefaultRoute, nil) + } + if o.Protocol.Ospfv3.Area != nil { + nestedProtocol.Ospfv3.Area = []ProtocolOspfv3AreaXml{} + for _, oProtocolOspfv3Area := range o.Protocol.Ospfv3.Area { + nestedProtocolOspfv3Area := ProtocolOspfv3AreaXml{} + if _, ok := o.Misc["ProtocolOspfv3Area"]; ok { + nestedProtocolOspfv3Area.Misc = o.Misc["ProtocolOspfv3Area"] + } + if oProtocolOspfv3Area.Authentication != nil { + nestedProtocolOspfv3Area.Authentication = oProtocolOspfv3Area.Authentication + } + if oProtocolOspfv3Area.Type != nil { + nestedProtocolOspfv3Area.Type = &ProtocolOspfv3AreaTypeXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaType"]; ok { + nestedProtocolOspfv3Area.Type.Misc = o.Misc["ProtocolOspfv3AreaType"] + } + if oProtocolOspfv3Area.Type.Nssa != nil { + nestedProtocolOspfv3Area.Type.Nssa = &ProtocolOspfv3AreaTypeNssaXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaTypeNssa"]; ok { + nestedProtocolOspfv3Area.Type.Nssa.Misc = o.Misc["ProtocolOspfv3AreaTypeNssa"] + } + if oProtocolOspfv3Area.Type.Nssa.AcceptSummary != nil { + nestedProtocolOspfv3Area.Type.Nssa.AcceptSummary = util.YesNo(oProtocolOspfv3Area.Type.Nssa.AcceptSummary, nil) + } + if oProtocolOspfv3Area.Type.Nssa.DefaultRoute != nil { + nestedProtocolOspfv3Area.Type.Nssa.DefaultRoute = &ProtocolOspfv3AreaTypeNssaDefaultRouteXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaTypeNssaDefaultRoute"]; ok { + nestedProtocolOspfv3Area.Type.Nssa.DefaultRoute.Misc = o.Misc["ProtocolOspfv3AreaTypeNssaDefaultRoute"] + } + if oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Disable != nil { + nestedProtocolOspfv3Area.Type.Nssa.DefaultRoute.Disable = &ProtocolOspfv3AreaTypeNssaDefaultRouteDisableXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaTypeNssaDefaultRouteDisable"]; ok { + nestedProtocolOspfv3Area.Type.Nssa.DefaultRoute.Disable.Misc = o.Misc["ProtocolOspfv3AreaTypeNssaDefaultRouteDisable"] + } + } + if oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise != nil { + nestedProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise = &ProtocolOspfv3AreaTypeNssaDefaultRouteAdvertiseXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaTypeNssaDefaultRouteAdvertise"]; ok { + nestedProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise.Misc = o.Misc["ProtocolOspfv3AreaTypeNssaDefaultRouteAdvertise"] + } + if oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise.Metric != nil { + nestedProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise.Metric = oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise.Metric + } + if oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise.Type != nil { + nestedProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise.Type = oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise.Type + } + } + } + if oProtocolOspfv3Area.Type.Nssa.NssaExtRange != nil { + nestedProtocolOspfv3Area.Type.Nssa.NssaExtRange = []ProtocolOspfv3AreaTypeNssaNssaExtRangeXml{} + for _, oProtocolOspfv3AreaTypeNssaNssaExtRange := range oProtocolOspfv3Area.Type.Nssa.NssaExtRange { + nestedProtocolOspfv3AreaTypeNssaNssaExtRange := ProtocolOspfv3AreaTypeNssaNssaExtRangeXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaTypeNssaNssaExtRange"]; ok { + nestedProtocolOspfv3AreaTypeNssaNssaExtRange.Misc = o.Misc["ProtocolOspfv3AreaTypeNssaNssaExtRange"] + } + if oProtocolOspfv3AreaTypeNssaNssaExtRange.Name != "" { + nestedProtocolOspfv3AreaTypeNssaNssaExtRange.Name = oProtocolOspfv3AreaTypeNssaNssaExtRange.Name + } + if oProtocolOspfv3AreaTypeNssaNssaExtRange.Advertise != nil { + nestedProtocolOspfv3AreaTypeNssaNssaExtRange.Advertise = &ProtocolOspfv3AreaTypeNssaNssaExtRangeAdvertiseXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaTypeNssaNssaExtRangeAdvertise"]; ok { + nestedProtocolOspfv3AreaTypeNssaNssaExtRange.Advertise.Misc = o.Misc["ProtocolOspfv3AreaTypeNssaNssaExtRangeAdvertise"] + } + } + if oProtocolOspfv3AreaTypeNssaNssaExtRange.Suppress != nil { + nestedProtocolOspfv3AreaTypeNssaNssaExtRange.Suppress = &ProtocolOspfv3AreaTypeNssaNssaExtRangeSuppressXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaTypeNssaNssaExtRangeSuppress"]; ok { + nestedProtocolOspfv3AreaTypeNssaNssaExtRange.Suppress.Misc = o.Misc["ProtocolOspfv3AreaTypeNssaNssaExtRangeSuppress"] + } + } + nestedProtocolOspfv3Area.Type.Nssa.NssaExtRange = append(nestedProtocolOspfv3Area.Type.Nssa.NssaExtRange, nestedProtocolOspfv3AreaTypeNssaNssaExtRange) + } + } + } + if oProtocolOspfv3Area.Type.Normal != nil { + nestedProtocolOspfv3Area.Type.Normal = &ProtocolOspfv3AreaTypeNormalXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaTypeNormal"]; ok { + nestedProtocolOspfv3Area.Type.Normal.Misc = o.Misc["ProtocolOspfv3AreaTypeNormal"] + } + } + if oProtocolOspfv3Area.Type.Stub != nil { + nestedProtocolOspfv3Area.Type.Stub = &ProtocolOspfv3AreaTypeStubXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaTypeStub"]; ok { + nestedProtocolOspfv3Area.Type.Stub.Misc = o.Misc["ProtocolOspfv3AreaTypeStub"] + } + if oProtocolOspfv3Area.Type.Stub.AcceptSummary != nil { + nestedProtocolOspfv3Area.Type.Stub.AcceptSummary = util.YesNo(oProtocolOspfv3Area.Type.Stub.AcceptSummary, nil) + } + if oProtocolOspfv3Area.Type.Stub.DefaultRoute != nil { + nestedProtocolOspfv3Area.Type.Stub.DefaultRoute = &ProtocolOspfv3AreaTypeStubDefaultRouteXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaTypeStubDefaultRoute"]; ok { + nestedProtocolOspfv3Area.Type.Stub.DefaultRoute.Misc = o.Misc["ProtocolOspfv3AreaTypeStubDefaultRoute"] + } + if oProtocolOspfv3Area.Type.Stub.DefaultRoute.Disable != nil { + nestedProtocolOspfv3Area.Type.Stub.DefaultRoute.Disable = &ProtocolOspfv3AreaTypeStubDefaultRouteDisableXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaTypeStubDefaultRouteDisable"]; ok { + nestedProtocolOspfv3Area.Type.Stub.DefaultRoute.Disable.Misc = o.Misc["ProtocolOspfv3AreaTypeStubDefaultRouteDisable"] + } + } + if oProtocolOspfv3Area.Type.Stub.DefaultRoute.Advertise != nil { + nestedProtocolOspfv3Area.Type.Stub.DefaultRoute.Advertise = &ProtocolOspfv3AreaTypeStubDefaultRouteAdvertiseXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaTypeStubDefaultRouteAdvertise"]; ok { + nestedProtocolOspfv3Area.Type.Stub.DefaultRoute.Advertise.Misc = o.Misc["ProtocolOspfv3AreaTypeStubDefaultRouteAdvertise"] + } + if oProtocolOspfv3Area.Type.Stub.DefaultRoute.Advertise.Metric != nil { + nestedProtocolOspfv3Area.Type.Stub.DefaultRoute.Advertise.Metric = oProtocolOspfv3Area.Type.Stub.DefaultRoute.Advertise.Metric + } + } + } + } + } + if oProtocolOspfv3Area.Range != nil { + nestedProtocolOspfv3Area.Range = []ProtocolOspfv3AreaRangeXml{} + for _, oProtocolOspfv3AreaRange := range oProtocolOspfv3Area.Range { + nestedProtocolOspfv3AreaRange := ProtocolOspfv3AreaRangeXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaRange"]; ok { + nestedProtocolOspfv3AreaRange.Misc = o.Misc["ProtocolOspfv3AreaRange"] + } + if oProtocolOspfv3AreaRange.Name != "" { + nestedProtocolOspfv3AreaRange.Name = oProtocolOspfv3AreaRange.Name + } + if oProtocolOspfv3AreaRange.Advertise != nil { + nestedProtocolOspfv3AreaRange.Advertise = &ProtocolOspfv3AreaRangeAdvertiseXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaRangeAdvertise"]; ok { + nestedProtocolOspfv3AreaRange.Advertise.Misc = o.Misc["ProtocolOspfv3AreaRangeAdvertise"] + } + } + if oProtocolOspfv3AreaRange.Suppress != nil { + nestedProtocolOspfv3AreaRange.Suppress = &ProtocolOspfv3AreaRangeSuppressXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaRangeSuppress"]; ok { + nestedProtocolOspfv3AreaRange.Suppress.Misc = o.Misc["ProtocolOspfv3AreaRangeSuppress"] + } + } + nestedProtocolOspfv3Area.Range = append(nestedProtocolOspfv3Area.Range, nestedProtocolOspfv3AreaRange) + } + } + if oProtocolOspfv3Area.Interface != nil { + nestedProtocolOspfv3Area.Interface = []ProtocolOspfv3AreaInterfaceXml{} + for _, oProtocolOspfv3AreaInterface := range oProtocolOspfv3Area.Interface { + nestedProtocolOspfv3AreaInterface := ProtocolOspfv3AreaInterfaceXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaInterface"]; ok { + nestedProtocolOspfv3AreaInterface.Misc = o.Misc["ProtocolOspfv3AreaInterface"] + } + if oProtocolOspfv3AreaInterface.DeadCounts != nil { + nestedProtocolOspfv3AreaInterface.DeadCounts = oProtocolOspfv3AreaInterface.DeadCounts + } + if oProtocolOspfv3AreaInterface.GrDelay != nil { + nestedProtocolOspfv3AreaInterface.GrDelay = oProtocolOspfv3AreaInterface.GrDelay + } + if oProtocolOspfv3AreaInterface.LinkType != nil { + nestedProtocolOspfv3AreaInterface.LinkType = &ProtocolOspfv3AreaInterfaceLinkTypeXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaInterfaceLinkType"]; ok { + nestedProtocolOspfv3AreaInterface.LinkType.Misc = o.Misc["ProtocolOspfv3AreaInterfaceLinkType"] + } + if oProtocolOspfv3AreaInterface.LinkType.Broadcast != nil { + nestedProtocolOspfv3AreaInterface.LinkType.Broadcast = &ProtocolOspfv3AreaInterfaceLinkTypeBroadcastXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaInterfaceLinkTypeBroadcast"]; ok { + nestedProtocolOspfv3AreaInterface.LinkType.Broadcast.Misc = o.Misc["ProtocolOspfv3AreaInterfaceLinkTypeBroadcast"] + } + } + if oProtocolOspfv3AreaInterface.LinkType.P2p != nil { + nestedProtocolOspfv3AreaInterface.LinkType.P2p = &ProtocolOspfv3AreaInterfaceLinkTypeP2pXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaInterfaceLinkTypeP2p"]; ok { + nestedProtocolOspfv3AreaInterface.LinkType.P2p.Misc = o.Misc["ProtocolOspfv3AreaInterfaceLinkTypeP2p"] + } + } + if oProtocolOspfv3AreaInterface.LinkType.P2mp != nil { + nestedProtocolOspfv3AreaInterface.LinkType.P2mp = &ProtocolOspfv3AreaInterfaceLinkTypeP2mpXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaInterfaceLinkTypeP2mp"]; ok { + nestedProtocolOspfv3AreaInterface.LinkType.P2mp.Misc = o.Misc["ProtocolOspfv3AreaInterfaceLinkTypeP2mp"] + } + } + } + if oProtocolOspfv3AreaInterface.Neighbor != nil { + nestedProtocolOspfv3AreaInterface.Neighbor = []ProtocolOspfv3AreaInterfaceNeighborXml{} + for _, oProtocolOspfv3AreaInterfaceNeighbor := range oProtocolOspfv3AreaInterface.Neighbor { + nestedProtocolOspfv3AreaInterfaceNeighbor := ProtocolOspfv3AreaInterfaceNeighborXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaInterfaceNeighbor"]; ok { + nestedProtocolOspfv3AreaInterfaceNeighbor.Misc = o.Misc["ProtocolOspfv3AreaInterfaceNeighbor"] + } + if oProtocolOspfv3AreaInterfaceNeighbor.Name != "" { + nestedProtocolOspfv3AreaInterfaceNeighbor.Name = oProtocolOspfv3AreaInterfaceNeighbor.Name + } + nestedProtocolOspfv3AreaInterface.Neighbor = append(nestedProtocolOspfv3AreaInterface.Neighbor, nestedProtocolOspfv3AreaInterfaceNeighbor) + } + } + if oProtocolOspfv3AreaInterface.Passive != nil { + nestedProtocolOspfv3AreaInterface.Passive = util.YesNo(oProtocolOspfv3AreaInterface.Passive, nil) + } + if oProtocolOspfv3AreaInterface.Priority != nil { + nestedProtocolOspfv3AreaInterface.Priority = oProtocolOspfv3AreaInterface.Priority + } + if oProtocolOspfv3AreaInterface.HelloInterval != nil { + nestedProtocolOspfv3AreaInterface.HelloInterval = oProtocolOspfv3AreaInterface.HelloInterval + } + if oProtocolOspfv3AreaInterface.Authentication != nil { + nestedProtocolOspfv3AreaInterface.Authentication = oProtocolOspfv3AreaInterface.Authentication + } + if oProtocolOspfv3AreaInterface.Bfd != nil { + nestedProtocolOspfv3AreaInterface.Bfd = &ProtocolOspfv3AreaInterfaceBfdXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaInterfaceBfd"]; ok { + nestedProtocolOspfv3AreaInterface.Bfd.Misc = o.Misc["ProtocolOspfv3AreaInterfaceBfd"] + } + if oProtocolOspfv3AreaInterface.Bfd.Profile != nil { + nestedProtocolOspfv3AreaInterface.Bfd.Profile = oProtocolOspfv3AreaInterface.Bfd.Profile + } + } + if oProtocolOspfv3AreaInterface.InstanceId != nil { + nestedProtocolOspfv3AreaInterface.InstanceId = oProtocolOspfv3AreaInterface.InstanceId + } + if oProtocolOspfv3AreaInterface.Metric != nil { + nestedProtocolOspfv3AreaInterface.Metric = oProtocolOspfv3AreaInterface.Metric + } + if oProtocolOspfv3AreaInterface.TransitDelay != nil { + nestedProtocolOspfv3AreaInterface.TransitDelay = oProtocolOspfv3AreaInterface.TransitDelay + } + if oProtocolOspfv3AreaInterface.Name != "" { + nestedProtocolOspfv3AreaInterface.Name = oProtocolOspfv3AreaInterface.Name + } + if oProtocolOspfv3AreaInterface.Enable != nil { + nestedProtocolOspfv3AreaInterface.Enable = util.YesNo(oProtocolOspfv3AreaInterface.Enable, nil) + } + if oProtocolOspfv3AreaInterface.RetransmitInterval != nil { + nestedProtocolOspfv3AreaInterface.RetransmitInterval = oProtocolOspfv3AreaInterface.RetransmitInterval + } + nestedProtocolOspfv3Area.Interface = append(nestedProtocolOspfv3Area.Interface, nestedProtocolOspfv3AreaInterface) + } + } + if oProtocolOspfv3Area.VirtualLink != nil { + nestedProtocolOspfv3Area.VirtualLink = []ProtocolOspfv3AreaVirtualLinkXml{} + for _, oProtocolOspfv3AreaVirtualLink := range oProtocolOspfv3Area.VirtualLink { + nestedProtocolOspfv3AreaVirtualLink := ProtocolOspfv3AreaVirtualLinkXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaVirtualLink"]; ok { + nestedProtocolOspfv3AreaVirtualLink.Misc = o.Misc["ProtocolOspfv3AreaVirtualLink"] + } + if oProtocolOspfv3AreaVirtualLink.Authentication != nil { + nestedProtocolOspfv3AreaVirtualLink.Authentication = oProtocolOspfv3AreaVirtualLink.Authentication + } + if oProtocolOspfv3AreaVirtualLink.Bfd != nil { + nestedProtocolOspfv3AreaVirtualLink.Bfd = &ProtocolOspfv3AreaVirtualLinkBfdXml{} + if _, ok := o.Misc["ProtocolOspfv3AreaVirtualLinkBfd"]; ok { + nestedProtocolOspfv3AreaVirtualLink.Bfd.Misc = o.Misc["ProtocolOspfv3AreaVirtualLinkBfd"] + } + if oProtocolOspfv3AreaVirtualLink.Bfd.Profile != nil { + nestedProtocolOspfv3AreaVirtualLink.Bfd.Profile = oProtocolOspfv3AreaVirtualLink.Bfd.Profile + } + } + if oProtocolOspfv3AreaVirtualLink.Name != "" { + nestedProtocolOspfv3AreaVirtualLink.Name = oProtocolOspfv3AreaVirtualLink.Name + } + if oProtocolOspfv3AreaVirtualLink.NeighborId != nil { + nestedProtocolOspfv3AreaVirtualLink.NeighborId = oProtocolOspfv3AreaVirtualLink.NeighborId + } + if oProtocolOspfv3AreaVirtualLink.InstanceId != nil { + nestedProtocolOspfv3AreaVirtualLink.InstanceId = oProtocolOspfv3AreaVirtualLink.InstanceId + } + if oProtocolOspfv3AreaVirtualLink.HelloInterval != nil { + nestedProtocolOspfv3AreaVirtualLink.HelloInterval = oProtocolOspfv3AreaVirtualLink.HelloInterval + } + if oProtocolOspfv3AreaVirtualLink.DeadCounts != nil { + nestedProtocolOspfv3AreaVirtualLink.DeadCounts = oProtocolOspfv3AreaVirtualLink.DeadCounts + } + if oProtocolOspfv3AreaVirtualLink.RetransmitInterval != nil { + nestedProtocolOspfv3AreaVirtualLink.RetransmitInterval = oProtocolOspfv3AreaVirtualLink.RetransmitInterval + } + if oProtocolOspfv3AreaVirtualLink.TransitAreaId != nil { + nestedProtocolOspfv3AreaVirtualLink.TransitAreaId = oProtocolOspfv3AreaVirtualLink.TransitAreaId + } + if oProtocolOspfv3AreaVirtualLink.Enable != nil { + nestedProtocolOspfv3AreaVirtualLink.Enable = util.YesNo(oProtocolOspfv3AreaVirtualLink.Enable, nil) + } + if oProtocolOspfv3AreaVirtualLink.TransitDelay != nil { + nestedProtocolOspfv3AreaVirtualLink.TransitDelay = oProtocolOspfv3AreaVirtualLink.TransitDelay + } + nestedProtocolOspfv3Area.VirtualLink = append(nestedProtocolOspfv3Area.VirtualLink, nestedProtocolOspfv3AreaVirtualLink) + } + } + if oProtocolOspfv3Area.Name != "" { + nestedProtocolOspfv3Area.Name = oProtocolOspfv3Area.Name + } + nestedProtocol.Ospfv3.Area = append(nestedProtocol.Ospfv3.Area, nestedProtocolOspfv3Area) + } + } + } + if o.Protocol.RedistProfile != nil { + nestedProtocol.RedistProfile = []ProtocolRedistProfileXml{} + for _, oProtocolRedistProfile := range o.Protocol.RedistProfile { + nestedProtocolRedistProfile := ProtocolRedistProfileXml{} + if _, ok := o.Misc["ProtocolRedistProfile"]; ok { + nestedProtocolRedistProfile.Misc = o.Misc["ProtocolRedistProfile"] + } + if oProtocolRedistProfile.Priority != nil { + nestedProtocolRedistProfile.Priority = oProtocolRedistProfile.Priority + } + if oProtocolRedistProfile.Filter != nil { + nestedProtocolRedistProfile.Filter = &ProtocolRedistProfileFilterXml{} + if _, ok := o.Misc["ProtocolRedistProfileFilter"]; ok { + nestedProtocolRedistProfile.Filter.Misc = o.Misc["ProtocolRedistProfileFilter"] + } + if oProtocolRedistProfile.Filter.Interface != nil { + nestedProtocolRedistProfile.Filter.Interface = util.StrToMem(oProtocolRedistProfile.Filter.Interface) + } + if oProtocolRedistProfile.Filter.Destination != nil { + nestedProtocolRedistProfile.Filter.Destination = util.StrToMem(oProtocolRedistProfile.Filter.Destination) + } + if oProtocolRedistProfile.Filter.Nexthop != nil { + nestedProtocolRedistProfile.Filter.Nexthop = util.StrToMem(oProtocolRedistProfile.Filter.Nexthop) + } + if oProtocolRedistProfile.Filter.Ospf != nil { + nestedProtocolRedistProfile.Filter.Ospf = &ProtocolRedistProfileFilterOspfXml{} + if _, ok := o.Misc["ProtocolRedistProfileFilterOspf"]; ok { + nestedProtocolRedistProfile.Filter.Ospf.Misc = o.Misc["ProtocolRedistProfileFilterOspf"] + } + if oProtocolRedistProfile.Filter.Ospf.PathType != nil { + nestedProtocolRedistProfile.Filter.Ospf.PathType = util.StrToMem(oProtocolRedistProfile.Filter.Ospf.PathType) + } + if oProtocolRedistProfile.Filter.Ospf.Area != nil { + nestedProtocolRedistProfile.Filter.Ospf.Area = util.StrToMem(oProtocolRedistProfile.Filter.Ospf.Area) + } + if oProtocolRedistProfile.Filter.Ospf.Tag != nil { + nestedProtocolRedistProfile.Filter.Ospf.Tag = util.StrToMem(oProtocolRedistProfile.Filter.Ospf.Tag) + } + } + if oProtocolRedistProfile.Filter.Bgp != nil { + nestedProtocolRedistProfile.Filter.Bgp = &ProtocolRedistProfileFilterBgpXml{} + if _, ok := o.Misc["ProtocolRedistProfileFilterBgp"]; ok { + nestedProtocolRedistProfile.Filter.Bgp.Misc = o.Misc["ProtocolRedistProfileFilterBgp"] + } + if oProtocolRedistProfile.Filter.Bgp.Community != nil { + nestedProtocolRedistProfile.Filter.Bgp.Community = util.StrToMem(oProtocolRedistProfile.Filter.Bgp.Community) + } + if oProtocolRedistProfile.Filter.Bgp.ExtendedCommunity != nil { + nestedProtocolRedistProfile.Filter.Bgp.ExtendedCommunity = util.StrToMem(oProtocolRedistProfile.Filter.Bgp.ExtendedCommunity) + } + } + if oProtocolRedistProfile.Filter.Type != nil { + nestedProtocolRedistProfile.Filter.Type = util.StrToMem(oProtocolRedistProfile.Filter.Type) + } + } + if oProtocolRedistProfile.Action != nil { + nestedProtocolRedistProfile.Action = &ProtocolRedistProfileActionXml{} + if _, ok := o.Misc["ProtocolRedistProfileAction"]; ok { + nestedProtocolRedistProfile.Action.Misc = o.Misc["ProtocolRedistProfileAction"] + } + if oProtocolRedistProfile.Action.NoRedist != nil { + nestedProtocolRedistProfile.Action.NoRedist = &ProtocolRedistProfileActionNoRedistXml{} + if _, ok := o.Misc["ProtocolRedistProfileActionNoRedist"]; ok { + nestedProtocolRedistProfile.Action.NoRedist.Misc = o.Misc["ProtocolRedistProfileActionNoRedist"] + } + } + if oProtocolRedistProfile.Action.Redist != nil { + nestedProtocolRedistProfile.Action.Redist = &ProtocolRedistProfileActionRedistXml{} + if _, ok := o.Misc["ProtocolRedistProfileActionRedist"]; ok { + nestedProtocolRedistProfile.Action.Redist.Misc = o.Misc["ProtocolRedistProfileActionRedist"] + } + } + } + if oProtocolRedistProfile.Name != "" { + nestedProtocolRedistProfile.Name = oProtocolRedistProfile.Name + } + nestedProtocol.RedistProfile = append(nestedProtocol.RedistProfile, nestedProtocolRedistProfile) + } + } + if o.Protocol.RedistProfileIpv6 != nil { + nestedProtocol.RedistProfileIpv6 = []ProtocolRedistProfileIpv6Xml{} + for _, oProtocolRedistProfileIpv6 := range o.Protocol.RedistProfileIpv6 { + nestedProtocolRedistProfileIpv6 := ProtocolRedistProfileIpv6Xml{} + if _, ok := o.Misc["ProtocolRedistProfileIpv6"]; ok { + nestedProtocolRedistProfileIpv6.Misc = o.Misc["ProtocolRedistProfileIpv6"] + } + if oProtocolRedistProfileIpv6.Priority != nil { + nestedProtocolRedistProfileIpv6.Priority = oProtocolRedistProfileIpv6.Priority + } + if oProtocolRedistProfileIpv6.Filter != nil { + nestedProtocolRedistProfileIpv6.Filter = &ProtocolRedistProfileIpv6FilterXml{} + if _, ok := o.Misc["ProtocolRedistProfileIpv6Filter"]; ok { + nestedProtocolRedistProfileIpv6.Filter.Misc = o.Misc["ProtocolRedistProfileIpv6Filter"] + } + if oProtocolRedistProfileIpv6.Filter.Interface != nil { + nestedProtocolRedistProfileIpv6.Filter.Interface = util.StrToMem(oProtocolRedistProfileIpv6.Filter.Interface) + } + if oProtocolRedistProfileIpv6.Filter.Destination != nil { + nestedProtocolRedistProfileIpv6.Filter.Destination = util.StrToMem(oProtocolRedistProfileIpv6.Filter.Destination) + } + if oProtocolRedistProfileIpv6.Filter.Nexthop != nil { + nestedProtocolRedistProfileIpv6.Filter.Nexthop = util.StrToMem(oProtocolRedistProfileIpv6.Filter.Nexthop) + } + if oProtocolRedistProfileIpv6.Filter.Ospfv3 != nil { + nestedProtocolRedistProfileIpv6.Filter.Ospfv3 = &ProtocolRedistProfileIpv6FilterOspfv3Xml{} + if _, ok := o.Misc["ProtocolRedistProfileIpv6FilterOspfv3"]; ok { + nestedProtocolRedistProfileIpv6.Filter.Ospfv3.Misc = o.Misc["ProtocolRedistProfileIpv6FilterOspfv3"] + } + if oProtocolRedistProfileIpv6.Filter.Ospfv3.PathType != nil { + nestedProtocolRedistProfileIpv6.Filter.Ospfv3.PathType = util.StrToMem(oProtocolRedistProfileIpv6.Filter.Ospfv3.PathType) + } + if oProtocolRedistProfileIpv6.Filter.Ospfv3.Area != nil { + nestedProtocolRedistProfileIpv6.Filter.Ospfv3.Area = util.StrToMem(oProtocolRedistProfileIpv6.Filter.Ospfv3.Area) + } + if oProtocolRedistProfileIpv6.Filter.Ospfv3.Tag != nil { + nestedProtocolRedistProfileIpv6.Filter.Ospfv3.Tag = util.StrToMem(oProtocolRedistProfileIpv6.Filter.Ospfv3.Tag) + } + } + if oProtocolRedistProfileIpv6.Filter.Bgp != nil { + nestedProtocolRedistProfileIpv6.Filter.Bgp = &ProtocolRedistProfileIpv6FilterBgpXml{} + if _, ok := o.Misc["ProtocolRedistProfileIpv6FilterBgp"]; ok { + nestedProtocolRedistProfileIpv6.Filter.Bgp.Misc = o.Misc["ProtocolRedistProfileIpv6FilterBgp"] + } + if oProtocolRedistProfileIpv6.Filter.Bgp.Community != nil { + nestedProtocolRedistProfileIpv6.Filter.Bgp.Community = util.StrToMem(oProtocolRedistProfileIpv6.Filter.Bgp.Community) + } + if oProtocolRedistProfileIpv6.Filter.Bgp.ExtendedCommunity != nil { + nestedProtocolRedistProfileIpv6.Filter.Bgp.ExtendedCommunity = util.StrToMem(oProtocolRedistProfileIpv6.Filter.Bgp.ExtendedCommunity) + } + } + if oProtocolRedistProfileIpv6.Filter.Type != nil { + nestedProtocolRedistProfileIpv6.Filter.Type = util.StrToMem(oProtocolRedistProfileIpv6.Filter.Type) + } + } + if oProtocolRedistProfileIpv6.Action != nil { + nestedProtocolRedistProfileIpv6.Action = &ProtocolRedistProfileIpv6ActionXml{} + if _, ok := o.Misc["ProtocolRedistProfileIpv6Action"]; ok { + nestedProtocolRedistProfileIpv6.Action.Misc = o.Misc["ProtocolRedistProfileIpv6Action"] + } + if oProtocolRedistProfileIpv6.Action.NoRedist != nil { + nestedProtocolRedistProfileIpv6.Action.NoRedist = &ProtocolRedistProfileIpv6ActionNoRedistXml{} + if _, ok := o.Misc["ProtocolRedistProfileIpv6ActionNoRedist"]; ok { + nestedProtocolRedistProfileIpv6.Action.NoRedist.Misc = o.Misc["ProtocolRedistProfileIpv6ActionNoRedist"] + } + } + if oProtocolRedistProfileIpv6.Action.Redist != nil { + nestedProtocolRedistProfileIpv6.Action.Redist = &ProtocolRedistProfileIpv6ActionRedistXml{} + if _, ok := o.Misc["ProtocolRedistProfileIpv6ActionRedist"]; ok { + nestedProtocolRedistProfileIpv6.Action.Redist.Misc = o.Misc["ProtocolRedistProfileIpv6ActionRedist"] + } + } + } + if oProtocolRedistProfileIpv6.Name != "" { + nestedProtocolRedistProfileIpv6.Name = oProtocolRedistProfileIpv6.Name + } + nestedProtocol.RedistProfileIpv6 = append(nestedProtocol.RedistProfileIpv6, nestedProtocolRedistProfileIpv6) + } + } + if o.Protocol.Rip != nil { + nestedProtocol.Rip = &ProtocolRipXml{} + if _, ok := o.Misc["ProtocolRip"]; ok { + nestedProtocol.Rip.Misc = o.Misc["ProtocolRip"] + } + if o.Protocol.Rip.AllowRedistDefaultRoute != nil { + nestedProtocol.Rip.AllowRedistDefaultRoute = util.YesNo(o.Protocol.Rip.AllowRedistDefaultRoute, nil) + } + if o.Protocol.Rip.AuthProfile != nil { + nestedProtocol.Rip.AuthProfile = []ProtocolRipAuthProfileXml{} + for _, oProtocolRipAuthProfile := range o.Protocol.Rip.AuthProfile { + nestedProtocolRipAuthProfile := ProtocolRipAuthProfileXml{} + if _, ok := o.Misc["ProtocolRipAuthProfile"]; ok { + nestedProtocolRipAuthProfile.Misc = o.Misc["ProtocolRipAuthProfile"] + } + if oProtocolRipAuthProfile.Name != "" { + nestedProtocolRipAuthProfile.Name = oProtocolRipAuthProfile.Name + } + if oProtocolRipAuthProfile.Password != nil { + nestedProtocolRipAuthProfile.Password = oProtocolRipAuthProfile.Password + } + if oProtocolRipAuthProfile.Md5 != nil { + nestedProtocolRipAuthProfile.Md5 = []ProtocolRipAuthProfileMd5Xml{} + for _, oProtocolRipAuthProfileMd5 := range oProtocolRipAuthProfile.Md5 { + nestedProtocolRipAuthProfileMd5 := ProtocolRipAuthProfileMd5Xml{} + if _, ok := o.Misc["ProtocolRipAuthProfileMd5"]; ok { + nestedProtocolRipAuthProfileMd5.Misc = o.Misc["ProtocolRipAuthProfileMd5"] + } + if oProtocolRipAuthProfileMd5.Key != nil { + nestedProtocolRipAuthProfileMd5.Key = oProtocolRipAuthProfileMd5.Key + } + if oProtocolRipAuthProfileMd5.Preferred != nil { + nestedProtocolRipAuthProfileMd5.Preferred = util.YesNo(oProtocolRipAuthProfileMd5.Preferred, nil) + } + if oProtocolRipAuthProfileMd5.Name != "" { + nestedProtocolRipAuthProfileMd5.Name = oProtocolRipAuthProfileMd5.Name + } + nestedProtocolRipAuthProfile.Md5 = append(nestedProtocolRipAuthProfile.Md5, nestedProtocolRipAuthProfileMd5) + } + } + nestedProtocol.Rip.AuthProfile = append(nestedProtocol.Rip.AuthProfile, nestedProtocolRipAuthProfile) + } + } + if o.Protocol.Rip.Enable != nil { + nestedProtocol.Rip.Enable = util.YesNo(o.Protocol.Rip.Enable, nil) + } + if o.Protocol.Rip.ExportRules != nil { + nestedProtocol.Rip.ExportRules = []ProtocolRipExportRulesXml{} + for _, oProtocolRipExportRules := range o.Protocol.Rip.ExportRules { + nestedProtocolRipExportRules := ProtocolRipExportRulesXml{} + if _, ok := o.Misc["ProtocolRipExportRules"]; ok { + nestedProtocolRipExportRules.Misc = o.Misc["ProtocolRipExportRules"] + } + if oProtocolRipExportRules.Metric != nil { + nestedProtocolRipExportRules.Metric = oProtocolRipExportRules.Metric + } + if oProtocolRipExportRules.Name != "" { + nestedProtocolRipExportRules.Name = oProtocolRipExportRules.Name + } + nestedProtocol.Rip.ExportRules = append(nestedProtocol.Rip.ExportRules, nestedProtocolRipExportRules) + } + } + if o.Protocol.Rip.GlobalBfd != nil { + nestedProtocol.Rip.GlobalBfd = &ProtocolRipGlobalBfdXml{} + if _, ok := o.Misc["ProtocolRipGlobalBfd"]; ok { + nestedProtocol.Rip.GlobalBfd.Misc = o.Misc["ProtocolRipGlobalBfd"] + } + if o.Protocol.Rip.GlobalBfd.Profile != nil { + nestedProtocol.Rip.GlobalBfd.Profile = o.Protocol.Rip.GlobalBfd.Profile + } + } + if o.Protocol.Rip.Interface != nil { + nestedProtocol.Rip.Interface = []ProtocolRipInterfaceXml{} + for _, oProtocolRipInterface := range o.Protocol.Rip.Interface { + nestedProtocolRipInterface := ProtocolRipInterfaceXml{} + if _, ok := o.Misc["ProtocolRipInterface"]; ok { + nestedProtocolRipInterface.Misc = o.Misc["ProtocolRipInterface"] + } + if oProtocolRipInterface.Enable != nil { + nestedProtocolRipInterface.Enable = util.YesNo(oProtocolRipInterface.Enable, nil) + } + if oProtocolRipInterface.Authentication != nil { + nestedProtocolRipInterface.Authentication = oProtocolRipInterface.Authentication + } + if oProtocolRipInterface.Mode != nil { + nestedProtocolRipInterface.Mode = oProtocolRipInterface.Mode + } + if oProtocolRipInterface.DefaultRoute != nil { + nestedProtocolRipInterface.DefaultRoute = &ProtocolRipInterfaceDefaultRouteXml{} + if _, ok := o.Misc["ProtocolRipInterfaceDefaultRoute"]; ok { + nestedProtocolRipInterface.DefaultRoute.Misc = o.Misc["ProtocolRipInterfaceDefaultRoute"] + } + if oProtocolRipInterface.DefaultRoute.Advertise != nil { + nestedProtocolRipInterface.DefaultRoute.Advertise = &ProtocolRipInterfaceDefaultRouteAdvertiseXml{} + if _, ok := o.Misc["ProtocolRipInterfaceDefaultRouteAdvertise"]; ok { + nestedProtocolRipInterface.DefaultRoute.Advertise.Misc = o.Misc["ProtocolRipInterfaceDefaultRouteAdvertise"] + } + if oProtocolRipInterface.DefaultRoute.Advertise.Metric != nil { + nestedProtocolRipInterface.DefaultRoute.Advertise.Metric = oProtocolRipInterface.DefaultRoute.Advertise.Metric + } + } + if oProtocolRipInterface.DefaultRoute.Disable != nil { + nestedProtocolRipInterface.DefaultRoute.Disable = &ProtocolRipInterfaceDefaultRouteDisableXml{} + if _, ok := o.Misc["ProtocolRipInterfaceDefaultRouteDisable"]; ok { + nestedProtocolRipInterface.DefaultRoute.Disable.Misc = o.Misc["ProtocolRipInterfaceDefaultRouteDisable"] + } + } + } + if oProtocolRipInterface.Bfd != nil { + nestedProtocolRipInterface.Bfd = &ProtocolRipInterfaceBfdXml{} + if _, ok := o.Misc["ProtocolRipInterfaceBfd"]; ok { + nestedProtocolRipInterface.Bfd.Misc = o.Misc["ProtocolRipInterfaceBfd"] + } + if oProtocolRipInterface.Bfd.Profile != nil { + nestedProtocolRipInterface.Bfd.Profile = oProtocolRipInterface.Bfd.Profile + } + } + if oProtocolRipInterface.Name != "" { + nestedProtocolRipInterface.Name = oProtocolRipInterface.Name + } + nestedProtocol.Rip.Interface = append(nestedProtocol.Rip.Interface, nestedProtocolRipInterface) + } + } + if o.Protocol.Rip.RejectDefaultRoute != nil { + nestedProtocol.Rip.RejectDefaultRoute = util.YesNo(o.Protocol.Rip.RejectDefaultRoute, nil) + } + if o.Protocol.Rip.Timers != nil { + nestedProtocol.Rip.Timers = &ProtocolRipTimersXml{} + if _, ok := o.Misc["ProtocolRipTimers"]; ok { + nestedProtocol.Rip.Timers.Misc = o.Misc["ProtocolRipTimers"] + } + if o.Protocol.Rip.Timers.IntervalSeconds != nil { + nestedProtocol.Rip.Timers.IntervalSeconds = o.Protocol.Rip.Timers.IntervalSeconds + } + if o.Protocol.Rip.Timers.UpdateIntervals != nil { + nestedProtocol.Rip.Timers.UpdateIntervals = o.Protocol.Rip.Timers.UpdateIntervals + } + if o.Protocol.Rip.Timers.DeleteIntervals != nil { + nestedProtocol.Rip.Timers.DeleteIntervals = o.Protocol.Rip.Timers.DeleteIntervals + } + if o.Protocol.Rip.Timers.ExpireIntervals != nil { + nestedProtocol.Rip.Timers.ExpireIntervals = o.Protocol.Rip.Timers.ExpireIntervals + } + } + } + } + entry.Protocol = nestedProtocol + + var nestedRoutingTable *RoutingTableXml + if o.RoutingTable != nil { + nestedRoutingTable = &RoutingTableXml{} + if _, ok := o.Misc["RoutingTable"]; ok { + nestedRoutingTable.Misc = o.Misc["RoutingTable"] + } + if o.RoutingTable.Ipv6 != nil { + nestedRoutingTable.Ipv6 = &RoutingTableIpv6Xml{} + if _, ok := o.Misc["RoutingTableIpv6"]; ok { + nestedRoutingTable.Ipv6.Misc = o.Misc["RoutingTableIpv6"] + } + if o.RoutingTable.Ipv6.StaticRoute != nil { + nestedRoutingTable.Ipv6.StaticRoute = []RoutingTableIpv6StaticRouteXml{} + for _, oRoutingTableIpv6StaticRoute := range o.RoutingTable.Ipv6.StaticRoute { + nestedRoutingTableIpv6StaticRoute := RoutingTableIpv6StaticRouteXml{} + if _, ok := o.Misc["RoutingTableIpv6StaticRoute"]; ok { + nestedRoutingTableIpv6StaticRoute.Misc = o.Misc["RoutingTableIpv6StaticRoute"] + } + if oRoutingTableIpv6StaticRoute.Interface != nil { + nestedRoutingTableIpv6StaticRoute.Interface = oRoutingTableIpv6StaticRoute.Interface + } + if oRoutingTableIpv6StaticRoute.AdminDist != nil { + nestedRoutingTableIpv6StaticRoute.AdminDist = oRoutingTableIpv6StaticRoute.AdminDist + } + if oRoutingTableIpv6StaticRoute.Option != nil { + nestedRoutingTableIpv6StaticRoute.Option = &RoutingTableIpv6StaticRouteOptionXml{} + if _, ok := o.Misc["RoutingTableIpv6StaticRouteOption"]; ok { + nestedRoutingTableIpv6StaticRoute.Option.Misc = o.Misc["RoutingTableIpv6StaticRouteOption"] + } + } + if oRoutingTableIpv6StaticRoute.RouteTable != nil { + nestedRoutingTableIpv6StaticRoute.RouteTable = &RoutingTableIpv6StaticRouteRouteTableXml{} + if _, ok := o.Misc["RoutingTableIpv6StaticRouteRouteTable"]; ok { + nestedRoutingTableIpv6StaticRoute.RouteTable.Misc = o.Misc["RoutingTableIpv6StaticRouteRouteTable"] + } + if oRoutingTableIpv6StaticRoute.RouteTable.NoInstall != nil { + nestedRoutingTableIpv6StaticRoute.RouteTable.NoInstall = &RoutingTableIpv6StaticRouteRouteTableNoInstallXml{} + if _, ok := o.Misc["RoutingTableIpv6StaticRouteRouteTableNoInstall"]; ok { + nestedRoutingTableIpv6StaticRoute.RouteTable.NoInstall.Misc = o.Misc["RoutingTableIpv6StaticRouteRouteTableNoInstall"] + } + } + if oRoutingTableIpv6StaticRoute.RouteTable.Unicast != nil { + nestedRoutingTableIpv6StaticRoute.RouteTable.Unicast = &RoutingTableIpv6StaticRouteRouteTableUnicastXml{} + if _, ok := o.Misc["RoutingTableIpv6StaticRouteRouteTableUnicast"]; ok { + nestedRoutingTableIpv6StaticRoute.RouteTable.Unicast.Misc = o.Misc["RoutingTableIpv6StaticRouteRouteTableUnicast"] + } + } + } + if oRoutingTableIpv6StaticRoute.Bfd != nil { + nestedRoutingTableIpv6StaticRoute.Bfd = &RoutingTableIpv6StaticRouteBfdXml{} + if _, ok := o.Misc["RoutingTableIpv6StaticRouteBfd"]; ok { + nestedRoutingTableIpv6StaticRoute.Bfd.Misc = o.Misc["RoutingTableIpv6StaticRouteBfd"] + } + if oRoutingTableIpv6StaticRoute.Bfd.Profile != nil { + nestedRoutingTableIpv6StaticRoute.Bfd.Profile = oRoutingTableIpv6StaticRoute.Bfd.Profile + } + } + if oRoutingTableIpv6StaticRoute.PathMonitor != nil { + nestedRoutingTableIpv6StaticRoute.PathMonitor = &RoutingTableIpv6StaticRoutePathMonitorXml{} + if _, ok := o.Misc["RoutingTableIpv6StaticRoutePathMonitor"]; ok { + nestedRoutingTableIpv6StaticRoute.PathMonitor.Misc = o.Misc["RoutingTableIpv6StaticRoutePathMonitor"] + } + if oRoutingTableIpv6StaticRoute.PathMonitor.HoldTime != nil { + nestedRoutingTableIpv6StaticRoute.PathMonitor.HoldTime = oRoutingTableIpv6StaticRoute.PathMonitor.HoldTime + } + if oRoutingTableIpv6StaticRoute.PathMonitor.MonitorDestinations != nil { + nestedRoutingTableIpv6StaticRoute.PathMonitor.MonitorDestinations = []RoutingTableIpv6StaticRoutePathMonitorMonitorDestinationsXml{} + for _, oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations := range oRoutingTableIpv6StaticRoute.PathMonitor.MonitorDestinations { + nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations := RoutingTableIpv6StaticRoutePathMonitorMonitorDestinationsXml{} + if _, ok := o.Misc["RoutingTableIpv6StaticRoutePathMonitorMonitorDestinations"]; ok { + nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Misc = o.Misc["RoutingTableIpv6StaticRoutePathMonitorMonitorDestinations"] + } + if oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Count != nil { + nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Count = oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Count + } + if oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Name != "" { + nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Name = oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Name + } + if oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Enable != nil { + nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Enable = util.YesNo(oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Enable, nil) + } + if oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Source != nil { + nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Source = oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Source + } + if oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Destination != nil { + nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Destination = oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Destination + } + if oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Interval != nil { + nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Interval = oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Interval + } + nestedRoutingTableIpv6StaticRoute.PathMonitor.MonitorDestinations = append(nestedRoutingTableIpv6StaticRoute.PathMonitor.MonitorDestinations, nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations) + } + } + if oRoutingTableIpv6StaticRoute.PathMonitor.Enable != nil { + nestedRoutingTableIpv6StaticRoute.PathMonitor.Enable = util.YesNo(oRoutingTableIpv6StaticRoute.PathMonitor.Enable, nil) + } + if oRoutingTableIpv6StaticRoute.PathMonitor.FailureCondition != nil { + nestedRoutingTableIpv6StaticRoute.PathMonitor.FailureCondition = oRoutingTableIpv6StaticRoute.PathMonitor.FailureCondition + } + } + if oRoutingTableIpv6StaticRoute.Name != "" { + nestedRoutingTableIpv6StaticRoute.Name = oRoutingTableIpv6StaticRoute.Name + } + if oRoutingTableIpv6StaticRoute.Destination != nil { + nestedRoutingTableIpv6StaticRoute.Destination = oRoutingTableIpv6StaticRoute.Destination + } + if oRoutingTableIpv6StaticRoute.Metric != nil { + nestedRoutingTableIpv6StaticRoute.Metric = oRoutingTableIpv6StaticRoute.Metric + } + if oRoutingTableIpv6StaticRoute.Nexthop != nil { + nestedRoutingTableIpv6StaticRoute.Nexthop = &RoutingTableIpv6StaticRouteNexthopXml{} + if _, ok := o.Misc["RoutingTableIpv6StaticRouteNexthop"]; ok { + nestedRoutingTableIpv6StaticRoute.Nexthop.Misc = o.Misc["RoutingTableIpv6StaticRouteNexthop"] + } + if oRoutingTableIpv6StaticRoute.Nexthop.Discard != nil { + nestedRoutingTableIpv6StaticRoute.Nexthop.Discard = &RoutingTableIpv6StaticRouteNexthopDiscardXml{} + if _, ok := o.Misc["RoutingTableIpv6StaticRouteNexthopDiscard"]; ok { + nestedRoutingTableIpv6StaticRoute.Nexthop.Discard.Misc = o.Misc["RoutingTableIpv6StaticRouteNexthopDiscard"] + } + } + if oRoutingTableIpv6StaticRoute.Nexthop.Ipv6Address != nil { + nestedRoutingTableIpv6StaticRoute.Nexthop.Ipv6Address = oRoutingTableIpv6StaticRoute.Nexthop.Ipv6Address + } + if oRoutingTableIpv6StaticRoute.Nexthop.NextVr != nil { + nestedRoutingTableIpv6StaticRoute.Nexthop.NextVr = oRoutingTableIpv6StaticRoute.Nexthop.NextVr + } + if oRoutingTableIpv6StaticRoute.Nexthop.Receive != nil { + nestedRoutingTableIpv6StaticRoute.Nexthop.Receive = &RoutingTableIpv6StaticRouteNexthopReceiveXml{} + if _, ok := o.Misc["RoutingTableIpv6StaticRouteNexthopReceive"]; ok { + nestedRoutingTableIpv6StaticRoute.Nexthop.Receive.Misc = o.Misc["RoutingTableIpv6StaticRouteNexthopReceive"] + } + } + } + nestedRoutingTable.Ipv6.StaticRoute = append(nestedRoutingTable.Ipv6.StaticRoute, nestedRoutingTableIpv6StaticRoute) + } + } + } + if o.RoutingTable.Ip != nil { + nestedRoutingTable.Ip = &RoutingTableIpXml{} + if _, ok := o.Misc["RoutingTableIp"]; ok { + nestedRoutingTable.Ip.Misc = o.Misc["RoutingTableIp"] + } + if o.RoutingTable.Ip.StaticRoute != nil { + nestedRoutingTable.Ip.StaticRoute = []RoutingTableIpStaticRouteXml{} + for _, oRoutingTableIpStaticRoute := range o.RoutingTable.Ip.StaticRoute { + nestedRoutingTableIpStaticRoute := RoutingTableIpStaticRouteXml{} + if _, ok := o.Misc["RoutingTableIpStaticRoute"]; ok { + nestedRoutingTableIpStaticRoute.Misc = o.Misc["RoutingTableIpStaticRoute"] + } + if oRoutingTableIpStaticRoute.Destination != nil { + nestedRoutingTableIpStaticRoute.Destination = oRoutingTableIpStaticRoute.Destination + } + if oRoutingTableIpStaticRoute.Interface != nil { + nestedRoutingTableIpStaticRoute.Interface = oRoutingTableIpStaticRoute.Interface + } + if oRoutingTableIpStaticRoute.AdminDist != nil { + nestedRoutingTableIpStaticRoute.AdminDist = oRoutingTableIpStaticRoute.AdminDist + } + if oRoutingTableIpStaticRoute.RouteTable != nil { + nestedRoutingTableIpStaticRoute.RouteTable = &RoutingTableIpStaticRouteRouteTableXml{} + if _, ok := o.Misc["RoutingTableIpStaticRouteRouteTable"]; ok { + nestedRoutingTableIpStaticRoute.RouteTable.Misc = o.Misc["RoutingTableIpStaticRouteRouteTable"] + } + if oRoutingTableIpStaticRoute.RouteTable.Unicast != nil { + nestedRoutingTableIpStaticRoute.RouteTable.Unicast = &RoutingTableIpStaticRouteRouteTableUnicastXml{} + if _, ok := o.Misc["RoutingTableIpStaticRouteRouteTableUnicast"]; ok { + nestedRoutingTableIpStaticRoute.RouteTable.Unicast.Misc = o.Misc["RoutingTableIpStaticRouteRouteTableUnicast"] + } + } + if oRoutingTableIpStaticRoute.RouteTable.Multicast != nil { + nestedRoutingTableIpStaticRoute.RouteTable.Multicast = &RoutingTableIpStaticRouteRouteTableMulticastXml{} + if _, ok := o.Misc["RoutingTableIpStaticRouteRouteTableMulticast"]; ok { + nestedRoutingTableIpStaticRoute.RouteTable.Multicast.Misc = o.Misc["RoutingTableIpStaticRouteRouteTableMulticast"] + } + } + if oRoutingTableIpStaticRoute.RouteTable.Both != nil { + nestedRoutingTableIpStaticRoute.RouteTable.Both = &RoutingTableIpStaticRouteRouteTableBothXml{} + if _, ok := o.Misc["RoutingTableIpStaticRouteRouteTableBoth"]; ok { + nestedRoutingTableIpStaticRoute.RouteTable.Both.Misc = o.Misc["RoutingTableIpStaticRouteRouteTableBoth"] + } + } + if oRoutingTableIpStaticRoute.RouteTable.NoInstall != nil { + nestedRoutingTableIpStaticRoute.RouteTable.NoInstall = &RoutingTableIpStaticRouteRouteTableNoInstallXml{} + if _, ok := o.Misc["RoutingTableIpStaticRouteRouteTableNoInstall"]; ok { + nestedRoutingTableIpStaticRoute.RouteTable.NoInstall.Misc = o.Misc["RoutingTableIpStaticRouteRouteTableNoInstall"] + } + } + } + if oRoutingTableIpStaticRoute.Bfd != nil { + nestedRoutingTableIpStaticRoute.Bfd = &RoutingTableIpStaticRouteBfdXml{} + if _, ok := o.Misc["RoutingTableIpStaticRouteBfd"]; ok { + nestedRoutingTableIpStaticRoute.Bfd.Misc = o.Misc["RoutingTableIpStaticRouteBfd"] + } + if oRoutingTableIpStaticRoute.Bfd.Profile != nil { + nestedRoutingTableIpStaticRoute.Bfd.Profile = oRoutingTableIpStaticRoute.Bfd.Profile + } + } + if oRoutingTableIpStaticRoute.Name != "" { + nestedRoutingTableIpStaticRoute.Name = oRoutingTableIpStaticRoute.Name + } + if oRoutingTableIpStaticRoute.Metric != nil { + nestedRoutingTableIpStaticRoute.Metric = oRoutingTableIpStaticRoute.Metric + } + if oRoutingTableIpStaticRoute.Nexthop != nil { + nestedRoutingTableIpStaticRoute.Nexthop = &RoutingTableIpStaticRouteNexthopXml{} + if _, ok := o.Misc["RoutingTableIpStaticRouteNexthop"]; ok { + nestedRoutingTableIpStaticRoute.Nexthop.Misc = o.Misc["RoutingTableIpStaticRouteNexthop"] + } + if oRoutingTableIpStaticRoute.Nexthop.Receive != nil { + nestedRoutingTableIpStaticRoute.Nexthop.Receive = &RoutingTableIpStaticRouteNexthopReceiveXml{} + if _, ok := o.Misc["RoutingTableIpStaticRouteNexthopReceive"]; ok { + nestedRoutingTableIpStaticRoute.Nexthop.Receive.Misc = o.Misc["RoutingTableIpStaticRouteNexthopReceive"] + } + } + if oRoutingTableIpStaticRoute.Nexthop.Discard != nil { + nestedRoutingTableIpStaticRoute.Nexthop.Discard = &RoutingTableIpStaticRouteNexthopDiscardXml{} + if _, ok := o.Misc["RoutingTableIpStaticRouteNexthopDiscard"]; ok { + nestedRoutingTableIpStaticRoute.Nexthop.Discard.Misc = o.Misc["RoutingTableIpStaticRouteNexthopDiscard"] + } + } + if oRoutingTableIpStaticRoute.Nexthop.IpAddress != nil { + nestedRoutingTableIpStaticRoute.Nexthop.IpAddress = oRoutingTableIpStaticRoute.Nexthop.IpAddress + } + if oRoutingTableIpStaticRoute.Nexthop.Fqdn != nil { + nestedRoutingTableIpStaticRoute.Nexthop.Fqdn = oRoutingTableIpStaticRoute.Nexthop.Fqdn + } + if oRoutingTableIpStaticRoute.Nexthop.NextVr != nil { + nestedRoutingTableIpStaticRoute.Nexthop.NextVr = oRoutingTableIpStaticRoute.Nexthop.NextVr + } + } + if oRoutingTableIpStaticRoute.PathMonitor != nil { + nestedRoutingTableIpStaticRoute.PathMonitor = &RoutingTableIpStaticRoutePathMonitorXml{} + if _, ok := o.Misc["RoutingTableIpStaticRoutePathMonitor"]; ok { + nestedRoutingTableIpStaticRoute.PathMonitor.Misc = o.Misc["RoutingTableIpStaticRoutePathMonitor"] + } + if oRoutingTableIpStaticRoute.PathMonitor.Enable != nil { + nestedRoutingTableIpStaticRoute.PathMonitor.Enable = util.YesNo(oRoutingTableIpStaticRoute.PathMonitor.Enable, nil) + } + if oRoutingTableIpStaticRoute.PathMonitor.FailureCondition != nil { + nestedRoutingTableIpStaticRoute.PathMonitor.FailureCondition = oRoutingTableIpStaticRoute.PathMonitor.FailureCondition + } + if oRoutingTableIpStaticRoute.PathMonitor.HoldTime != nil { + nestedRoutingTableIpStaticRoute.PathMonitor.HoldTime = oRoutingTableIpStaticRoute.PathMonitor.HoldTime + } + if oRoutingTableIpStaticRoute.PathMonitor.MonitorDestinations != nil { + nestedRoutingTableIpStaticRoute.PathMonitor.MonitorDestinations = []RoutingTableIpStaticRoutePathMonitorMonitorDestinationsXml{} + for _, oRoutingTableIpStaticRoutePathMonitorMonitorDestinations := range oRoutingTableIpStaticRoute.PathMonitor.MonitorDestinations { + nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations := RoutingTableIpStaticRoutePathMonitorMonitorDestinationsXml{} + if _, ok := o.Misc["RoutingTableIpStaticRoutePathMonitorMonitorDestinations"]; ok { + nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Misc = o.Misc["RoutingTableIpStaticRoutePathMonitorMonitorDestinations"] + } + if oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Count != nil { + nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Count = oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Count + } + if oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Name != "" { + nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Name = oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Name + } + if oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Enable != nil { + nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Enable = util.YesNo(oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Enable, nil) + } + if oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Source != nil { + nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Source = oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Source + } + if oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Destination != nil { + nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Destination = oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Destination + } + if oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Interval != nil { + nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Interval = oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Interval + } + nestedRoutingTableIpStaticRoute.PathMonitor.MonitorDestinations = append(nestedRoutingTableIpStaticRoute.PathMonitor.MonitorDestinations, nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations) + } + } + } + nestedRoutingTable.Ip.StaticRoute = append(nestedRoutingTable.Ip.StaticRoute, nestedRoutingTableIpStaticRoute) + } + } + } + } + entry.RoutingTable = nestedRoutingTable + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + var nestedAdminDists *AdminDists + if o.AdminDists != nil { + nestedAdminDists = &AdminDists{} + if o.AdminDists.Misc != nil { + entry.Misc["AdminDists"] = o.AdminDists.Misc + } + if o.AdminDists.StaticIpv6 != nil { + nestedAdminDists.StaticIpv6 = o.AdminDists.StaticIpv6 + } + if o.AdminDists.Ibgp != nil { + nestedAdminDists.Ibgp = o.AdminDists.Ibgp + } + if o.AdminDists.OspfExt != nil { + nestedAdminDists.OspfExt = o.AdminDists.OspfExt + } + if o.AdminDists.OspfInt != nil { + nestedAdminDists.OspfInt = o.AdminDists.OspfInt + } + if o.AdminDists.Ospfv3Ext != nil { + nestedAdminDists.Ospfv3Ext = o.AdminDists.Ospfv3Ext + } + if o.AdminDists.Rip != nil { + nestedAdminDists.Rip = o.AdminDists.Rip + } + if o.AdminDists.Ebgp != nil { + nestedAdminDists.Ebgp = o.AdminDists.Ebgp + } + if o.AdminDists.Ospfv3Int != nil { + nestedAdminDists.Ospfv3Int = o.AdminDists.Ospfv3Int + } + if o.AdminDists.Static != nil { + nestedAdminDists.Static = o.AdminDists.Static + } + } + entry.AdminDists = nestedAdminDists + + var nestedEcmp *Ecmp + if o.Ecmp != nil { + nestedEcmp = &Ecmp{} + if o.Ecmp.Misc != nil { + entry.Misc["Ecmp"] = o.Ecmp.Misc + } + if o.Ecmp.Algorithm != nil { + nestedEcmp.Algorithm = &EcmpAlgorithm{} + if o.Ecmp.Algorithm.Misc != nil { + entry.Misc["EcmpAlgorithm"] = o.Ecmp.Algorithm.Misc + } + if o.Ecmp.Algorithm.BalancedRoundRobin != nil { + nestedEcmp.Algorithm.BalancedRoundRobin = &EcmpAlgorithmBalancedRoundRobin{} + if o.Ecmp.Algorithm.BalancedRoundRobin.Misc != nil { + entry.Misc["EcmpAlgorithmBalancedRoundRobin"] = o.Ecmp.Algorithm.BalancedRoundRobin.Misc + } + } + if o.Ecmp.Algorithm.IpHash != nil { + nestedEcmp.Algorithm.IpHash = &EcmpAlgorithmIpHash{} + if o.Ecmp.Algorithm.IpHash.Misc != nil { + entry.Misc["EcmpAlgorithmIpHash"] = o.Ecmp.Algorithm.IpHash.Misc + } + if o.Ecmp.Algorithm.IpHash.UsePort != nil { + nestedEcmp.Algorithm.IpHash.UsePort = util.AsBool(o.Ecmp.Algorithm.IpHash.UsePort, nil) + } + if o.Ecmp.Algorithm.IpHash.HashSeed != nil { + nestedEcmp.Algorithm.IpHash.HashSeed = o.Ecmp.Algorithm.IpHash.HashSeed + } + if o.Ecmp.Algorithm.IpHash.SrcOnly != nil { + nestedEcmp.Algorithm.IpHash.SrcOnly = util.AsBool(o.Ecmp.Algorithm.IpHash.SrcOnly, nil) + } + } + if o.Ecmp.Algorithm.IpModulo != nil { + nestedEcmp.Algorithm.IpModulo = &EcmpAlgorithmIpModulo{} + if o.Ecmp.Algorithm.IpModulo.Misc != nil { + entry.Misc["EcmpAlgorithmIpModulo"] = o.Ecmp.Algorithm.IpModulo.Misc + } + } + if o.Ecmp.Algorithm.WeightedRoundRobin != nil { + nestedEcmp.Algorithm.WeightedRoundRobin = &EcmpAlgorithmWeightedRoundRobin{} + if o.Ecmp.Algorithm.WeightedRoundRobin.Misc != nil { + entry.Misc["EcmpAlgorithmWeightedRoundRobin"] = o.Ecmp.Algorithm.WeightedRoundRobin.Misc + } + if o.Ecmp.Algorithm.WeightedRoundRobin.Interface != nil { + nestedEcmp.Algorithm.WeightedRoundRobin.Interface = []EcmpAlgorithmWeightedRoundRobinInterface{} + for _, oEcmpAlgorithmWeightedRoundRobinInterface := range o.Ecmp.Algorithm.WeightedRoundRobin.Interface { + nestedEcmpAlgorithmWeightedRoundRobinInterface := EcmpAlgorithmWeightedRoundRobinInterface{} + if oEcmpAlgorithmWeightedRoundRobinInterface.Misc != nil { + entry.Misc["EcmpAlgorithmWeightedRoundRobinInterface"] = oEcmpAlgorithmWeightedRoundRobinInterface.Misc + } + if oEcmpAlgorithmWeightedRoundRobinInterface.Weight != nil { + nestedEcmpAlgorithmWeightedRoundRobinInterface.Weight = oEcmpAlgorithmWeightedRoundRobinInterface.Weight + } + if oEcmpAlgorithmWeightedRoundRobinInterface.Name != "" { + nestedEcmpAlgorithmWeightedRoundRobinInterface.Name = oEcmpAlgorithmWeightedRoundRobinInterface.Name + } + nestedEcmp.Algorithm.WeightedRoundRobin.Interface = append(nestedEcmp.Algorithm.WeightedRoundRobin.Interface, nestedEcmpAlgorithmWeightedRoundRobinInterface) + } + } + } + } + if o.Ecmp.Enable != nil { + nestedEcmp.Enable = util.AsBool(o.Ecmp.Enable, nil) + } + if o.Ecmp.MaxPath != nil { + nestedEcmp.MaxPath = o.Ecmp.MaxPath + } + if o.Ecmp.StrictSourcePath != nil { + nestedEcmp.StrictSourcePath = util.AsBool(o.Ecmp.StrictSourcePath, nil) + } + if o.Ecmp.SymmetricReturn != nil { + nestedEcmp.SymmetricReturn = util.AsBool(o.Ecmp.SymmetricReturn, nil) + } + } + entry.Ecmp = nestedEcmp + + entry.Interface = util.MemToStr(o.Interface) + var nestedMulticast *Multicast + if o.Multicast != nil { + nestedMulticast = &Multicast{} + if o.Multicast.Misc != nil { + entry.Misc["Multicast"] = o.Multicast.Misc + } + if o.Multicast.Rp != nil { + nestedMulticast.Rp = &MulticastRp{} + if o.Multicast.Rp.Misc != nil { + entry.Misc["MulticastRp"] = o.Multicast.Rp.Misc + } + if o.Multicast.Rp.ExternalRp != nil { + nestedMulticast.Rp.ExternalRp = []MulticastRpExternalRp{} + for _, oMulticastRpExternalRp := range o.Multicast.Rp.ExternalRp { + nestedMulticastRpExternalRp := MulticastRpExternalRp{} + if oMulticastRpExternalRp.Misc != nil { + entry.Misc["MulticastRpExternalRp"] = oMulticastRpExternalRp.Misc + } + if oMulticastRpExternalRp.GroupAddresses != nil { + nestedMulticastRpExternalRp.GroupAddresses = util.MemToStr(oMulticastRpExternalRp.GroupAddresses) + } + if oMulticastRpExternalRp.Override != nil { + nestedMulticastRpExternalRp.Override = util.AsBool(oMulticastRpExternalRp.Override, nil) + } + if oMulticastRpExternalRp.Name != "" { + nestedMulticastRpExternalRp.Name = oMulticastRpExternalRp.Name + } + nestedMulticast.Rp.ExternalRp = append(nestedMulticast.Rp.ExternalRp, nestedMulticastRpExternalRp) + } + } + if o.Multicast.Rp.LocalRp != nil { + nestedMulticast.Rp.LocalRp = &MulticastRpLocalRp{} + if o.Multicast.Rp.LocalRp.Misc != nil { + entry.Misc["MulticastRpLocalRp"] = o.Multicast.Rp.LocalRp.Misc + } + if o.Multicast.Rp.LocalRp.CandidateRp != nil { + nestedMulticast.Rp.LocalRp.CandidateRp = &MulticastRpLocalRpCandidateRp{} + if o.Multicast.Rp.LocalRp.CandidateRp.Misc != nil { + entry.Misc["MulticastRpLocalRpCandidateRp"] = o.Multicast.Rp.LocalRp.CandidateRp.Misc + } + if o.Multicast.Rp.LocalRp.CandidateRp.AdvertisementInterval != nil { + nestedMulticast.Rp.LocalRp.CandidateRp.AdvertisementInterval = o.Multicast.Rp.LocalRp.CandidateRp.AdvertisementInterval + } + if o.Multicast.Rp.LocalRp.CandidateRp.GroupAddresses != nil { + nestedMulticast.Rp.LocalRp.CandidateRp.GroupAddresses = util.MemToStr(o.Multicast.Rp.LocalRp.CandidateRp.GroupAddresses) + } + if o.Multicast.Rp.LocalRp.CandidateRp.Interface != nil { + nestedMulticast.Rp.LocalRp.CandidateRp.Interface = o.Multicast.Rp.LocalRp.CandidateRp.Interface + } + if o.Multicast.Rp.LocalRp.CandidateRp.Priority != nil { + nestedMulticast.Rp.LocalRp.CandidateRp.Priority = o.Multicast.Rp.LocalRp.CandidateRp.Priority + } + if o.Multicast.Rp.LocalRp.CandidateRp.Address != nil { + nestedMulticast.Rp.LocalRp.CandidateRp.Address = o.Multicast.Rp.LocalRp.CandidateRp.Address + } + } + if o.Multicast.Rp.LocalRp.StaticRp != nil { + nestedMulticast.Rp.LocalRp.StaticRp = &MulticastRpLocalRpStaticRp{} + if o.Multicast.Rp.LocalRp.StaticRp.Misc != nil { + entry.Misc["MulticastRpLocalRpStaticRp"] = o.Multicast.Rp.LocalRp.StaticRp.Misc + } + if o.Multicast.Rp.LocalRp.StaticRp.Interface != nil { + nestedMulticast.Rp.LocalRp.StaticRp.Interface = o.Multicast.Rp.LocalRp.StaticRp.Interface + } + if o.Multicast.Rp.LocalRp.StaticRp.Override != nil { + nestedMulticast.Rp.LocalRp.StaticRp.Override = util.AsBool(o.Multicast.Rp.LocalRp.StaticRp.Override, nil) + } + if o.Multicast.Rp.LocalRp.StaticRp.Address != nil { + nestedMulticast.Rp.LocalRp.StaticRp.Address = o.Multicast.Rp.LocalRp.StaticRp.Address + } + if o.Multicast.Rp.LocalRp.StaticRp.GroupAddresses != nil { + nestedMulticast.Rp.LocalRp.StaticRp.GroupAddresses = util.MemToStr(o.Multicast.Rp.LocalRp.StaticRp.GroupAddresses) + } + } + } + } + if o.Multicast.SptThreshold != nil { + nestedMulticast.SptThreshold = []MulticastSptThreshold{} + for _, oMulticastSptThreshold := range o.Multicast.SptThreshold { + nestedMulticastSptThreshold := MulticastSptThreshold{} + if oMulticastSptThreshold.Misc != nil { + entry.Misc["MulticastSptThreshold"] = oMulticastSptThreshold.Misc + } + if oMulticastSptThreshold.Threshold != nil { + nestedMulticastSptThreshold.Threshold = oMulticastSptThreshold.Threshold + } + if oMulticastSptThreshold.Name != "" { + nestedMulticastSptThreshold.Name = oMulticastSptThreshold.Name + } + nestedMulticast.SptThreshold = append(nestedMulticast.SptThreshold, nestedMulticastSptThreshold) + } + } + if o.Multicast.SsmAddressSpace != nil { + nestedMulticast.SsmAddressSpace = []MulticastSsmAddressSpace{} + for _, oMulticastSsmAddressSpace := range o.Multicast.SsmAddressSpace { + nestedMulticastSsmAddressSpace := MulticastSsmAddressSpace{} + if oMulticastSsmAddressSpace.Misc != nil { + entry.Misc["MulticastSsmAddressSpace"] = oMulticastSsmAddressSpace.Misc + } + if oMulticastSsmAddressSpace.GroupAddress != nil { + nestedMulticastSsmAddressSpace.GroupAddress = oMulticastSsmAddressSpace.GroupAddress + } + if oMulticastSsmAddressSpace.Included != nil { + nestedMulticastSsmAddressSpace.Included = util.AsBool(oMulticastSsmAddressSpace.Included, nil) + } + if oMulticastSsmAddressSpace.Name != "" { + nestedMulticastSsmAddressSpace.Name = oMulticastSsmAddressSpace.Name + } + nestedMulticast.SsmAddressSpace = append(nestedMulticast.SsmAddressSpace, nestedMulticastSsmAddressSpace) + } + } + if o.Multicast.Enable != nil { + nestedMulticast.Enable = util.AsBool(o.Multicast.Enable, nil) + } + if o.Multicast.InterfaceGroup != nil { + nestedMulticast.InterfaceGroup = []MulticastInterfaceGroup{} + for _, oMulticastInterfaceGroup := range o.Multicast.InterfaceGroup { + nestedMulticastInterfaceGroup := MulticastInterfaceGroup{} + if oMulticastInterfaceGroup.Misc != nil { + entry.Misc["MulticastInterfaceGroup"] = oMulticastInterfaceGroup.Misc + } + if oMulticastInterfaceGroup.Igmp != nil { + nestedMulticastInterfaceGroup.Igmp = &MulticastInterfaceGroupIgmp{} + if oMulticastInterfaceGroup.Igmp.Misc != nil { + entry.Misc["MulticastInterfaceGroupIgmp"] = oMulticastInterfaceGroup.Igmp.Misc + } + if oMulticastInterfaceGroup.Igmp.ImmediateLeave != nil { + nestedMulticastInterfaceGroup.Igmp.ImmediateLeave = util.AsBool(oMulticastInterfaceGroup.Igmp.ImmediateLeave, nil) + } + if oMulticastInterfaceGroup.Igmp.MaxGroups != nil { + nestedMulticastInterfaceGroup.Igmp.MaxGroups = oMulticastInterfaceGroup.Igmp.MaxGroups + } + if oMulticastInterfaceGroup.Igmp.MaxSources != nil { + nestedMulticastInterfaceGroup.Igmp.MaxSources = oMulticastInterfaceGroup.Igmp.MaxSources + } + if oMulticastInterfaceGroup.Igmp.MaxQueryResponseTime != nil { + nestedMulticastInterfaceGroup.Igmp.MaxQueryResponseTime = oMulticastInterfaceGroup.Igmp.MaxQueryResponseTime + } + if oMulticastInterfaceGroup.Igmp.QueryInterval != nil { + nestedMulticastInterfaceGroup.Igmp.QueryInterval = oMulticastInterfaceGroup.Igmp.QueryInterval + } + if oMulticastInterfaceGroup.Igmp.LastMemberQueryInterval != nil { + nestedMulticastInterfaceGroup.Igmp.LastMemberQueryInterval = oMulticastInterfaceGroup.Igmp.LastMemberQueryInterval + } + if oMulticastInterfaceGroup.Igmp.Robustness != nil { + nestedMulticastInterfaceGroup.Igmp.Robustness = oMulticastInterfaceGroup.Igmp.Robustness + } + if oMulticastInterfaceGroup.Igmp.RouterAlertPolicing != nil { + nestedMulticastInterfaceGroup.Igmp.RouterAlertPolicing = util.AsBool(oMulticastInterfaceGroup.Igmp.RouterAlertPolicing, nil) + } + if oMulticastInterfaceGroup.Igmp.Enable != nil { + nestedMulticastInterfaceGroup.Igmp.Enable = util.AsBool(oMulticastInterfaceGroup.Igmp.Enable, nil) + } + if oMulticastInterfaceGroup.Igmp.Version != nil { + nestedMulticastInterfaceGroup.Igmp.Version = oMulticastInterfaceGroup.Igmp.Version + } + } + if oMulticastInterfaceGroup.Pim != nil { + nestedMulticastInterfaceGroup.Pim = &MulticastInterfaceGroupPim{} + if oMulticastInterfaceGroup.Pim.Misc != nil { + entry.Misc["MulticastInterfaceGroupPim"] = oMulticastInterfaceGroup.Pim.Misc + } + if oMulticastInterfaceGroup.Pim.Enable != nil { + nestedMulticastInterfaceGroup.Pim.Enable = util.AsBool(oMulticastInterfaceGroup.Pim.Enable, nil) + } + if oMulticastInterfaceGroup.Pim.AssertInterval != nil { + nestedMulticastInterfaceGroup.Pim.AssertInterval = oMulticastInterfaceGroup.Pim.AssertInterval + } + if oMulticastInterfaceGroup.Pim.HelloInterval != nil { + nestedMulticastInterfaceGroup.Pim.HelloInterval = oMulticastInterfaceGroup.Pim.HelloInterval + } + if oMulticastInterfaceGroup.Pim.JoinPruneInterval != nil { + nestedMulticastInterfaceGroup.Pim.JoinPruneInterval = oMulticastInterfaceGroup.Pim.JoinPruneInterval + } + if oMulticastInterfaceGroup.Pim.DrPriority != nil { + nestedMulticastInterfaceGroup.Pim.DrPriority = oMulticastInterfaceGroup.Pim.DrPriority + } + if oMulticastInterfaceGroup.Pim.BsrBorder != nil { + nestedMulticastInterfaceGroup.Pim.BsrBorder = util.AsBool(oMulticastInterfaceGroup.Pim.BsrBorder, nil) + } + if oMulticastInterfaceGroup.Pim.AllowedNeighbors != nil { + nestedMulticastInterfaceGroup.Pim.AllowedNeighbors = []MulticastInterfaceGroupPimAllowedNeighbors{} + for _, oMulticastInterfaceGroupPimAllowedNeighbors := range oMulticastInterfaceGroup.Pim.AllowedNeighbors { + nestedMulticastInterfaceGroupPimAllowedNeighbors := MulticastInterfaceGroupPimAllowedNeighbors{} + if oMulticastInterfaceGroupPimAllowedNeighbors.Misc != nil { + entry.Misc["MulticastInterfaceGroupPimAllowedNeighbors"] = oMulticastInterfaceGroupPimAllowedNeighbors.Misc + } + if oMulticastInterfaceGroupPimAllowedNeighbors.Name != "" { + nestedMulticastInterfaceGroupPimAllowedNeighbors.Name = oMulticastInterfaceGroupPimAllowedNeighbors.Name + } + nestedMulticastInterfaceGroup.Pim.AllowedNeighbors = append(nestedMulticastInterfaceGroup.Pim.AllowedNeighbors, nestedMulticastInterfaceGroupPimAllowedNeighbors) + } + } + } + if oMulticastInterfaceGroup.Name != "" { + nestedMulticastInterfaceGroup.Name = oMulticastInterfaceGroup.Name + } + if oMulticastInterfaceGroup.Description != nil { + nestedMulticastInterfaceGroup.Description = oMulticastInterfaceGroup.Description + } + if oMulticastInterfaceGroup.Interface != nil { + nestedMulticastInterfaceGroup.Interface = util.MemToStr(oMulticastInterfaceGroup.Interface) + } + if oMulticastInterfaceGroup.GroupPermission != nil { + nestedMulticastInterfaceGroup.GroupPermission = &MulticastInterfaceGroupGroupPermission{} + if oMulticastInterfaceGroup.GroupPermission.Misc != nil { + entry.Misc["MulticastInterfaceGroupGroupPermission"] = oMulticastInterfaceGroup.GroupPermission.Misc + } + if oMulticastInterfaceGroup.GroupPermission.AnySourceMulticast != nil { + nestedMulticastInterfaceGroup.GroupPermission.AnySourceMulticast = []MulticastInterfaceGroupGroupPermissionAnySourceMulticast{} + for _, oMulticastInterfaceGroupGroupPermissionAnySourceMulticast := range oMulticastInterfaceGroup.GroupPermission.AnySourceMulticast { + nestedMulticastInterfaceGroupGroupPermissionAnySourceMulticast := MulticastInterfaceGroupGroupPermissionAnySourceMulticast{} + if oMulticastInterfaceGroupGroupPermissionAnySourceMulticast.Misc != nil { + entry.Misc["MulticastInterfaceGroupGroupPermissionAnySourceMulticast"] = oMulticastInterfaceGroupGroupPermissionAnySourceMulticast.Misc + } + if oMulticastInterfaceGroupGroupPermissionAnySourceMulticast.GroupAddress != nil { + nestedMulticastInterfaceGroupGroupPermissionAnySourceMulticast.GroupAddress = oMulticastInterfaceGroupGroupPermissionAnySourceMulticast.GroupAddress + } + if oMulticastInterfaceGroupGroupPermissionAnySourceMulticast.Included != nil { + nestedMulticastInterfaceGroupGroupPermissionAnySourceMulticast.Included = util.AsBool(oMulticastInterfaceGroupGroupPermissionAnySourceMulticast.Included, nil) + } + if oMulticastInterfaceGroupGroupPermissionAnySourceMulticast.Name != "" { + nestedMulticastInterfaceGroupGroupPermissionAnySourceMulticast.Name = oMulticastInterfaceGroupGroupPermissionAnySourceMulticast.Name + } + nestedMulticastInterfaceGroup.GroupPermission.AnySourceMulticast = append(nestedMulticastInterfaceGroup.GroupPermission.AnySourceMulticast, nestedMulticastInterfaceGroupGroupPermissionAnySourceMulticast) + } + } + if oMulticastInterfaceGroup.GroupPermission.SourceSpecificMulticast != nil { + nestedMulticastInterfaceGroup.GroupPermission.SourceSpecificMulticast = []MulticastInterfaceGroupGroupPermissionSourceSpecificMulticast{} + for _, oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast := range oMulticastInterfaceGroup.GroupPermission.SourceSpecificMulticast { + nestedMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast := MulticastInterfaceGroupGroupPermissionSourceSpecificMulticast{} + if oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.Misc != nil { + entry.Misc["MulticastInterfaceGroupGroupPermissionSourceSpecificMulticast"] = oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.Misc + } + if oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.GroupAddress != nil { + nestedMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.GroupAddress = oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.GroupAddress + } + if oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.SourceAddress != nil { + nestedMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.SourceAddress = oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.SourceAddress + } + if oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.Included != nil { + nestedMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.Included = util.AsBool(oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.Included, nil) + } + if oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.Name != "" { + nestedMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.Name = oMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast.Name + } + nestedMulticastInterfaceGroup.GroupPermission.SourceSpecificMulticast = append(nestedMulticastInterfaceGroup.GroupPermission.SourceSpecificMulticast, nestedMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast) + } + } + } + nestedMulticast.InterfaceGroup = append(nestedMulticast.InterfaceGroup, nestedMulticastInterfaceGroup) + } + } + if o.Multicast.RouteAgeoutTime != nil { + nestedMulticast.RouteAgeoutTime = o.Multicast.RouteAgeoutTime + } + } + entry.Multicast = nestedMulticast + + var nestedProtocol *Protocol + if o.Protocol != nil { + nestedProtocol = &Protocol{} + if o.Protocol.Misc != nil { + entry.Misc["Protocol"] = o.Protocol.Misc + } + if o.Protocol.Ospfv3 != nil { + nestedProtocol.Ospfv3 = &ProtocolOspfv3{} + if o.Protocol.Ospfv3.Misc != nil { + entry.Misc["ProtocolOspfv3"] = o.Protocol.Ospfv3.Misc + } + if o.Protocol.Ospfv3.RouterId != nil { + nestedProtocol.Ospfv3.RouterId = o.Protocol.Ospfv3.RouterId + } + if o.Protocol.Ospfv3.Timers != nil { + nestedProtocol.Ospfv3.Timers = &ProtocolOspfv3Timers{} + if o.Protocol.Ospfv3.Timers.Misc != nil { + entry.Misc["ProtocolOspfv3Timers"] = o.Protocol.Ospfv3.Timers.Misc + } + if o.Protocol.Ospfv3.Timers.LsaInterval != nil { + nestedProtocol.Ospfv3.Timers.LsaInterval = o.Protocol.Ospfv3.Timers.LsaInterval + } + if o.Protocol.Ospfv3.Timers.SpfCalculationDelay != nil { + nestedProtocol.Ospfv3.Timers.SpfCalculationDelay = o.Protocol.Ospfv3.Timers.SpfCalculationDelay + } + } + if o.Protocol.Ospfv3.AllowRedistDefaultRoute != nil { + nestedProtocol.Ospfv3.AllowRedistDefaultRoute = util.AsBool(o.Protocol.Ospfv3.AllowRedistDefaultRoute, nil) + } + if o.Protocol.Ospfv3.Enable != nil { + nestedProtocol.Ospfv3.Enable = util.AsBool(o.Protocol.Ospfv3.Enable, nil) + } + if o.Protocol.Ospfv3.DisableTransitTraffic != nil { + nestedProtocol.Ospfv3.DisableTransitTraffic = util.AsBool(o.Protocol.Ospfv3.DisableTransitTraffic, nil) + } + if o.Protocol.Ospfv3.ExportRules != nil { + nestedProtocol.Ospfv3.ExportRules = []ProtocolOspfv3ExportRules{} + for _, oProtocolOspfv3ExportRules := range o.Protocol.Ospfv3.ExportRules { + nestedProtocolOspfv3ExportRules := ProtocolOspfv3ExportRules{} + if oProtocolOspfv3ExportRules.Misc != nil { + entry.Misc["ProtocolOspfv3ExportRules"] = oProtocolOspfv3ExportRules.Misc + } + if oProtocolOspfv3ExportRules.Metric != nil { + nestedProtocolOspfv3ExportRules.Metric = oProtocolOspfv3ExportRules.Metric + } + if oProtocolOspfv3ExportRules.Name != "" { + nestedProtocolOspfv3ExportRules.Name = oProtocolOspfv3ExportRules.Name + } + if oProtocolOspfv3ExportRules.NewPathType != nil { + nestedProtocolOspfv3ExportRules.NewPathType = oProtocolOspfv3ExportRules.NewPathType + } + if oProtocolOspfv3ExportRules.NewTag != nil { + nestedProtocolOspfv3ExportRules.NewTag = oProtocolOspfv3ExportRules.NewTag + } + nestedProtocol.Ospfv3.ExportRules = append(nestedProtocol.Ospfv3.ExportRules, nestedProtocolOspfv3ExportRules) + } + } + if o.Protocol.Ospfv3.GlobalBfd != nil { + nestedProtocol.Ospfv3.GlobalBfd = &ProtocolOspfv3GlobalBfd{} + if o.Protocol.Ospfv3.GlobalBfd.Misc != nil { + entry.Misc["ProtocolOspfv3GlobalBfd"] = o.Protocol.Ospfv3.GlobalBfd.Misc + } + if o.Protocol.Ospfv3.GlobalBfd.Profile != nil { + nestedProtocol.Ospfv3.GlobalBfd.Profile = o.Protocol.Ospfv3.GlobalBfd.Profile + } + } + if o.Protocol.Ospfv3.GracefulRestart != nil { + nestedProtocol.Ospfv3.GracefulRestart = &ProtocolOspfv3GracefulRestart{} + if o.Protocol.Ospfv3.GracefulRestart.Misc != nil { + entry.Misc["ProtocolOspfv3GracefulRestart"] = o.Protocol.Ospfv3.GracefulRestart.Misc + } + if o.Protocol.Ospfv3.GracefulRestart.Enable != nil { + nestedProtocol.Ospfv3.GracefulRestart.Enable = util.AsBool(o.Protocol.Ospfv3.GracefulRestart.Enable, nil) + } + if o.Protocol.Ospfv3.GracefulRestart.GracePeriod != nil { + nestedProtocol.Ospfv3.GracefulRestart.GracePeriod = o.Protocol.Ospfv3.GracefulRestart.GracePeriod + } + if o.Protocol.Ospfv3.GracefulRestart.HelperEnable != nil { + nestedProtocol.Ospfv3.GracefulRestart.HelperEnable = util.AsBool(o.Protocol.Ospfv3.GracefulRestart.HelperEnable, nil) + } + if o.Protocol.Ospfv3.GracefulRestart.MaxNeighborRestartTime != nil { + nestedProtocol.Ospfv3.GracefulRestart.MaxNeighborRestartTime = o.Protocol.Ospfv3.GracefulRestart.MaxNeighborRestartTime + } + if o.Protocol.Ospfv3.GracefulRestart.StrictLSAChecking != nil { + nestedProtocol.Ospfv3.GracefulRestart.StrictLSAChecking = util.AsBool(o.Protocol.Ospfv3.GracefulRestart.StrictLSAChecking, nil) + } + } + if o.Protocol.Ospfv3.RejectDefaultRoute != nil { + nestedProtocol.Ospfv3.RejectDefaultRoute = util.AsBool(o.Protocol.Ospfv3.RejectDefaultRoute, nil) + } + if o.Protocol.Ospfv3.Area != nil { + nestedProtocol.Ospfv3.Area = []ProtocolOspfv3Area{} + for _, oProtocolOspfv3Area := range o.Protocol.Ospfv3.Area { + nestedProtocolOspfv3Area := ProtocolOspfv3Area{} + if oProtocolOspfv3Area.Misc != nil { + entry.Misc["ProtocolOspfv3Area"] = oProtocolOspfv3Area.Misc + } + if oProtocolOspfv3Area.Name != "" { + nestedProtocolOspfv3Area.Name = oProtocolOspfv3Area.Name + } + if oProtocolOspfv3Area.Authentication != nil { + nestedProtocolOspfv3Area.Authentication = oProtocolOspfv3Area.Authentication + } + if oProtocolOspfv3Area.Type != nil { + nestedProtocolOspfv3Area.Type = &ProtocolOspfv3AreaType{} + if oProtocolOspfv3Area.Type.Misc != nil { + entry.Misc["ProtocolOspfv3AreaType"] = oProtocolOspfv3Area.Type.Misc + } + if oProtocolOspfv3Area.Type.Stub != nil { + nestedProtocolOspfv3Area.Type.Stub = &ProtocolOspfv3AreaTypeStub{} + if oProtocolOspfv3Area.Type.Stub.Misc != nil { + entry.Misc["ProtocolOspfv3AreaTypeStub"] = oProtocolOspfv3Area.Type.Stub.Misc + } + if oProtocolOspfv3Area.Type.Stub.AcceptSummary != nil { + nestedProtocolOspfv3Area.Type.Stub.AcceptSummary = util.AsBool(oProtocolOspfv3Area.Type.Stub.AcceptSummary, nil) + } + if oProtocolOspfv3Area.Type.Stub.DefaultRoute != nil { + nestedProtocolOspfv3Area.Type.Stub.DefaultRoute = &ProtocolOspfv3AreaTypeStubDefaultRoute{} + if oProtocolOspfv3Area.Type.Stub.DefaultRoute.Misc != nil { + entry.Misc["ProtocolOspfv3AreaTypeStubDefaultRoute"] = oProtocolOspfv3Area.Type.Stub.DefaultRoute.Misc + } + if oProtocolOspfv3Area.Type.Stub.DefaultRoute.Disable != nil { + nestedProtocolOspfv3Area.Type.Stub.DefaultRoute.Disable = &ProtocolOspfv3AreaTypeStubDefaultRouteDisable{} + if oProtocolOspfv3Area.Type.Stub.DefaultRoute.Disable.Misc != nil { + entry.Misc["ProtocolOspfv3AreaTypeStubDefaultRouteDisable"] = oProtocolOspfv3Area.Type.Stub.DefaultRoute.Disable.Misc + } + } + if oProtocolOspfv3Area.Type.Stub.DefaultRoute.Advertise != nil { + nestedProtocolOspfv3Area.Type.Stub.DefaultRoute.Advertise = &ProtocolOspfv3AreaTypeStubDefaultRouteAdvertise{} + if oProtocolOspfv3Area.Type.Stub.DefaultRoute.Advertise.Misc != nil { + entry.Misc["ProtocolOspfv3AreaTypeStubDefaultRouteAdvertise"] = oProtocolOspfv3Area.Type.Stub.DefaultRoute.Advertise.Misc + } + if oProtocolOspfv3Area.Type.Stub.DefaultRoute.Advertise.Metric != nil { + nestedProtocolOspfv3Area.Type.Stub.DefaultRoute.Advertise.Metric = oProtocolOspfv3Area.Type.Stub.DefaultRoute.Advertise.Metric + } + } + } + } + if oProtocolOspfv3Area.Type.Nssa != nil { + nestedProtocolOspfv3Area.Type.Nssa = &ProtocolOspfv3AreaTypeNssa{} + if oProtocolOspfv3Area.Type.Nssa.Misc != nil { + entry.Misc["ProtocolOspfv3AreaTypeNssa"] = oProtocolOspfv3Area.Type.Nssa.Misc + } + if oProtocolOspfv3Area.Type.Nssa.AcceptSummary != nil { + nestedProtocolOspfv3Area.Type.Nssa.AcceptSummary = util.AsBool(oProtocolOspfv3Area.Type.Nssa.AcceptSummary, nil) + } + if oProtocolOspfv3Area.Type.Nssa.DefaultRoute != nil { + nestedProtocolOspfv3Area.Type.Nssa.DefaultRoute = &ProtocolOspfv3AreaTypeNssaDefaultRoute{} + if oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Misc != nil { + entry.Misc["ProtocolOspfv3AreaTypeNssaDefaultRoute"] = oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Misc + } + if oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Disable != nil { + nestedProtocolOspfv3Area.Type.Nssa.DefaultRoute.Disable = &ProtocolOspfv3AreaTypeNssaDefaultRouteDisable{} + if oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Disable.Misc != nil { + entry.Misc["ProtocolOspfv3AreaTypeNssaDefaultRouteDisable"] = oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Disable.Misc + } + } + if oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise != nil { + nestedProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise = &ProtocolOspfv3AreaTypeNssaDefaultRouteAdvertise{} + if oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise.Misc != nil { + entry.Misc["ProtocolOspfv3AreaTypeNssaDefaultRouteAdvertise"] = oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise.Misc + } + if oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise.Metric != nil { + nestedProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise.Metric = oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise.Metric + } + if oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise.Type != nil { + nestedProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise.Type = oProtocolOspfv3Area.Type.Nssa.DefaultRoute.Advertise.Type + } + } + } + if oProtocolOspfv3Area.Type.Nssa.NssaExtRange != nil { + nestedProtocolOspfv3Area.Type.Nssa.NssaExtRange = []ProtocolOspfv3AreaTypeNssaNssaExtRange{} + for _, oProtocolOspfv3AreaTypeNssaNssaExtRange := range oProtocolOspfv3Area.Type.Nssa.NssaExtRange { + nestedProtocolOspfv3AreaTypeNssaNssaExtRange := ProtocolOspfv3AreaTypeNssaNssaExtRange{} + if oProtocolOspfv3AreaTypeNssaNssaExtRange.Misc != nil { + entry.Misc["ProtocolOspfv3AreaTypeNssaNssaExtRange"] = oProtocolOspfv3AreaTypeNssaNssaExtRange.Misc + } + if oProtocolOspfv3AreaTypeNssaNssaExtRange.Name != "" { + nestedProtocolOspfv3AreaTypeNssaNssaExtRange.Name = oProtocolOspfv3AreaTypeNssaNssaExtRange.Name + } + if oProtocolOspfv3AreaTypeNssaNssaExtRange.Advertise != nil { + nestedProtocolOspfv3AreaTypeNssaNssaExtRange.Advertise = &ProtocolOspfv3AreaTypeNssaNssaExtRangeAdvertise{} + if oProtocolOspfv3AreaTypeNssaNssaExtRange.Advertise.Misc != nil { + entry.Misc["ProtocolOspfv3AreaTypeNssaNssaExtRangeAdvertise"] = oProtocolOspfv3AreaTypeNssaNssaExtRange.Advertise.Misc + } + } + if oProtocolOspfv3AreaTypeNssaNssaExtRange.Suppress != nil { + nestedProtocolOspfv3AreaTypeNssaNssaExtRange.Suppress = &ProtocolOspfv3AreaTypeNssaNssaExtRangeSuppress{} + if oProtocolOspfv3AreaTypeNssaNssaExtRange.Suppress.Misc != nil { + entry.Misc["ProtocolOspfv3AreaTypeNssaNssaExtRangeSuppress"] = oProtocolOspfv3AreaTypeNssaNssaExtRange.Suppress.Misc + } + } + nestedProtocolOspfv3Area.Type.Nssa.NssaExtRange = append(nestedProtocolOspfv3Area.Type.Nssa.NssaExtRange, nestedProtocolOspfv3AreaTypeNssaNssaExtRange) + } + } + } + if oProtocolOspfv3Area.Type.Normal != nil { + nestedProtocolOspfv3Area.Type.Normal = &ProtocolOspfv3AreaTypeNormal{} + if oProtocolOspfv3Area.Type.Normal.Misc != nil { + entry.Misc["ProtocolOspfv3AreaTypeNormal"] = oProtocolOspfv3Area.Type.Normal.Misc + } + } + } + if oProtocolOspfv3Area.Range != nil { + nestedProtocolOspfv3Area.Range = []ProtocolOspfv3AreaRange{} + for _, oProtocolOspfv3AreaRange := range oProtocolOspfv3Area.Range { + nestedProtocolOspfv3AreaRange := ProtocolOspfv3AreaRange{} + if oProtocolOspfv3AreaRange.Misc != nil { + entry.Misc["ProtocolOspfv3AreaRange"] = oProtocolOspfv3AreaRange.Misc + } + if oProtocolOspfv3AreaRange.Name != "" { + nestedProtocolOspfv3AreaRange.Name = oProtocolOspfv3AreaRange.Name + } + if oProtocolOspfv3AreaRange.Advertise != nil { + nestedProtocolOspfv3AreaRange.Advertise = &ProtocolOspfv3AreaRangeAdvertise{} + if oProtocolOspfv3AreaRange.Advertise.Misc != nil { + entry.Misc["ProtocolOspfv3AreaRangeAdvertise"] = oProtocolOspfv3AreaRange.Advertise.Misc + } + } + if oProtocolOspfv3AreaRange.Suppress != nil { + nestedProtocolOspfv3AreaRange.Suppress = &ProtocolOspfv3AreaRangeSuppress{} + if oProtocolOspfv3AreaRange.Suppress.Misc != nil { + entry.Misc["ProtocolOspfv3AreaRangeSuppress"] = oProtocolOspfv3AreaRange.Suppress.Misc + } + } + nestedProtocolOspfv3Area.Range = append(nestedProtocolOspfv3Area.Range, nestedProtocolOspfv3AreaRange) + } + } + if oProtocolOspfv3Area.Interface != nil { + nestedProtocolOspfv3Area.Interface = []ProtocolOspfv3AreaInterface{} + for _, oProtocolOspfv3AreaInterface := range oProtocolOspfv3Area.Interface { + nestedProtocolOspfv3AreaInterface := ProtocolOspfv3AreaInterface{} + if oProtocolOspfv3AreaInterface.Misc != nil { + entry.Misc["ProtocolOspfv3AreaInterface"] = oProtocolOspfv3AreaInterface.Misc + } + if oProtocolOspfv3AreaInterface.Passive != nil { + nestedProtocolOspfv3AreaInterface.Passive = util.AsBool(oProtocolOspfv3AreaInterface.Passive, nil) + } + if oProtocolOspfv3AreaInterface.Priority != nil { + nestedProtocolOspfv3AreaInterface.Priority = oProtocolOspfv3AreaInterface.Priority + } + if oProtocolOspfv3AreaInterface.DeadCounts != nil { + nestedProtocolOspfv3AreaInterface.DeadCounts = oProtocolOspfv3AreaInterface.DeadCounts + } + if oProtocolOspfv3AreaInterface.GrDelay != nil { + nestedProtocolOspfv3AreaInterface.GrDelay = oProtocolOspfv3AreaInterface.GrDelay + } + if oProtocolOspfv3AreaInterface.LinkType != nil { + nestedProtocolOspfv3AreaInterface.LinkType = &ProtocolOspfv3AreaInterfaceLinkType{} + if oProtocolOspfv3AreaInterface.LinkType.Misc != nil { + entry.Misc["ProtocolOspfv3AreaInterfaceLinkType"] = oProtocolOspfv3AreaInterface.LinkType.Misc + } + if oProtocolOspfv3AreaInterface.LinkType.P2mp != nil { + nestedProtocolOspfv3AreaInterface.LinkType.P2mp = &ProtocolOspfv3AreaInterfaceLinkTypeP2mp{} + if oProtocolOspfv3AreaInterface.LinkType.P2mp.Misc != nil { + entry.Misc["ProtocolOspfv3AreaInterfaceLinkTypeP2mp"] = oProtocolOspfv3AreaInterface.LinkType.P2mp.Misc + } + } + if oProtocolOspfv3AreaInterface.LinkType.Broadcast != nil { + nestedProtocolOspfv3AreaInterface.LinkType.Broadcast = &ProtocolOspfv3AreaInterfaceLinkTypeBroadcast{} + if oProtocolOspfv3AreaInterface.LinkType.Broadcast.Misc != nil { + entry.Misc["ProtocolOspfv3AreaInterfaceLinkTypeBroadcast"] = oProtocolOspfv3AreaInterface.LinkType.Broadcast.Misc + } + } + if oProtocolOspfv3AreaInterface.LinkType.P2p != nil { + nestedProtocolOspfv3AreaInterface.LinkType.P2p = &ProtocolOspfv3AreaInterfaceLinkTypeP2p{} + if oProtocolOspfv3AreaInterface.LinkType.P2p.Misc != nil { + entry.Misc["ProtocolOspfv3AreaInterfaceLinkTypeP2p"] = oProtocolOspfv3AreaInterface.LinkType.P2p.Misc + } + } + } + if oProtocolOspfv3AreaInterface.Neighbor != nil { + nestedProtocolOspfv3AreaInterface.Neighbor = []ProtocolOspfv3AreaInterfaceNeighbor{} + for _, oProtocolOspfv3AreaInterfaceNeighbor := range oProtocolOspfv3AreaInterface.Neighbor { + nestedProtocolOspfv3AreaInterfaceNeighbor := ProtocolOspfv3AreaInterfaceNeighbor{} + if oProtocolOspfv3AreaInterfaceNeighbor.Misc != nil { + entry.Misc["ProtocolOspfv3AreaInterfaceNeighbor"] = oProtocolOspfv3AreaInterfaceNeighbor.Misc + } + if oProtocolOspfv3AreaInterfaceNeighbor.Name != "" { + nestedProtocolOspfv3AreaInterfaceNeighbor.Name = oProtocolOspfv3AreaInterfaceNeighbor.Name + } + nestedProtocolOspfv3AreaInterface.Neighbor = append(nestedProtocolOspfv3AreaInterface.Neighbor, nestedProtocolOspfv3AreaInterfaceNeighbor) + } + } + if oProtocolOspfv3AreaInterface.InstanceId != nil { + nestedProtocolOspfv3AreaInterface.InstanceId = oProtocolOspfv3AreaInterface.InstanceId + } + if oProtocolOspfv3AreaInterface.Metric != nil { + nestedProtocolOspfv3AreaInterface.Metric = oProtocolOspfv3AreaInterface.Metric + } + if oProtocolOspfv3AreaInterface.HelloInterval != nil { + nestedProtocolOspfv3AreaInterface.HelloInterval = oProtocolOspfv3AreaInterface.HelloInterval + } + if oProtocolOspfv3AreaInterface.Authentication != nil { + nestedProtocolOspfv3AreaInterface.Authentication = oProtocolOspfv3AreaInterface.Authentication + } + if oProtocolOspfv3AreaInterface.Bfd != nil { + nestedProtocolOspfv3AreaInterface.Bfd = &ProtocolOspfv3AreaInterfaceBfd{} + if oProtocolOspfv3AreaInterface.Bfd.Misc != nil { + entry.Misc["ProtocolOspfv3AreaInterfaceBfd"] = oProtocolOspfv3AreaInterface.Bfd.Misc + } + if oProtocolOspfv3AreaInterface.Bfd.Profile != nil { + nestedProtocolOspfv3AreaInterface.Bfd.Profile = oProtocolOspfv3AreaInterface.Bfd.Profile + } + } + if oProtocolOspfv3AreaInterface.TransitDelay != nil { + nestedProtocolOspfv3AreaInterface.TransitDelay = oProtocolOspfv3AreaInterface.TransitDelay + } + if oProtocolOspfv3AreaInterface.Enable != nil { + nestedProtocolOspfv3AreaInterface.Enable = util.AsBool(oProtocolOspfv3AreaInterface.Enable, nil) + } + if oProtocolOspfv3AreaInterface.RetransmitInterval != nil { + nestedProtocolOspfv3AreaInterface.RetransmitInterval = oProtocolOspfv3AreaInterface.RetransmitInterval + } + if oProtocolOspfv3AreaInterface.Name != "" { + nestedProtocolOspfv3AreaInterface.Name = oProtocolOspfv3AreaInterface.Name + } + nestedProtocolOspfv3Area.Interface = append(nestedProtocolOspfv3Area.Interface, nestedProtocolOspfv3AreaInterface) + } + } + if oProtocolOspfv3Area.VirtualLink != nil { + nestedProtocolOspfv3Area.VirtualLink = []ProtocolOspfv3AreaVirtualLink{} + for _, oProtocolOspfv3AreaVirtualLink := range oProtocolOspfv3Area.VirtualLink { + nestedProtocolOspfv3AreaVirtualLink := ProtocolOspfv3AreaVirtualLink{} + if oProtocolOspfv3AreaVirtualLink.Misc != nil { + entry.Misc["ProtocolOspfv3AreaVirtualLink"] = oProtocolOspfv3AreaVirtualLink.Misc + } + if oProtocolOspfv3AreaVirtualLink.DeadCounts != nil { + nestedProtocolOspfv3AreaVirtualLink.DeadCounts = oProtocolOspfv3AreaVirtualLink.DeadCounts + } + if oProtocolOspfv3AreaVirtualLink.RetransmitInterval != nil { + nestedProtocolOspfv3AreaVirtualLink.RetransmitInterval = oProtocolOspfv3AreaVirtualLink.RetransmitInterval + } + if oProtocolOspfv3AreaVirtualLink.Authentication != nil { + nestedProtocolOspfv3AreaVirtualLink.Authentication = oProtocolOspfv3AreaVirtualLink.Authentication + } + if oProtocolOspfv3AreaVirtualLink.Bfd != nil { + nestedProtocolOspfv3AreaVirtualLink.Bfd = &ProtocolOspfv3AreaVirtualLinkBfd{} + if oProtocolOspfv3AreaVirtualLink.Bfd.Misc != nil { + entry.Misc["ProtocolOspfv3AreaVirtualLinkBfd"] = oProtocolOspfv3AreaVirtualLink.Bfd.Misc + } + if oProtocolOspfv3AreaVirtualLink.Bfd.Profile != nil { + nestedProtocolOspfv3AreaVirtualLink.Bfd.Profile = oProtocolOspfv3AreaVirtualLink.Bfd.Profile + } + } + if oProtocolOspfv3AreaVirtualLink.Name != "" { + nestedProtocolOspfv3AreaVirtualLink.Name = oProtocolOspfv3AreaVirtualLink.Name + } + if oProtocolOspfv3AreaVirtualLink.NeighborId != nil { + nestedProtocolOspfv3AreaVirtualLink.NeighborId = oProtocolOspfv3AreaVirtualLink.NeighborId + } + if oProtocolOspfv3AreaVirtualLink.InstanceId != nil { + nestedProtocolOspfv3AreaVirtualLink.InstanceId = oProtocolOspfv3AreaVirtualLink.InstanceId + } + if oProtocolOspfv3AreaVirtualLink.HelloInterval != nil { + nestedProtocolOspfv3AreaVirtualLink.HelloInterval = oProtocolOspfv3AreaVirtualLink.HelloInterval + } + if oProtocolOspfv3AreaVirtualLink.TransitAreaId != nil { + nestedProtocolOspfv3AreaVirtualLink.TransitAreaId = oProtocolOspfv3AreaVirtualLink.TransitAreaId + } + if oProtocolOspfv3AreaVirtualLink.Enable != nil { + nestedProtocolOspfv3AreaVirtualLink.Enable = util.AsBool(oProtocolOspfv3AreaVirtualLink.Enable, nil) + } + if oProtocolOspfv3AreaVirtualLink.TransitDelay != nil { + nestedProtocolOspfv3AreaVirtualLink.TransitDelay = oProtocolOspfv3AreaVirtualLink.TransitDelay + } + nestedProtocolOspfv3Area.VirtualLink = append(nestedProtocolOspfv3Area.VirtualLink, nestedProtocolOspfv3AreaVirtualLink) + } + } + nestedProtocol.Ospfv3.Area = append(nestedProtocol.Ospfv3.Area, nestedProtocolOspfv3Area) + } + } + if o.Protocol.Ospfv3.AuthProfile != nil { + nestedProtocol.Ospfv3.AuthProfile = []ProtocolOspfv3AuthProfile{} + for _, oProtocolOspfv3AuthProfile := range o.Protocol.Ospfv3.AuthProfile { + nestedProtocolOspfv3AuthProfile := ProtocolOspfv3AuthProfile{} + if oProtocolOspfv3AuthProfile.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfile"] = oProtocolOspfv3AuthProfile.Misc + } + if oProtocolOspfv3AuthProfile.Spi != nil { + nestedProtocolOspfv3AuthProfile.Spi = oProtocolOspfv3AuthProfile.Spi + } + if oProtocolOspfv3AuthProfile.Name != "" { + nestedProtocolOspfv3AuthProfile.Name = oProtocolOspfv3AuthProfile.Name + } + if oProtocolOspfv3AuthProfile.Esp != nil { + nestedProtocolOspfv3AuthProfile.Esp = &ProtocolOspfv3AuthProfileEsp{} + if oProtocolOspfv3AuthProfile.Esp.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfileEsp"] = oProtocolOspfv3AuthProfile.Esp.Misc + } + if oProtocolOspfv3AuthProfile.Esp.Authentication != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication = &ProtocolOspfv3AuthProfileEspAuthentication{} + if oProtocolOspfv3AuthProfile.Esp.Authentication.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfileEspAuthentication"] = oProtocolOspfv3AuthProfile.Esp.Authentication.Misc + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha384 != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha384 = &ProtocolOspfv3AuthProfileEspAuthenticationSha384{} + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha384.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfileEspAuthenticationSha384"] = oProtocolOspfv3AuthProfile.Esp.Authentication.Sha384.Misc + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha384.Key != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha384.Key = oProtocolOspfv3AuthProfile.Esp.Authentication.Sha384.Key + } + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha512 != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha512 = &ProtocolOspfv3AuthProfileEspAuthenticationSha512{} + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha512.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfileEspAuthenticationSha512"] = oProtocolOspfv3AuthProfile.Esp.Authentication.Sha512.Misc + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha512.Key != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha512.Key = oProtocolOspfv3AuthProfile.Esp.Authentication.Sha512.Key + } + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.None != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.None = &ProtocolOspfv3AuthProfileEspAuthenticationNone{} + if oProtocolOspfv3AuthProfile.Esp.Authentication.None.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfileEspAuthenticationNone"] = oProtocolOspfv3AuthProfile.Esp.Authentication.None.Misc + } + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Md5 != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Md5 = &ProtocolOspfv3AuthProfileEspAuthenticationMd5{} + if oProtocolOspfv3AuthProfile.Esp.Authentication.Md5.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfileEspAuthenticationMd5"] = oProtocolOspfv3AuthProfile.Esp.Authentication.Md5.Misc + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Md5.Key != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Md5.Key = oProtocolOspfv3AuthProfile.Esp.Authentication.Md5.Key + } + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha1 != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha1 = &ProtocolOspfv3AuthProfileEspAuthenticationSha1{} + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha1.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfileEspAuthenticationSha1"] = oProtocolOspfv3AuthProfile.Esp.Authentication.Sha1.Misc + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha1.Key != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha1.Key = oProtocolOspfv3AuthProfile.Esp.Authentication.Sha1.Key + } + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha256 != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha256 = &ProtocolOspfv3AuthProfileEspAuthenticationSha256{} + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha256.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfileEspAuthenticationSha256"] = oProtocolOspfv3AuthProfile.Esp.Authentication.Sha256.Misc + } + if oProtocolOspfv3AuthProfile.Esp.Authentication.Sha256.Key != nil { + nestedProtocolOspfv3AuthProfile.Esp.Authentication.Sha256.Key = oProtocolOspfv3AuthProfile.Esp.Authentication.Sha256.Key + } + } + } + if oProtocolOspfv3AuthProfile.Esp.Encryption != nil { + nestedProtocolOspfv3AuthProfile.Esp.Encryption = &ProtocolOspfv3AuthProfileEspEncryption{} + if oProtocolOspfv3AuthProfile.Esp.Encryption.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfileEspEncryption"] = oProtocolOspfv3AuthProfile.Esp.Encryption.Misc + } + if oProtocolOspfv3AuthProfile.Esp.Encryption.Algorithm != nil { + nestedProtocolOspfv3AuthProfile.Esp.Encryption.Algorithm = oProtocolOspfv3AuthProfile.Esp.Encryption.Algorithm + } + if oProtocolOspfv3AuthProfile.Esp.Encryption.Key != nil { + nestedProtocolOspfv3AuthProfile.Esp.Encryption.Key = oProtocolOspfv3AuthProfile.Esp.Encryption.Key + } + } + } + if oProtocolOspfv3AuthProfile.Ah != nil { + nestedProtocolOspfv3AuthProfile.Ah = &ProtocolOspfv3AuthProfileAh{} + if oProtocolOspfv3AuthProfile.Ah.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfileAh"] = oProtocolOspfv3AuthProfile.Ah.Misc + } + if oProtocolOspfv3AuthProfile.Ah.Md5 != nil { + nestedProtocolOspfv3AuthProfile.Ah.Md5 = &ProtocolOspfv3AuthProfileAhMd5{} + if oProtocolOspfv3AuthProfile.Ah.Md5.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfileAhMd5"] = oProtocolOspfv3AuthProfile.Ah.Md5.Misc + } + if oProtocolOspfv3AuthProfile.Ah.Md5.Key != nil { + nestedProtocolOspfv3AuthProfile.Ah.Md5.Key = oProtocolOspfv3AuthProfile.Ah.Md5.Key + } + } + if oProtocolOspfv3AuthProfile.Ah.Sha1 != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha1 = &ProtocolOspfv3AuthProfileAhSha1{} + if oProtocolOspfv3AuthProfile.Ah.Sha1.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfileAhSha1"] = oProtocolOspfv3AuthProfile.Ah.Sha1.Misc + } + if oProtocolOspfv3AuthProfile.Ah.Sha1.Key != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha1.Key = oProtocolOspfv3AuthProfile.Ah.Sha1.Key + } + } + if oProtocolOspfv3AuthProfile.Ah.Sha256 != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha256 = &ProtocolOspfv3AuthProfileAhSha256{} + if oProtocolOspfv3AuthProfile.Ah.Sha256.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfileAhSha256"] = oProtocolOspfv3AuthProfile.Ah.Sha256.Misc + } + if oProtocolOspfv3AuthProfile.Ah.Sha256.Key != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha256.Key = oProtocolOspfv3AuthProfile.Ah.Sha256.Key + } + } + if oProtocolOspfv3AuthProfile.Ah.Sha384 != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha384 = &ProtocolOspfv3AuthProfileAhSha384{} + if oProtocolOspfv3AuthProfile.Ah.Sha384.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfileAhSha384"] = oProtocolOspfv3AuthProfile.Ah.Sha384.Misc + } + if oProtocolOspfv3AuthProfile.Ah.Sha384.Key != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha384.Key = oProtocolOspfv3AuthProfile.Ah.Sha384.Key + } + } + if oProtocolOspfv3AuthProfile.Ah.Sha512 != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha512 = &ProtocolOspfv3AuthProfileAhSha512{} + if oProtocolOspfv3AuthProfile.Ah.Sha512.Misc != nil { + entry.Misc["ProtocolOspfv3AuthProfileAhSha512"] = oProtocolOspfv3AuthProfile.Ah.Sha512.Misc + } + if oProtocolOspfv3AuthProfile.Ah.Sha512.Key != nil { + nestedProtocolOspfv3AuthProfile.Ah.Sha512.Key = oProtocolOspfv3AuthProfile.Ah.Sha512.Key + } + } + } + nestedProtocol.Ospfv3.AuthProfile = append(nestedProtocol.Ospfv3.AuthProfile, nestedProtocolOspfv3AuthProfile) + } + } + } + if o.Protocol.RedistProfile != nil { + nestedProtocol.RedistProfile = []ProtocolRedistProfile{} + for _, oProtocolRedistProfile := range o.Protocol.RedistProfile { + nestedProtocolRedistProfile := ProtocolRedistProfile{} + if oProtocolRedistProfile.Misc != nil { + entry.Misc["ProtocolRedistProfile"] = oProtocolRedistProfile.Misc + } + if oProtocolRedistProfile.Priority != nil { + nestedProtocolRedistProfile.Priority = oProtocolRedistProfile.Priority + } + if oProtocolRedistProfile.Filter != nil { + nestedProtocolRedistProfile.Filter = &ProtocolRedistProfileFilter{} + if oProtocolRedistProfile.Filter.Misc != nil { + entry.Misc["ProtocolRedistProfileFilter"] = oProtocolRedistProfile.Filter.Misc + } + if oProtocolRedistProfile.Filter.Type != nil { + nestedProtocolRedistProfile.Filter.Type = util.MemToStr(oProtocolRedistProfile.Filter.Type) + } + if oProtocolRedistProfile.Filter.Interface != nil { + nestedProtocolRedistProfile.Filter.Interface = util.MemToStr(oProtocolRedistProfile.Filter.Interface) + } + if oProtocolRedistProfile.Filter.Destination != nil { + nestedProtocolRedistProfile.Filter.Destination = util.MemToStr(oProtocolRedistProfile.Filter.Destination) + } + if oProtocolRedistProfile.Filter.Nexthop != nil { + nestedProtocolRedistProfile.Filter.Nexthop = util.MemToStr(oProtocolRedistProfile.Filter.Nexthop) + } + if oProtocolRedistProfile.Filter.Ospf != nil { + nestedProtocolRedistProfile.Filter.Ospf = &ProtocolRedistProfileFilterOspf{} + if oProtocolRedistProfile.Filter.Ospf.Misc != nil { + entry.Misc["ProtocolRedistProfileFilterOspf"] = oProtocolRedistProfile.Filter.Ospf.Misc + } + if oProtocolRedistProfile.Filter.Ospf.PathType != nil { + nestedProtocolRedistProfile.Filter.Ospf.PathType = util.MemToStr(oProtocolRedistProfile.Filter.Ospf.PathType) + } + if oProtocolRedistProfile.Filter.Ospf.Area != nil { + nestedProtocolRedistProfile.Filter.Ospf.Area = util.MemToStr(oProtocolRedistProfile.Filter.Ospf.Area) + } + if oProtocolRedistProfile.Filter.Ospf.Tag != nil { + nestedProtocolRedistProfile.Filter.Ospf.Tag = util.MemToStr(oProtocolRedistProfile.Filter.Ospf.Tag) + } + } + if oProtocolRedistProfile.Filter.Bgp != nil { + nestedProtocolRedistProfile.Filter.Bgp = &ProtocolRedistProfileFilterBgp{} + if oProtocolRedistProfile.Filter.Bgp.Misc != nil { + entry.Misc["ProtocolRedistProfileFilterBgp"] = oProtocolRedistProfile.Filter.Bgp.Misc + } + if oProtocolRedistProfile.Filter.Bgp.Community != nil { + nestedProtocolRedistProfile.Filter.Bgp.Community = util.MemToStr(oProtocolRedistProfile.Filter.Bgp.Community) + } + if oProtocolRedistProfile.Filter.Bgp.ExtendedCommunity != nil { + nestedProtocolRedistProfile.Filter.Bgp.ExtendedCommunity = util.MemToStr(oProtocolRedistProfile.Filter.Bgp.ExtendedCommunity) + } + } + } + if oProtocolRedistProfile.Action != nil { + nestedProtocolRedistProfile.Action = &ProtocolRedistProfileAction{} + if oProtocolRedistProfile.Action.Misc != nil { + entry.Misc["ProtocolRedistProfileAction"] = oProtocolRedistProfile.Action.Misc + } + if oProtocolRedistProfile.Action.NoRedist != nil { + nestedProtocolRedistProfile.Action.NoRedist = &ProtocolRedistProfileActionNoRedist{} + if oProtocolRedistProfile.Action.NoRedist.Misc != nil { + entry.Misc["ProtocolRedistProfileActionNoRedist"] = oProtocolRedistProfile.Action.NoRedist.Misc + } + } + if oProtocolRedistProfile.Action.Redist != nil { + nestedProtocolRedistProfile.Action.Redist = &ProtocolRedistProfileActionRedist{} + if oProtocolRedistProfile.Action.Redist.Misc != nil { + entry.Misc["ProtocolRedistProfileActionRedist"] = oProtocolRedistProfile.Action.Redist.Misc + } + } + } + if oProtocolRedistProfile.Name != "" { + nestedProtocolRedistProfile.Name = oProtocolRedistProfile.Name + } + nestedProtocol.RedistProfile = append(nestedProtocol.RedistProfile, nestedProtocolRedistProfile) + } + } + if o.Protocol.RedistProfileIpv6 != nil { + nestedProtocol.RedistProfileIpv6 = []ProtocolRedistProfileIpv6{} + for _, oProtocolRedistProfileIpv6 := range o.Protocol.RedistProfileIpv6 { + nestedProtocolRedistProfileIpv6 := ProtocolRedistProfileIpv6{} + if oProtocolRedistProfileIpv6.Misc != nil { + entry.Misc["ProtocolRedistProfileIpv6"] = oProtocolRedistProfileIpv6.Misc + } + if oProtocolRedistProfileIpv6.Filter != nil { + nestedProtocolRedistProfileIpv6.Filter = &ProtocolRedistProfileIpv6Filter{} + if oProtocolRedistProfileIpv6.Filter.Misc != nil { + entry.Misc["ProtocolRedistProfileIpv6Filter"] = oProtocolRedistProfileIpv6.Filter.Misc + } + if oProtocolRedistProfileIpv6.Filter.Bgp != nil { + nestedProtocolRedistProfileIpv6.Filter.Bgp = &ProtocolRedistProfileIpv6FilterBgp{} + if oProtocolRedistProfileIpv6.Filter.Bgp.Misc != nil { + entry.Misc["ProtocolRedistProfileIpv6FilterBgp"] = oProtocolRedistProfileIpv6.Filter.Bgp.Misc + } + if oProtocolRedistProfileIpv6.Filter.Bgp.Community != nil { + nestedProtocolRedistProfileIpv6.Filter.Bgp.Community = util.MemToStr(oProtocolRedistProfileIpv6.Filter.Bgp.Community) + } + if oProtocolRedistProfileIpv6.Filter.Bgp.ExtendedCommunity != nil { + nestedProtocolRedistProfileIpv6.Filter.Bgp.ExtendedCommunity = util.MemToStr(oProtocolRedistProfileIpv6.Filter.Bgp.ExtendedCommunity) + } + } + if oProtocolRedistProfileIpv6.Filter.Type != nil { + nestedProtocolRedistProfileIpv6.Filter.Type = util.MemToStr(oProtocolRedistProfileIpv6.Filter.Type) + } + if oProtocolRedistProfileIpv6.Filter.Interface != nil { + nestedProtocolRedistProfileIpv6.Filter.Interface = util.MemToStr(oProtocolRedistProfileIpv6.Filter.Interface) + } + if oProtocolRedistProfileIpv6.Filter.Destination != nil { + nestedProtocolRedistProfileIpv6.Filter.Destination = util.MemToStr(oProtocolRedistProfileIpv6.Filter.Destination) + } + if oProtocolRedistProfileIpv6.Filter.Nexthop != nil { + nestedProtocolRedistProfileIpv6.Filter.Nexthop = util.MemToStr(oProtocolRedistProfileIpv6.Filter.Nexthop) + } + if oProtocolRedistProfileIpv6.Filter.Ospfv3 != nil { + nestedProtocolRedistProfileIpv6.Filter.Ospfv3 = &ProtocolRedistProfileIpv6FilterOspfv3{} + if oProtocolRedistProfileIpv6.Filter.Ospfv3.Misc != nil { + entry.Misc["ProtocolRedistProfileIpv6FilterOspfv3"] = oProtocolRedistProfileIpv6.Filter.Ospfv3.Misc + } + if oProtocolRedistProfileIpv6.Filter.Ospfv3.Tag != nil { + nestedProtocolRedistProfileIpv6.Filter.Ospfv3.Tag = util.MemToStr(oProtocolRedistProfileIpv6.Filter.Ospfv3.Tag) + } + if oProtocolRedistProfileIpv6.Filter.Ospfv3.PathType != nil { + nestedProtocolRedistProfileIpv6.Filter.Ospfv3.PathType = util.MemToStr(oProtocolRedistProfileIpv6.Filter.Ospfv3.PathType) + } + if oProtocolRedistProfileIpv6.Filter.Ospfv3.Area != nil { + nestedProtocolRedistProfileIpv6.Filter.Ospfv3.Area = util.MemToStr(oProtocolRedistProfileIpv6.Filter.Ospfv3.Area) + } + } + } + if oProtocolRedistProfileIpv6.Action != nil { + nestedProtocolRedistProfileIpv6.Action = &ProtocolRedistProfileIpv6Action{} + if oProtocolRedistProfileIpv6.Action.Misc != nil { + entry.Misc["ProtocolRedistProfileIpv6Action"] = oProtocolRedistProfileIpv6.Action.Misc + } + if oProtocolRedistProfileIpv6.Action.NoRedist != nil { + nestedProtocolRedistProfileIpv6.Action.NoRedist = &ProtocolRedistProfileIpv6ActionNoRedist{} + if oProtocolRedistProfileIpv6.Action.NoRedist.Misc != nil { + entry.Misc["ProtocolRedistProfileIpv6ActionNoRedist"] = oProtocolRedistProfileIpv6.Action.NoRedist.Misc + } + } + if oProtocolRedistProfileIpv6.Action.Redist != nil { + nestedProtocolRedistProfileIpv6.Action.Redist = &ProtocolRedistProfileIpv6ActionRedist{} + if oProtocolRedistProfileIpv6.Action.Redist.Misc != nil { + entry.Misc["ProtocolRedistProfileIpv6ActionRedist"] = oProtocolRedistProfileIpv6.Action.Redist.Misc + } + } + } + if oProtocolRedistProfileIpv6.Name != "" { + nestedProtocolRedistProfileIpv6.Name = oProtocolRedistProfileIpv6.Name + } + if oProtocolRedistProfileIpv6.Priority != nil { + nestedProtocolRedistProfileIpv6.Priority = oProtocolRedistProfileIpv6.Priority + } + nestedProtocol.RedistProfileIpv6 = append(nestedProtocol.RedistProfileIpv6, nestedProtocolRedistProfileIpv6) + } + } + if o.Protocol.Rip != nil { + nestedProtocol.Rip = &ProtocolRip{} + if o.Protocol.Rip.Misc != nil { + entry.Misc["ProtocolRip"] = o.Protocol.Rip.Misc + } + if o.Protocol.Rip.Enable != nil { + nestedProtocol.Rip.Enable = util.AsBool(o.Protocol.Rip.Enable, nil) + } + if o.Protocol.Rip.ExportRules != nil { + nestedProtocol.Rip.ExportRules = []ProtocolRipExportRules{} + for _, oProtocolRipExportRules := range o.Protocol.Rip.ExportRules { + nestedProtocolRipExportRules := ProtocolRipExportRules{} + if oProtocolRipExportRules.Misc != nil { + entry.Misc["ProtocolRipExportRules"] = oProtocolRipExportRules.Misc + } + if oProtocolRipExportRules.Metric != nil { + nestedProtocolRipExportRules.Metric = oProtocolRipExportRules.Metric + } + if oProtocolRipExportRules.Name != "" { + nestedProtocolRipExportRules.Name = oProtocolRipExportRules.Name + } + nestedProtocol.Rip.ExportRules = append(nestedProtocol.Rip.ExportRules, nestedProtocolRipExportRules) + } + } + if o.Protocol.Rip.GlobalBfd != nil { + nestedProtocol.Rip.GlobalBfd = &ProtocolRipGlobalBfd{} + if o.Protocol.Rip.GlobalBfd.Misc != nil { + entry.Misc["ProtocolRipGlobalBfd"] = o.Protocol.Rip.GlobalBfd.Misc + } + if o.Protocol.Rip.GlobalBfd.Profile != nil { + nestedProtocol.Rip.GlobalBfd.Profile = o.Protocol.Rip.GlobalBfd.Profile + } + } + if o.Protocol.Rip.Interface != nil { + nestedProtocol.Rip.Interface = []ProtocolRipInterface{} + for _, oProtocolRipInterface := range o.Protocol.Rip.Interface { + nestedProtocolRipInterface := ProtocolRipInterface{} + if oProtocolRipInterface.Misc != nil { + entry.Misc["ProtocolRipInterface"] = oProtocolRipInterface.Misc + } + if oProtocolRipInterface.Enable != nil { + nestedProtocolRipInterface.Enable = util.AsBool(oProtocolRipInterface.Enable, nil) + } + if oProtocolRipInterface.Authentication != nil { + nestedProtocolRipInterface.Authentication = oProtocolRipInterface.Authentication + } + if oProtocolRipInterface.Mode != nil { + nestedProtocolRipInterface.Mode = oProtocolRipInterface.Mode + } + if oProtocolRipInterface.DefaultRoute != nil { + nestedProtocolRipInterface.DefaultRoute = &ProtocolRipInterfaceDefaultRoute{} + if oProtocolRipInterface.DefaultRoute.Misc != nil { + entry.Misc["ProtocolRipInterfaceDefaultRoute"] = oProtocolRipInterface.DefaultRoute.Misc + } + if oProtocolRipInterface.DefaultRoute.Disable != nil { + nestedProtocolRipInterface.DefaultRoute.Disable = &ProtocolRipInterfaceDefaultRouteDisable{} + if oProtocolRipInterface.DefaultRoute.Disable.Misc != nil { + entry.Misc["ProtocolRipInterfaceDefaultRouteDisable"] = oProtocolRipInterface.DefaultRoute.Disable.Misc + } + } + if oProtocolRipInterface.DefaultRoute.Advertise != nil { + nestedProtocolRipInterface.DefaultRoute.Advertise = &ProtocolRipInterfaceDefaultRouteAdvertise{} + if oProtocolRipInterface.DefaultRoute.Advertise.Misc != nil { + entry.Misc["ProtocolRipInterfaceDefaultRouteAdvertise"] = oProtocolRipInterface.DefaultRoute.Advertise.Misc + } + if oProtocolRipInterface.DefaultRoute.Advertise.Metric != nil { + nestedProtocolRipInterface.DefaultRoute.Advertise.Metric = oProtocolRipInterface.DefaultRoute.Advertise.Metric + } + } + } + if oProtocolRipInterface.Bfd != nil { + nestedProtocolRipInterface.Bfd = &ProtocolRipInterfaceBfd{} + if oProtocolRipInterface.Bfd.Misc != nil { + entry.Misc["ProtocolRipInterfaceBfd"] = oProtocolRipInterface.Bfd.Misc + } + if oProtocolRipInterface.Bfd.Profile != nil { + nestedProtocolRipInterface.Bfd.Profile = oProtocolRipInterface.Bfd.Profile + } + } + if oProtocolRipInterface.Name != "" { + nestedProtocolRipInterface.Name = oProtocolRipInterface.Name + } + nestedProtocol.Rip.Interface = append(nestedProtocol.Rip.Interface, nestedProtocolRipInterface) + } + } + if o.Protocol.Rip.RejectDefaultRoute != nil { + nestedProtocol.Rip.RejectDefaultRoute = util.AsBool(o.Protocol.Rip.RejectDefaultRoute, nil) + } + if o.Protocol.Rip.Timers != nil { + nestedProtocol.Rip.Timers = &ProtocolRipTimers{} + if o.Protocol.Rip.Timers.Misc != nil { + entry.Misc["ProtocolRipTimers"] = o.Protocol.Rip.Timers.Misc + } + if o.Protocol.Rip.Timers.DeleteIntervals != nil { + nestedProtocol.Rip.Timers.DeleteIntervals = o.Protocol.Rip.Timers.DeleteIntervals + } + if o.Protocol.Rip.Timers.ExpireIntervals != nil { + nestedProtocol.Rip.Timers.ExpireIntervals = o.Protocol.Rip.Timers.ExpireIntervals + } + if o.Protocol.Rip.Timers.IntervalSeconds != nil { + nestedProtocol.Rip.Timers.IntervalSeconds = o.Protocol.Rip.Timers.IntervalSeconds + } + if o.Protocol.Rip.Timers.UpdateIntervals != nil { + nestedProtocol.Rip.Timers.UpdateIntervals = o.Protocol.Rip.Timers.UpdateIntervals + } + } + if o.Protocol.Rip.AllowRedistDefaultRoute != nil { + nestedProtocol.Rip.AllowRedistDefaultRoute = util.AsBool(o.Protocol.Rip.AllowRedistDefaultRoute, nil) + } + if o.Protocol.Rip.AuthProfile != nil { + nestedProtocol.Rip.AuthProfile = []ProtocolRipAuthProfile{} + for _, oProtocolRipAuthProfile := range o.Protocol.Rip.AuthProfile { + nestedProtocolRipAuthProfile := ProtocolRipAuthProfile{} + if oProtocolRipAuthProfile.Misc != nil { + entry.Misc["ProtocolRipAuthProfile"] = oProtocolRipAuthProfile.Misc + } + if oProtocolRipAuthProfile.Name != "" { + nestedProtocolRipAuthProfile.Name = oProtocolRipAuthProfile.Name + } + if oProtocolRipAuthProfile.Md5 != nil { + nestedProtocolRipAuthProfile.Md5 = []ProtocolRipAuthProfileMd5{} + for _, oProtocolRipAuthProfileMd5 := range oProtocolRipAuthProfile.Md5 { + nestedProtocolRipAuthProfileMd5 := ProtocolRipAuthProfileMd5{} + if oProtocolRipAuthProfileMd5.Misc != nil { + entry.Misc["ProtocolRipAuthProfileMd5"] = oProtocolRipAuthProfileMd5.Misc + } + if oProtocolRipAuthProfileMd5.Key != nil { + nestedProtocolRipAuthProfileMd5.Key = oProtocolRipAuthProfileMd5.Key + } + if oProtocolRipAuthProfileMd5.Preferred != nil { + nestedProtocolRipAuthProfileMd5.Preferred = util.AsBool(oProtocolRipAuthProfileMd5.Preferred, nil) + } + if oProtocolRipAuthProfileMd5.Name != "" { + nestedProtocolRipAuthProfileMd5.Name = oProtocolRipAuthProfileMd5.Name + } + nestedProtocolRipAuthProfile.Md5 = append(nestedProtocolRipAuthProfile.Md5, nestedProtocolRipAuthProfileMd5) + } + } + if oProtocolRipAuthProfile.Password != nil { + nestedProtocolRipAuthProfile.Password = oProtocolRipAuthProfile.Password + } + nestedProtocol.Rip.AuthProfile = append(nestedProtocol.Rip.AuthProfile, nestedProtocolRipAuthProfile) + } + } + } + if o.Protocol.Bgp != nil { + nestedProtocol.Bgp = &ProtocolBgp{} + if o.Protocol.Bgp.Misc != nil { + entry.Misc["ProtocolBgp"] = o.Protocol.Bgp.Misc + } + if o.Protocol.Bgp.EnforceFirstAs != nil { + nestedProtocol.Bgp.EnforceFirstAs = util.AsBool(o.Protocol.Bgp.EnforceFirstAs, nil) + } + if o.Protocol.Bgp.PeerGroup != nil { + nestedProtocol.Bgp.PeerGroup = []ProtocolBgpPeerGroup{} + for _, oProtocolBgpPeerGroup := range o.Protocol.Bgp.PeerGroup { + nestedProtocolBgpPeerGroup := ProtocolBgpPeerGroup{} + if oProtocolBgpPeerGroup.Misc != nil { + entry.Misc["ProtocolBgpPeerGroup"] = oProtocolBgpPeerGroup.Misc + } + if oProtocolBgpPeerGroup.SoftResetWithStoredInfo != nil { + nestedProtocolBgpPeerGroup.SoftResetWithStoredInfo = util.AsBool(oProtocolBgpPeerGroup.SoftResetWithStoredInfo, nil) + } + if oProtocolBgpPeerGroup.Type != nil { + nestedProtocolBgpPeerGroup.Type = &ProtocolBgpPeerGroupType{} + if oProtocolBgpPeerGroup.Type.Misc != nil { + entry.Misc["ProtocolBgpPeerGroupType"] = oProtocolBgpPeerGroup.Type.Misc + } + if oProtocolBgpPeerGroup.Type.IbgpConfed != nil { + nestedProtocolBgpPeerGroup.Type.IbgpConfed = &ProtocolBgpPeerGroupTypeIbgpConfed{} + if oProtocolBgpPeerGroup.Type.IbgpConfed.Misc != nil { + entry.Misc["ProtocolBgpPeerGroupTypeIbgpConfed"] = oProtocolBgpPeerGroup.Type.IbgpConfed.Misc + } + if oProtocolBgpPeerGroup.Type.IbgpConfed.ExportNexthop != nil { + nestedProtocolBgpPeerGroup.Type.IbgpConfed.ExportNexthop = oProtocolBgpPeerGroup.Type.IbgpConfed.ExportNexthop + } + } + if oProtocolBgpPeerGroup.Type.Ebgp != nil { + nestedProtocolBgpPeerGroup.Type.Ebgp = &ProtocolBgpPeerGroupTypeEbgp{} + if oProtocolBgpPeerGroup.Type.Ebgp.Misc != nil { + entry.Misc["ProtocolBgpPeerGroupTypeEbgp"] = oProtocolBgpPeerGroup.Type.Ebgp.Misc + } + if oProtocolBgpPeerGroup.Type.Ebgp.RemovePrivateAs != nil { + nestedProtocolBgpPeerGroup.Type.Ebgp.RemovePrivateAs = util.AsBool(oProtocolBgpPeerGroup.Type.Ebgp.RemovePrivateAs, nil) + } + if oProtocolBgpPeerGroup.Type.Ebgp.ImportNexthop != nil { + nestedProtocolBgpPeerGroup.Type.Ebgp.ImportNexthop = oProtocolBgpPeerGroup.Type.Ebgp.ImportNexthop + } + if oProtocolBgpPeerGroup.Type.Ebgp.ExportNexthop != nil { + nestedProtocolBgpPeerGroup.Type.Ebgp.ExportNexthop = oProtocolBgpPeerGroup.Type.Ebgp.ExportNexthop + } + } + if oProtocolBgpPeerGroup.Type.Ibgp != nil { + nestedProtocolBgpPeerGroup.Type.Ibgp = &ProtocolBgpPeerGroupTypeIbgp{} + if oProtocolBgpPeerGroup.Type.Ibgp.Misc != nil { + entry.Misc["ProtocolBgpPeerGroupTypeIbgp"] = oProtocolBgpPeerGroup.Type.Ibgp.Misc + } + if oProtocolBgpPeerGroup.Type.Ibgp.ExportNexthop != nil { + nestedProtocolBgpPeerGroup.Type.Ibgp.ExportNexthop = oProtocolBgpPeerGroup.Type.Ibgp.ExportNexthop + } + } + if oProtocolBgpPeerGroup.Type.EbgpConfed != nil { + nestedProtocolBgpPeerGroup.Type.EbgpConfed = &ProtocolBgpPeerGroupTypeEbgpConfed{} + if oProtocolBgpPeerGroup.Type.EbgpConfed.Misc != nil { + entry.Misc["ProtocolBgpPeerGroupTypeEbgpConfed"] = oProtocolBgpPeerGroup.Type.EbgpConfed.Misc + } + if oProtocolBgpPeerGroup.Type.EbgpConfed.ExportNexthop != nil { + nestedProtocolBgpPeerGroup.Type.EbgpConfed.ExportNexthop = oProtocolBgpPeerGroup.Type.EbgpConfed.ExportNexthop + } + } + } + if oProtocolBgpPeerGroup.Peer != nil { + nestedProtocolBgpPeerGroup.Peer = []ProtocolBgpPeerGroupPeer{} + for _, oProtocolBgpPeerGroupPeer := range oProtocolBgpPeerGroup.Peer { + nestedProtocolBgpPeerGroupPeer := ProtocolBgpPeerGroupPeer{} + if oProtocolBgpPeerGroupPeer.Misc != nil { + entry.Misc["ProtocolBgpPeerGroupPeer"] = oProtocolBgpPeerGroupPeer.Misc + } + if oProtocolBgpPeerGroupPeer.EnableSenderSideLoopDetection != nil { + nestedProtocolBgpPeerGroupPeer.EnableSenderSideLoopDetection = util.AsBool(oProtocolBgpPeerGroupPeer.EnableSenderSideLoopDetection, nil) + } + if oProtocolBgpPeerGroupPeer.PeeringType != nil { + nestedProtocolBgpPeerGroupPeer.PeeringType = oProtocolBgpPeerGroupPeer.PeeringType + } + if oProtocolBgpPeerGroupPeer.LocalAddress != nil { + nestedProtocolBgpPeerGroupPeer.LocalAddress = &ProtocolBgpPeerGroupPeerLocalAddress{} + if oProtocolBgpPeerGroupPeer.LocalAddress.Misc != nil { + entry.Misc["ProtocolBgpPeerGroupPeerLocalAddress"] = oProtocolBgpPeerGroupPeer.LocalAddress.Misc + } + if oProtocolBgpPeerGroupPeer.LocalAddress.Interface != nil { + nestedProtocolBgpPeerGroupPeer.LocalAddress.Interface = oProtocolBgpPeerGroupPeer.LocalAddress.Interface + } + if oProtocolBgpPeerGroupPeer.LocalAddress.Ip != nil { + nestedProtocolBgpPeerGroupPeer.LocalAddress.Ip = oProtocolBgpPeerGroupPeer.LocalAddress.Ip + } + } + if oProtocolBgpPeerGroupPeer.Enable != nil { + nestedProtocolBgpPeerGroupPeer.Enable = util.AsBool(oProtocolBgpPeerGroupPeer.Enable, nil) + } + if oProtocolBgpPeerGroupPeer.ReflectorClient != nil { + nestedProtocolBgpPeerGroupPeer.ReflectorClient = oProtocolBgpPeerGroupPeer.ReflectorClient + } + if oProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier != nil { + nestedProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier = &ProtocolBgpPeerGroupPeerSubsequentAddressFamilyIdentifier{} + if oProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier.Misc != nil { + entry.Misc["ProtocolBgpPeerGroupPeerSubsequentAddressFamilyIdentifier"] = oProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier.Misc + } + if oProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier.Unicast != nil { + nestedProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier.Unicast = util.AsBool(oProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier.Unicast, nil) + } + if oProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier.Multicast != nil { + nestedProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier.Multicast = util.AsBool(oProtocolBgpPeerGroupPeer.SubsequentAddressFamilyIdentifier.Multicast, nil) + } + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions = &ProtocolBgpPeerGroupPeerConnectionOptions{} + if oProtocolBgpPeerGroupPeer.ConnectionOptions.Misc != nil { + entry.Misc["ProtocolBgpPeerGroupPeerConnectionOptions"] = oProtocolBgpPeerGroupPeer.ConnectionOptions.Misc + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection = &ProtocolBgpPeerGroupPeerConnectionOptionsOutgoingBgpConnection{} + if oProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection.Misc != nil { + entry.Misc["ProtocolBgpPeerGroupPeerConnectionOptionsOutgoingBgpConnection"] = oProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection.Misc + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection.LocalPort != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection.LocalPort = oProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection.LocalPort + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection.Allow != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection.Allow = util.AsBool(oProtocolBgpPeerGroupPeer.ConnectionOptions.OutgoingBgpConnection.Allow, nil) + } + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.Authentication != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.Authentication = oProtocolBgpPeerGroupPeer.ConnectionOptions.Authentication + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.MinRouteAdvInterval != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.MinRouteAdvInterval = oProtocolBgpPeerGroupPeer.ConnectionOptions.MinRouteAdvInterval + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.Multihop != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.Multihop = oProtocolBgpPeerGroupPeer.ConnectionOptions.Multihop + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.OpenDelayTime != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.OpenDelayTime = oProtocolBgpPeerGroupPeer.ConnectionOptions.OpenDelayTime + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.KeepAliveInterval != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.KeepAliveInterval = oProtocolBgpPeerGroupPeer.ConnectionOptions.KeepAliveInterval + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.HoldTime != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.HoldTime = oProtocolBgpPeerGroupPeer.ConnectionOptions.HoldTime + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.IdleHoldTime != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.IdleHoldTime = oProtocolBgpPeerGroupPeer.ConnectionOptions.IdleHoldTime + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection = &ProtocolBgpPeerGroupPeerConnectionOptionsIncomingBgpConnection{} + if oProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection.Misc != nil { + entry.Misc["ProtocolBgpPeerGroupPeerConnectionOptionsIncomingBgpConnection"] = oProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection.Misc + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection.RemotePort != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection.RemotePort = oProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection.RemotePort + } + if oProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection.Allow != nil { + nestedProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection.Allow = util.AsBool(oProtocolBgpPeerGroupPeer.ConnectionOptions.IncomingBgpConnection.Allow, nil) + } + } + } + if oProtocolBgpPeerGroupPeer.PeerAs != nil { + nestedProtocolBgpPeerGroupPeer.PeerAs = oProtocolBgpPeerGroupPeer.PeerAs + } + if oProtocolBgpPeerGroupPeer.AddressFamilyIdentifier != nil { + nestedProtocolBgpPeerGroupPeer.AddressFamilyIdentifier = oProtocolBgpPeerGroupPeer.AddressFamilyIdentifier + } + if oProtocolBgpPeerGroupPeer.EnableMpBgp != nil { + nestedProtocolBgpPeerGroupPeer.EnableMpBgp = util.AsBool(oProtocolBgpPeerGroupPeer.EnableMpBgp, nil) + } + if oProtocolBgpPeerGroupPeer.PeerAddress != nil { + nestedProtocolBgpPeerGroupPeer.PeerAddress = &ProtocolBgpPeerGroupPeerPeerAddress{} + if oProtocolBgpPeerGroupPeer.PeerAddress.Misc != nil { + entry.Misc["ProtocolBgpPeerGroupPeerPeerAddress"] = oProtocolBgpPeerGroupPeer.PeerAddress.Misc + } + if oProtocolBgpPeerGroupPeer.PeerAddress.Ip != nil { + nestedProtocolBgpPeerGroupPeer.PeerAddress.Ip = oProtocolBgpPeerGroupPeer.PeerAddress.Ip + } + if oProtocolBgpPeerGroupPeer.PeerAddress.Fqdn != nil { + nestedProtocolBgpPeerGroupPeer.PeerAddress.Fqdn = oProtocolBgpPeerGroupPeer.PeerAddress.Fqdn + } + } + if oProtocolBgpPeerGroupPeer.Bfd != nil { + nestedProtocolBgpPeerGroupPeer.Bfd = &ProtocolBgpPeerGroupPeerBfd{} + if oProtocolBgpPeerGroupPeer.Bfd.Misc != nil { + entry.Misc["ProtocolBgpPeerGroupPeerBfd"] = oProtocolBgpPeerGroupPeer.Bfd.Misc + } + if oProtocolBgpPeerGroupPeer.Bfd.Profile != nil { + nestedProtocolBgpPeerGroupPeer.Bfd.Profile = oProtocolBgpPeerGroupPeer.Bfd.Profile + } + } + if oProtocolBgpPeerGroupPeer.Name != "" { + nestedProtocolBgpPeerGroupPeer.Name = oProtocolBgpPeerGroupPeer.Name + } + if oProtocolBgpPeerGroupPeer.MaxPrefixes != nil { + nestedProtocolBgpPeerGroupPeer.MaxPrefixes = oProtocolBgpPeerGroupPeer.MaxPrefixes + } + nestedProtocolBgpPeerGroup.Peer = append(nestedProtocolBgpPeerGroup.Peer, nestedProtocolBgpPeerGroupPeer) + } + } + if oProtocolBgpPeerGroup.Name != "" { + nestedProtocolBgpPeerGroup.Name = oProtocolBgpPeerGroup.Name + } + if oProtocolBgpPeerGroup.Enable != nil { + nestedProtocolBgpPeerGroup.Enable = util.AsBool(oProtocolBgpPeerGroup.Enable, nil) + } + if oProtocolBgpPeerGroup.AggregatedConfedAsPath != nil { + nestedProtocolBgpPeerGroup.AggregatedConfedAsPath = util.AsBool(oProtocolBgpPeerGroup.AggregatedConfedAsPath, nil) + } + nestedProtocol.Bgp.PeerGroup = append(nestedProtocol.Bgp.PeerGroup, nestedProtocolBgpPeerGroup) + } + } + if o.Protocol.Bgp.RedistRules != nil { + nestedProtocol.Bgp.RedistRules = []ProtocolBgpRedistRules{} + for _, oProtocolBgpRedistRules := range o.Protocol.Bgp.RedistRules { + nestedProtocolBgpRedistRules := ProtocolBgpRedistRules{} + if oProtocolBgpRedistRules.Misc != nil { + entry.Misc["ProtocolBgpRedistRules"] = oProtocolBgpRedistRules.Misc + } + if oProtocolBgpRedistRules.SetAsPathLimit != nil { + nestedProtocolBgpRedistRules.SetAsPathLimit = oProtocolBgpRedistRules.SetAsPathLimit + } + if oProtocolBgpRedistRules.Metric != nil { + nestedProtocolBgpRedistRules.Metric = oProtocolBgpRedistRules.Metric + } + if oProtocolBgpRedistRules.SetCommunity != nil { + nestedProtocolBgpRedistRules.SetCommunity = util.MemToStr(oProtocolBgpRedistRules.SetCommunity) + } + if oProtocolBgpRedistRules.RouteTable != nil { + nestedProtocolBgpRedistRules.RouteTable = oProtocolBgpRedistRules.RouteTable + } + if oProtocolBgpRedistRules.Enable != nil { + nestedProtocolBgpRedistRules.Enable = util.AsBool(oProtocolBgpRedistRules.Enable, nil) + } + if oProtocolBgpRedistRules.SetMed != nil { + nestedProtocolBgpRedistRules.SetMed = oProtocolBgpRedistRules.SetMed + } + if oProtocolBgpRedistRules.SetLocalPreference != nil { + nestedProtocolBgpRedistRules.SetLocalPreference = oProtocolBgpRedistRules.SetLocalPreference + } + if oProtocolBgpRedistRules.AddressFamilyIdentifier != nil { + nestedProtocolBgpRedistRules.AddressFamilyIdentifier = oProtocolBgpRedistRules.AddressFamilyIdentifier + } + if oProtocolBgpRedistRules.SetOrigin != nil { + nestedProtocolBgpRedistRules.SetOrigin = oProtocolBgpRedistRules.SetOrigin + } + if oProtocolBgpRedistRules.SetExtendedCommunity != nil { + nestedProtocolBgpRedistRules.SetExtendedCommunity = util.MemToStr(oProtocolBgpRedistRules.SetExtendedCommunity) + } + if oProtocolBgpRedistRules.Name != "" { + nestedProtocolBgpRedistRules.Name = oProtocolBgpRedistRules.Name + } + nestedProtocol.Bgp.RedistRules = append(nestedProtocol.Bgp.RedistRules, nestedProtocolBgpRedistRules) + } + } + if o.Protocol.Bgp.RejectDefaultRoute != nil { + nestedProtocol.Bgp.RejectDefaultRoute = util.AsBool(o.Protocol.Bgp.RejectDefaultRoute, nil) + } + if o.Protocol.Bgp.DampeningProfile != nil { + nestedProtocol.Bgp.DampeningProfile = []ProtocolBgpDampeningProfile{} + for _, oProtocolBgpDampeningProfile := range o.Protocol.Bgp.DampeningProfile { + nestedProtocolBgpDampeningProfile := ProtocolBgpDampeningProfile{} + if oProtocolBgpDampeningProfile.Misc != nil { + entry.Misc["ProtocolBgpDampeningProfile"] = oProtocolBgpDampeningProfile.Misc + } + if oProtocolBgpDampeningProfile.Enable != nil { + nestedProtocolBgpDampeningProfile.Enable = util.AsBool(oProtocolBgpDampeningProfile.Enable, nil) + } + if oProtocolBgpDampeningProfile.Cutoff != nil { + nestedProtocolBgpDampeningProfile.Cutoff = oProtocolBgpDampeningProfile.Cutoff + } + if oProtocolBgpDampeningProfile.Reuse != nil { + nestedProtocolBgpDampeningProfile.Reuse = oProtocolBgpDampeningProfile.Reuse + } + if oProtocolBgpDampeningProfile.MaxHoldTime != nil { + nestedProtocolBgpDampeningProfile.MaxHoldTime = oProtocolBgpDampeningProfile.MaxHoldTime + } + if oProtocolBgpDampeningProfile.DecayHalfLifeReachable != nil { + nestedProtocolBgpDampeningProfile.DecayHalfLifeReachable = oProtocolBgpDampeningProfile.DecayHalfLifeReachable + } + if oProtocolBgpDampeningProfile.DecayHalfLifeUnreachable != nil { + nestedProtocolBgpDampeningProfile.DecayHalfLifeUnreachable = oProtocolBgpDampeningProfile.DecayHalfLifeUnreachable + } + if oProtocolBgpDampeningProfile.Name != "" { + nestedProtocolBgpDampeningProfile.Name = oProtocolBgpDampeningProfile.Name + } + nestedProtocol.Bgp.DampeningProfile = append(nestedProtocol.Bgp.DampeningProfile, nestedProtocolBgpDampeningProfile) + } + } + if o.Protocol.Bgp.Policy != nil { + nestedProtocol.Bgp.Policy = &ProtocolBgpPolicy{} + if o.Protocol.Bgp.Policy.Misc != nil { + entry.Misc["ProtocolBgpPolicy"] = o.Protocol.Bgp.Policy.Misc + } + if o.Protocol.Bgp.Policy.Aggregation != nil { + nestedProtocol.Bgp.Policy.Aggregation = &ProtocolBgpPolicyAggregation{} + if o.Protocol.Bgp.Policy.Aggregation.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregation"] = o.Protocol.Bgp.Policy.Aggregation.Misc + } + if o.Protocol.Bgp.Policy.Aggregation.Address != nil { + nestedProtocol.Bgp.Policy.Aggregation.Address = []ProtocolBgpPolicyAggregationAddress{} + for _, oProtocolBgpPolicyAggregationAddress := range o.Protocol.Bgp.Policy.Aggregation.Address { + nestedProtocolBgpPolicyAggregationAddress := ProtocolBgpPolicyAggregationAddress{} + if oProtocolBgpPolicyAggregationAddress.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddress"] = oProtocolBgpPolicyAggregationAddress.Misc + } + if oProtocolBgpPolicyAggregationAddress.Prefix != nil { + nestedProtocolBgpPolicyAggregationAddress.Prefix = oProtocolBgpPolicyAggregationAddress.Prefix + } + if oProtocolBgpPolicyAggregationAddress.Enable != nil { + nestedProtocolBgpPolicyAggregationAddress.Enable = util.AsBool(oProtocolBgpPolicyAggregationAddress.Enable, nil) + } + if oProtocolBgpPolicyAggregationAddress.Summary != nil { + nestedProtocolBgpPolicyAggregationAddress.Summary = util.AsBool(oProtocolBgpPolicyAggregationAddress.Summary, nil) + } + if oProtocolBgpPolicyAggregationAddress.AsSet != nil { + nestedProtocolBgpPolicyAggregationAddress.AsSet = util.AsBool(oProtocolBgpPolicyAggregationAddress.AsSet, nil) + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributes{} + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributes"] = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Misc + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPath{} + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPath"] = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Misc + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.None != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.None = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathNone{} + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.None.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathNone"] = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.None.Misc + } + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Remove != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Remove = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathRemove{} + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Remove.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathRemove"] = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Remove.Misc + } + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Prepend != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Prepend = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPath.Prepend + } + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunity{} + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunity"] = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.Misc + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.None != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.None = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityNone{} + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.None.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityNone"] = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.None.Misc + } + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.RemoveAll != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.RemoveAll = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityRemoveAll{} + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.RemoveAll.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityRemoveAll"] = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.RemoveAll.Misc + } + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.RemoveRegex != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.RemoveRegex = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.RemoveRegex + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.Append != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.Append = util.MemToStr(oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.Append) + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.Overwrite != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.Overwrite = util.MemToStr(oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Community.Overwrite) + } + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.LocalPreference != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.LocalPreference = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.LocalPreference + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Med != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Med = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Med + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Weight != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Weight = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Weight + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Nexthop != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Nexthop = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Nexthop + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Origin != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Origin = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.Origin + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPathLimit != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPathLimit = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.AsPathLimit + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunity{} + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunity"] = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.Misc + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.None != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.None = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityNone{} + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.None.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityNone"] = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.None.Misc + } + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.RemoveAll != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.RemoveAll = &ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityRemoveAll{} + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.RemoveAll.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityRemoveAll"] = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.RemoveAll.Misc + } + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.RemoveRegex != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.RemoveRegex = oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.RemoveRegex + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.Append != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.Append = util.MemToStr(oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.Append) + } + if oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.Overwrite != nil { + nestedProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.Overwrite = util.MemToStr(oProtocolBgpPolicyAggregationAddress.AggregateRouteAttributes.ExtendedCommunity.Overwrite) + } + } + } + if oProtocolBgpPolicyAggregationAddress.SuppressFilters != nil { + nestedProtocolBgpPolicyAggregationAddress.SuppressFilters = []ProtocolBgpPolicyAggregationAddressSuppressFilters{} + for _, oProtocolBgpPolicyAggregationAddressSuppressFilters := range oProtocolBgpPolicyAggregationAddress.SuppressFilters { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters := ProtocolBgpPolicyAggregationAddressSuppressFilters{} + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressSuppressFilters"] = oProtocolBgpPolicyAggregationAddressSuppressFilters.Misc + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Enable != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Enable = util.AsBool(oProtocolBgpPolicyAggregationAddressSuppressFilters.Enable, nil) + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match = &ProtocolBgpPolicyAggregationAddressSuppressFiltersMatch{} + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressSuppressFiltersMatch"] = oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Misc + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Community != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Community = &ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchCommunity{} + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Community.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchCommunity"] = oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Community.Misc + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Community.Regex != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Community.Regex = oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Community.Regex + } + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.ExtendedCommunity != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.ExtendedCommunity = &ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchExtendedCommunity{} + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.ExtendedCommunity.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchExtendedCommunity"] = oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.ExtendedCommunity.Misc + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.ExtendedCommunity.Regex != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.ExtendedCommunity.Regex = oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.ExtendedCommunity.Regex + } + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.RouteTable != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.RouteTable = oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.RouteTable + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Med != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Med = oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Med + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AddressPrefix != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AddressPrefix = []ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix{} + for _, oProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix := range oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AddressPrefix { + nestedProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix := ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix{} + if oProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix"] = oProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix.Misc + } + if oProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix.Exact != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix.Exact = util.AsBool(oProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix.Exact, nil) + } + if oProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix.Name != "" { + nestedProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix.Name = oProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix.Name + } + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AddressPrefix = append(nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AddressPrefix, nestedProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix) + } + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Nexthop != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Nexthop = util.MemToStr(oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.Nexthop) + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.FromPeer != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.FromPeer = util.MemToStr(oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.FromPeer) + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AsPath != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AsPath = &ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAsPath{} + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AsPath.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAsPath"] = oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AsPath.Misc + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AsPath.Regex != nil { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AsPath.Regex = oProtocolBgpPolicyAggregationAddressSuppressFilters.Match.AsPath.Regex + } + } + } + if oProtocolBgpPolicyAggregationAddressSuppressFilters.Name != "" { + nestedProtocolBgpPolicyAggregationAddressSuppressFilters.Name = oProtocolBgpPolicyAggregationAddressSuppressFilters.Name + } + nestedProtocolBgpPolicyAggregationAddress.SuppressFilters = append(nestedProtocolBgpPolicyAggregationAddress.SuppressFilters, nestedProtocolBgpPolicyAggregationAddressSuppressFilters) + } + } + if oProtocolBgpPolicyAggregationAddress.AdvertiseFilters != nil { + nestedProtocolBgpPolicyAggregationAddress.AdvertiseFilters = []ProtocolBgpPolicyAggregationAddressAdvertiseFilters{} + for _, oProtocolBgpPolicyAggregationAddressAdvertiseFilters := range oProtocolBgpPolicyAggregationAddress.AdvertiseFilters { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters := ProtocolBgpPolicyAggregationAddressAdvertiseFilters{} + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFilters"] = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Misc + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Enable != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Enable = util.AsBool(oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Enable, nil) + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match = &ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatch{} + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatch"] = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Misc + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Med != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Med = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Med + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AddressPrefix != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AddressPrefix = []ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix{} + for _, oProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix := range oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AddressPrefix { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix := ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix{} + if oProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix"] = oProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix.Misc + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix.Exact != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix.Exact = util.AsBool(oProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix.Exact, nil) + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix.Name != "" { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix.Name = oProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix.Name + } + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AddressPrefix = append(nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AddressPrefix, nestedProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix) + } + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Nexthop != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Nexthop = util.MemToStr(oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Nexthop) + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.FromPeer != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.FromPeer = util.MemToStr(oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.FromPeer) + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AsPath != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AsPath = &ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAsPath{} + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AsPath.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAsPath"] = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AsPath.Misc + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AsPath.Regex != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AsPath.Regex = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.AsPath.Regex + } + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Community != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Community = &ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchCommunity{} + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Community.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchCommunity"] = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Community.Misc + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Community.Regex != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Community.Regex = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.Community.Regex + } + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.ExtendedCommunity != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.ExtendedCommunity = &ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchExtendedCommunity{} + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.ExtendedCommunity.Misc != nil { + entry.Misc["ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchExtendedCommunity"] = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.ExtendedCommunity.Misc + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.ExtendedCommunity.Regex != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.ExtendedCommunity.Regex = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.ExtendedCommunity.Regex + } + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.RouteTable != nil { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.RouteTable = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Match.RouteTable + } + } + if oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Name != "" { + nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters.Name = oProtocolBgpPolicyAggregationAddressAdvertiseFilters.Name + } + nestedProtocolBgpPolicyAggregationAddress.AdvertiseFilters = append(nestedProtocolBgpPolicyAggregationAddress.AdvertiseFilters, nestedProtocolBgpPolicyAggregationAddressAdvertiseFilters) + } + } + if oProtocolBgpPolicyAggregationAddress.Name != "" { + nestedProtocolBgpPolicyAggregationAddress.Name = oProtocolBgpPolicyAggregationAddress.Name + } + nestedProtocol.Bgp.Policy.Aggregation.Address = append(nestedProtocol.Bgp.Policy.Aggregation.Address, nestedProtocolBgpPolicyAggregationAddress) + } + } + } + if o.Protocol.Bgp.Policy.ConditionalAdvertisement != nil { + nestedProtocol.Bgp.Policy.ConditionalAdvertisement = &ProtocolBgpPolicyConditionalAdvertisement{} + if o.Protocol.Bgp.Policy.ConditionalAdvertisement.Misc != nil { + entry.Misc["ProtocolBgpPolicyConditionalAdvertisement"] = o.Protocol.Bgp.Policy.ConditionalAdvertisement.Misc + } + if o.Protocol.Bgp.Policy.ConditionalAdvertisement.Policy != nil { + nestedProtocol.Bgp.Policy.ConditionalAdvertisement.Policy = []ProtocolBgpPolicyConditionalAdvertisementPolicy{} + for _, oProtocolBgpPolicyConditionalAdvertisementPolicy := range o.Protocol.Bgp.Policy.ConditionalAdvertisement.Policy { + nestedProtocolBgpPolicyConditionalAdvertisementPolicy := ProtocolBgpPolicyConditionalAdvertisementPolicy{} + if oProtocolBgpPolicyConditionalAdvertisementPolicy.Misc != nil { + entry.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicy"] = oProtocolBgpPolicyConditionalAdvertisementPolicy.Misc + } + if oProtocolBgpPolicyConditionalAdvertisementPolicy.AdvertiseFilters != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicy.AdvertiseFilters = []ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters{} + for _, oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters := range oProtocolBgpPolicyConditionalAdvertisementPolicy.AdvertiseFilters { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters := ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters{} + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Misc != nil { + entry.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters"] = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Misc + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Name != "" { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Name = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Name + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Enable != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Enable = util.AsBool(oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Enable, nil) + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match = &ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatch{} + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Misc != nil { + entry.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatch"] = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Misc + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AsPath != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AsPath = &ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAsPath{} + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AsPath.Misc != nil { + entry.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAsPath"] = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AsPath.Misc + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AsPath.Regex != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AsPath.Regex = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AsPath.Regex + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Community != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Community = &ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchCommunity{} + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Community.Misc != nil { + entry.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchCommunity"] = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Community.Misc + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Community.Regex != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Community.Regex = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Community.Regex + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.ExtendedCommunity != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.ExtendedCommunity = &ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchExtendedCommunity{} + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.ExtendedCommunity.Misc != nil { + entry.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchExtendedCommunity"] = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.ExtendedCommunity.Misc + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.ExtendedCommunity.Regex != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.ExtendedCommunity.Regex = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.ExtendedCommunity.Regex + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.RouteTable != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.RouteTable = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.RouteTable + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Med != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Med = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Med + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AddressPrefix != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AddressPrefix = []ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix{} + for _, oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix := range oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AddressPrefix { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix := ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix{} + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix.Misc != nil { + entry.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix"] = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix.Misc + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix.Name != "" { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix.Name = oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix.Name + } + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AddressPrefix = append(nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.AddressPrefix, nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix) + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Nexthop != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Nexthop = util.MemToStr(oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.Nexthop) + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.FromPeer != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.FromPeer = util.MemToStr(oProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters.Match.FromPeer) + } + } + nestedProtocolBgpPolicyConditionalAdvertisementPolicy.AdvertiseFilters = append(nestedProtocolBgpPolicyConditionalAdvertisementPolicy.AdvertiseFilters, nestedProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters) + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicy.Name != "" { + nestedProtocolBgpPolicyConditionalAdvertisementPolicy.Name = oProtocolBgpPolicyConditionalAdvertisementPolicy.Name + } + if oProtocolBgpPolicyConditionalAdvertisementPolicy.Enable != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicy.Enable = util.AsBool(oProtocolBgpPolicyConditionalAdvertisementPolicy.Enable, nil) + } + if oProtocolBgpPolicyConditionalAdvertisementPolicy.UsedBy != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicy.UsedBy = util.MemToStr(oProtocolBgpPolicyConditionalAdvertisementPolicy.UsedBy) + } + if oProtocolBgpPolicyConditionalAdvertisementPolicy.NonExistFilters != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicy.NonExistFilters = []ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters{} + for _, oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters := range oProtocolBgpPolicyConditionalAdvertisementPolicy.NonExistFilters { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters := ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters{} + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Misc != nil { + entry.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters"] = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Misc + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Enable != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Enable = util.AsBool(oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Enable, nil) + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match = &ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatch{} + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Misc != nil { + entry.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatch"] = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Misc + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.FromPeer != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.FromPeer = util.MemToStr(oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.FromPeer) + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AsPath != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AsPath = &ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAsPath{} + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AsPath.Misc != nil { + entry.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAsPath"] = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AsPath.Misc + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AsPath.Regex != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AsPath.Regex = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AsPath.Regex + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Community != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Community = &ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchCommunity{} + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Community.Misc != nil { + entry.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchCommunity"] = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Community.Misc + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Community.Regex != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Community.Regex = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Community.Regex + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.ExtendedCommunity != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.ExtendedCommunity = &ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchExtendedCommunity{} + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.ExtendedCommunity.Misc != nil { + entry.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchExtendedCommunity"] = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.ExtendedCommunity.Misc + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.ExtendedCommunity.Regex != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.ExtendedCommunity.Regex = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.ExtendedCommunity.Regex + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.RouteTable != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.RouteTable = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.RouteTable + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Med != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Med = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Med + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AddressPrefix != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AddressPrefix = []ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix{} + for _, oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix := range oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AddressPrefix { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix := ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix{} + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix.Misc != nil { + entry.Misc["ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix"] = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix.Misc + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix.Name != "" { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix.Name = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix.Name + } + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AddressPrefix = append(nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.AddressPrefix, nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix) + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Nexthop != nil { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Nexthop = util.MemToStr(oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Match.Nexthop) + } + } + if oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Name != "" { + nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Name = oProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters.Name + } + nestedProtocolBgpPolicyConditionalAdvertisementPolicy.NonExistFilters = append(nestedProtocolBgpPolicyConditionalAdvertisementPolicy.NonExistFilters, nestedProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters) + } + } + nestedProtocol.Bgp.Policy.ConditionalAdvertisement.Policy = append(nestedProtocol.Bgp.Policy.ConditionalAdvertisement.Policy, nestedProtocolBgpPolicyConditionalAdvertisementPolicy) + } + } + } + if o.Protocol.Bgp.Policy.Export != nil { + nestedProtocol.Bgp.Policy.Export = &ProtocolBgpPolicyExport{} + if o.Protocol.Bgp.Policy.Export.Misc != nil { + entry.Misc["ProtocolBgpPolicyExport"] = o.Protocol.Bgp.Policy.Export.Misc + } + if o.Protocol.Bgp.Policy.Export.Rules != nil { + nestedProtocol.Bgp.Policy.Export.Rules = []ProtocolBgpPolicyExportRules{} + for _, oProtocolBgpPolicyExportRules := range o.Protocol.Bgp.Policy.Export.Rules { + nestedProtocolBgpPolicyExportRules := ProtocolBgpPolicyExportRules{} + if oProtocolBgpPolicyExportRules.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRules"] = oProtocolBgpPolicyExportRules.Misc + } + if oProtocolBgpPolicyExportRules.Enable != nil { + nestedProtocolBgpPolicyExportRules.Enable = util.AsBool(oProtocolBgpPolicyExportRules.Enable, nil) + } + if oProtocolBgpPolicyExportRules.UsedBy != nil { + nestedProtocolBgpPolicyExportRules.UsedBy = util.MemToStr(oProtocolBgpPolicyExportRules.UsedBy) + } + if oProtocolBgpPolicyExportRules.Match != nil { + nestedProtocolBgpPolicyExportRules.Match = &ProtocolBgpPolicyExportRulesMatch{} + if oProtocolBgpPolicyExportRules.Match.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesMatch"] = oProtocolBgpPolicyExportRules.Match.Misc + } + if oProtocolBgpPolicyExportRules.Match.Community != nil { + nestedProtocolBgpPolicyExportRules.Match.Community = &ProtocolBgpPolicyExportRulesMatchCommunity{} + if oProtocolBgpPolicyExportRules.Match.Community.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesMatchCommunity"] = oProtocolBgpPolicyExportRules.Match.Community.Misc + } + if oProtocolBgpPolicyExportRules.Match.Community.Regex != nil { + nestedProtocolBgpPolicyExportRules.Match.Community.Regex = oProtocolBgpPolicyExportRules.Match.Community.Regex + } + } + if oProtocolBgpPolicyExportRules.Match.ExtendedCommunity != nil { + nestedProtocolBgpPolicyExportRules.Match.ExtendedCommunity = &ProtocolBgpPolicyExportRulesMatchExtendedCommunity{} + if oProtocolBgpPolicyExportRules.Match.ExtendedCommunity.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesMatchExtendedCommunity"] = oProtocolBgpPolicyExportRules.Match.ExtendedCommunity.Misc + } + if oProtocolBgpPolicyExportRules.Match.ExtendedCommunity.Regex != nil { + nestedProtocolBgpPolicyExportRules.Match.ExtendedCommunity.Regex = oProtocolBgpPolicyExportRules.Match.ExtendedCommunity.Regex + } + } + if oProtocolBgpPolicyExportRules.Match.RouteTable != nil { + nestedProtocolBgpPolicyExportRules.Match.RouteTable = oProtocolBgpPolicyExportRules.Match.RouteTable + } + if oProtocolBgpPolicyExportRules.Match.Med != nil { + nestedProtocolBgpPolicyExportRules.Match.Med = oProtocolBgpPolicyExportRules.Match.Med + } + if oProtocolBgpPolicyExportRules.Match.AddressPrefix != nil { + nestedProtocolBgpPolicyExportRules.Match.AddressPrefix = []ProtocolBgpPolicyExportRulesMatchAddressPrefix{} + for _, oProtocolBgpPolicyExportRulesMatchAddressPrefix := range oProtocolBgpPolicyExportRules.Match.AddressPrefix { + nestedProtocolBgpPolicyExportRulesMatchAddressPrefix := ProtocolBgpPolicyExportRulesMatchAddressPrefix{} + if oProtocolBgpPolicyExportRulesMatchAddressPrefix.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesMatchAddressPrefix"] = oProtocolBgpPolicyExportRulesMatchAddressPrefix.Misc + } + if oProtocolBgpPolicyExportRulesMatchAddressPrefix.Exact != nil { + nestedProtocolBgpPolicyExportRulesMatchAddressPrefix.Exact = util.AsBool(oProtocolBgpPolicyExportRulesMatchAddressPrefix.Exact, nil) + } + if oProtocolBgpPolicyExportRulesMatchAddressPrefix.Name != "" { + nestedProtocolBgpPolicyExportRulesMatchAddressPrefix.Name = oProtocolBgpPolicyExportRulesMatchAddressPrefix.Name + } + nestedProtocolBgpPolicyExportRules.Match.AddressPrefix = append(nestedProtocolBgpPolicyExportRules.Match.AddressPrefix, nestedProtocolBgpPolicyExportRulesMatchAddressPrefix) + } + } + if oProtocolBgpPolicyExportRules.Match.Nexthop != nil { + nestedProtocolBgpPolicyExportRules.Match.Nexthop = util.MemToStr(oProtocolBgpPolicyExportRules.Match.Nexthop) + } + if oProtocolBgpPolicyExportRules.Match.FromPeer != nil { + nestedProtocolBgpPolicyExportRules.Match.FromPeer = util.MemToStr(oProtocolBgpPolicyExportRules.Match.FromPeer) + } + if oProtocolBgpPolicyExportRules.Match.AsPath != nil { + nestedProtocolBgpPolicyExportRules.Match.AsPath = &ProtocolBgpPolicyExportRulesMatchAsPath{} + if oProtocolBgpPolicyExportRules.Match.AsPath.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesMatchAsPath"] = oProtocolBgpPolicyExportRules.Match.AsPath.Misc + } + if oProtocolBgpPolicyExportRules.Match.AsPath.Regex != nil { + nestedProtocolBgpPolicyExportRules.Match.AsPath.Regex = oProtocolBgpPolicyExportRules.Match.AsPath.Regex + } + } + } + if oProtocolBgpPolicyExportRules.Action != nil { + nestedProtocolBgpPolicyExportRules.Action = &ProtocolBgpPolicyExportRulesAction{} + if oProtocolBgpPolicyExportRules.Action.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesAction"] = oProtocolBgpPolicyExportRules.Action.Misc + } + if oProtocolBgpPolicyExportRules.Action.Deny != nil { + nestedProtocolBgpPolicyExportRules.Action.Deny = &ProtocolBgpPolicyExportRulesActionDeny{} + if oProtocolBgpPolicyExportRules.Action.Deny.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesActionDeny"] = oProtocolBgpPolicyExportRules.Action.Deny.Misc + } + } + if oProtocolBgpPolicyExportRules.Action.Allow != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow = &ProtocolBgpPolicyExportRulesActionAllow{} + if oProtocolBgpPolicyExportRules.Action.Allow.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesActionAllow"] = oProtocolBgpPolicyExportRules.Action.Allow.Misc + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update = &ProtocolBgpPolicyExportRulesActionAllowUpdate{} + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdate"] = oProtocolBgpPolicyExportRules.Action.Allow.Update.Misc + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath = &ProtocolBgpPolicyExportRulesActionAllowUpdateAsPath{} + if oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateAsPath"] = oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Misc + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.RemoveAndPrepend != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.RemoveAndPrepend = oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.RemoveAndPrepend + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.None != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.None = &ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathNone{} + if oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.None.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathNone"] = oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.None.Misc + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Remove != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Remove = &ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathRemove{} + if oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Remove.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathRemove"] = oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Remove.Misc + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Prepend != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Prepend = oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPath.Prepend + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Community != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Community = &ProtocolBgpPolicyExportRulesActionAllowUpdateCommunity{} + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateCommunity"] = oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.Misc + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.RemoveAll != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Community.RemoveAll = &ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityRemoveAll{} + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.RemoveAll.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityRemoveAll"] = oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.RemoveAll.Misc + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.RemoveRegex != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Community.RemoveRegex = oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.RemoveRegex + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.Append != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Community.Append = util.MemToStr(oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.Append) + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.Overwrite != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Community.Overwrite = util.MemToStr(oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.Overwrite) + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.None != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Community.None = &ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityNone{} + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.None.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityNone"] = oProtocolBgpPolicyExportRules.Action.Allow.Update.Community.None.Misc + } + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity = &ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunity{} + if oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunity"] = oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.Misc + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.None != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.None = &ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityNone{} + if oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.None.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityNone"] = oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.None.Misc + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.RemoveAll != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.RemoveAll = &ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityRemoveAll{} + if oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.RemoveAll.Misc != nil { + entry.Misc["ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityRemoveAll"] = oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.RemoveAll.Misc + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.RemoveRegex != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.RemoveRegex = oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.RemoveRegex + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.Append != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.Append = util.MemToStr(oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.Append) + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.Overwrite != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.Overwrite = util.MemToStr(oProtocolBgpPolicyExportRules.Action.Allow.Update.ExtendedCommunity.Overwrite) + } + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.LocalPreference != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.LocalPreference = oProtocolBgpPolicyExportRules.Action.Allow.Update.LocalPreference + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Med != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Med = oProtocolBgpPolicyExportRules.Action.Allow.Update.Med + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Nexthop != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Nexthop = oProtocolBgpPolicyExportRules.Action.Allow.Update.Nexthop + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.Origin != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.Origin = oProtocolBgpPolicyExportRules.Action.Allow.Update.Origin + } + if oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPathLimit != nil { + nestedProtocolBgpPolicyExportRules.Action.Allow.Update.AsPathLimit = oProtocolBgpPolicyExportRules.Action.Allow.Update.AsPathLimit + } + } + } + } + if oProtocolBgpPolicyExportRules.Name != "" { + nestedProtocolBgpPolicyExportRules.Name = oProtocolBgpPolicyExportRules.Name + } + nestedProtocol.Bgp.Policy.Export.Rules = append(nestedProtocol.Bgp.Policy.Export.Rules, nestedProtocolBgpPolicyExportRules) + } + } + } + if o.Protocol.Bgp.Policy.Import != nil { + nestedProtocol.Bgp.Policy.Import = &ProtocolBgpPolicyImport{} + if o.Protocol.Bgp.Policy.Import.Misc != nil { + entry.Misc["ProtocolBgpPolicyImport"] = o.Protocol.Bgp.Policy.Import.Misc + } + if o.Protocol.Bgp.Policy.Import.Rules != nil { + nestedProtocol.Bgp.Policy.Import.Rules = []ProtocolBgpPolicyImportRules{} + for _, oProtocolBgpPolicyImportRules := range o.Protocol.Bgp.Policy.Import.Rules { + nestedProtocolBgpPolicyImportRules := ProtocolBgpPolicyImportRules{} + if oProtocolBgpPolicyImportRules.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRules"] = oProtocolBgpPolicyImportRules.Misc + } + if oProtocolBgpPolicyImportRules.Enable != nil { + nestedProtocolBgpPolicyImportRules.Enable = util.AsBool(oProtocolBgpPolicyImportRules.Enable, nil) + } + if oProtocolBgpPolicyImportRules.UsedBy != nil { + nestedProtocolBgpPolicyImportRules.UsedBy = util.MemToStr(oProtocolBgpPolicyImportRules.UsedBy) + } + if oProtocolBgpPolicyImportRules.Match != nil { + nestedProtocolBgpPolicyImportRules.Match = &ProtocolBgpPolicyImportRulesMatch{} + if oProtocolBgpPolicyImportRules.Match.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesMatch"] = oProtocolBgpPolicyImportRules.Match.Misc + } + if oProtocolBgpPolicyImportRules.Match.ExtendedCommunity != nil { + nestedProtocolBgpPolicyImportRules.Match.ExtendedCommunity = &ProtocolBgpPolicyImportRulesMatchExtendedCommunity{} + if oProtocolBgpPolicyImportRules.Match.ExtendedCommunity.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesMatchExtendedCommunity"] = oProtocolBgpPolicyImportRules.Match.ExtendedCommunity.Misc + } + if oProtocolBgpPolicyImportRules.Match.ExtendedCommunity.Regex != nil { + nestedProtocolBgpPolicyImportRules.Match.ExtendedCommunity.Regex = oProtocolBgpPolicyImportRules.Match.ExtendedCommunity.Regex + } + } + if oProtocolBgpPolicyImportRules.Match.RouteTable != nil { + nestedProtocolBgpPolicyImportRules.Match.RouteTable = oProtocolBgpPolicyImportRules.Match.RouteTable + } + if oProtocolBgpPolicyImportRules.Match.Med != nil { + nestedProtocolBgpPolicyImportRules.Match.Med = oProtocolBgpPolicyImportRules.Match.Med + } + if oProtocolBgpPolicyImportRules.Match.AddressPrefix != nil { + nestedProtocolBgpPolicyImportRules.Match.AddressPrefix = []ProtocolBgpPolicyImportRulesMatchAddressPrefix{} + for _, oProtocolBgpPolicyImportRulesMatchAddressPrefix := range oProtocolBgpPolicyImportRules.Match.AddressPrefix { + nestedProtocolBgpPolicyImportRulesMatchAddressPrefix := ProtocolBgpPolicyImportRulesMatchAddressPrefix{} + if oProtocolBgpPolicyImportRulesMatchAddressPrefix.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesMatchAddressPrefix"] = oProtocolBgpPolicyImportRulesMatchAddressPrefix.Misc + } + if oProtocolBgpPolicyImportRulesMatchAddressPrefix.Exact != nil { + nestedProtocolBgpPolicyImportRulesMatchAddressPrefix.Exact = util.AsBool(oProtocolBgpPolicyImportRulesMatchAddressPrefix.Exact, nil) + } + if oProtocolBgpPolicyImportRulesMatchAddressPrefix.Name != "" { + nestedProtocolBgpPolicyImportRulesMatchAddressPrefix.Name = oProtocolBgpPolicyImportRulesMatchAddressPrefix.Name + } + nestedProtocolBgpPolicyImportRules.Match.AddressPrefix = append(nestedProtocolBgpPolicyImportRules.Match.AddressPrefix, nestedProtocolBgpPolicyImportRulesMatchAddressPrefix) + } + } + if oProtocolBgpPolicyImportRules.Match.Nexthop != nil { + nestedProtocolBgpPolicyImportRules.Match.Nexthop = util.MemToStr(oProtocolBgpPolicyImportRules.Match.Nexthop) + } + if oProtocolBgpPolicyImportRules.Match.FromPeer != nil { + nestedProtocolBgpPolicyImportRules.Match.FromPeer = util.MemToStr(oProtocolBgpPolicyImportRules.Match.FromPeer) + } + if oProtocolBgpPolicyImportRules.Match.AsPath != nil { + nestedProtocolBgpPolicyImportRules.Match.AsPath = &ProtocolBgpPolicyImportRulesMatchAsPath{} + if oProtocolBgpPolicyImportRules.Match.AsPath.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesMatchAsPath"] = oProtocolBgpPolicyImportRules.Match.AsPath.Misc + } + if oProtocolBgpPolicyImportRules.Match.AsPath.Regex != nil { + nestedProtocolBgpPolicyImportRules.Match.AsPath.Regex = oProtocolBgpPolicyImportRules.Match.AsPath.Regex + } + } + if oProtocolBgpPolicyImportRules.Match.Community != nil { + nestedProtocolBgpPolicyImportRules.Match.Community = &ProtocolBgpPolicyImportRulesMatchCommunity{} + if oProtocolBgpPolicyImportRules.Match.Community.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesMatchCommunity"] = oProtocolBgpPolicyImportRules.Match.Community.Misc + } + if oProtocolBgpPolicyImportRules.Match.Community.Regex != nil { + nestedProtocolBgpPolicyImportRules.Match.Community.Regex = oProtocolBgpPolicyImportRules.Match.Community.Regex + } + } + } + if oProtocolBgpPolicyImportRules.Action != nil { + nestedProtocolBgpPolicyImportRules.Action = &ProtocolBgpPolicyImportRulesAction{} + if oProtocolBgpPolicyImportRules.Action.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesAction"] = oProtocolBgpPolicyImportRules.Action.Misc + } + if oProtocolBgpPolicyImportRules.Action.Deny != nil { + nestedProtocolBgpPolicyImportRules.Action.Deny = &ProtocolBgpPolicyImportRulesActionDeny{} + if oProtocolBgpPolicyImportRules.Action.Deny.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesActionDeny"] = oProtocolBgpPolicyImportRules.Action.Deny.Misc + } + } + if oProtocolBgpPolicyImportRules.Action.Allow != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow = &ProtocolBgpPolicyImportRulesActionAllow{} + if oProtocolBgpPolicyImportRules.Action.Allow.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesActionAllow"] = oProtocolBgpPolicyImportRules.Action.Allow.Misc + } + if oProtocolBgpPolicyImportRules.Action.Allow.Dampening != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Dampening = oProtocolBgpPolicyImportRules.Action.Allow.Dampening + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update = &ProtocolBgpPolicyImportRulesActionAllowUpdate{} + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdate"] = oProtocolBgpPolicyImportRules.Action.Allow.Update.Misc + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Med != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Med = oProtocolBgpPolicyImportRules.Action.Allow.Update.Med + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Origin != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Origin = oProtocolBgpPolicyImportRules.Action.Allow.Update.Origin + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPathLimit != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.AsPathLimit = oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPathLimit + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Community != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Community = &ProtocolBgpPolicyImportRulesActionAllowUpdateCommunity{} + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateCommunity"] = oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.Misc + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.None != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Community.None = &ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityNone{} + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.None.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityNone"] = oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.None.Misc + } + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.RemoveAll != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Community.RemoveAll = &ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityRemoveAll{} + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.RemoveAll.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityRemoveAll"] = oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.RemoveAll.Misc + } + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.RemoveRegex != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Community.RemoveRegex = oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.RemoveRegex + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.Append != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Community.Append = util.MemToStr(oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.Append) + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.Overwrite != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Community.Overwrite = util.MemToStr(oProtocolBgpPolicyImportRules.Action.Allow.Update.Community.Overwrite) + } + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity = &ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunity{} + if oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunity"] = oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.Misc + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.RemoveAll != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.RemoveAll = &ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityRemoveAll{} + if oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.RemoveAll.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityRemoveAll"] = oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.RemoveAll.Misc + } + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.RemoveRegex != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.RemoveRegex = oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.RemoveRegex + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.Append != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.Append = util.MemToStr(oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.Append) + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.Overwrite != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.Overwrite = util.MemToStr(oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.Overwrite) + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.None != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.None = &ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityNone{} + if oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.None.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityNone"] = oProtocolBgpPolicyImportRules.Action.Allow.Update.ExtendedCommunity.None.Misc + } + } + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.LocalPreference != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.LocalPreference = oProtocolBgpPolicyImportRules.Action.Allow.Update.LocalPreference + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Weight != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Weight = oProtocolBgpPolicyImportRules.Action.Allow.Update.Weight + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.Nexthop != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.Nexthop = oProtocolBgpPolicyImportRules.Action.Allow.Update.Nexthop + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath = &ProtocolBgpPolicyImportRulesActionAllowUpdateAsPath{} + if oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateAsPath"] = oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.Misc + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.None != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.None = &ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathNone{} + if oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.None.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathNone"] = oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.None.Misc + } + } + if oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.Remove != nil { + nestedProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.Remove = &ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathRemove{} + if oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.Remove.Misc != nil { + entry.Misc["ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathRemove"] = oProtocolBgpPolicyImportRules.Action.Allow.Update.AsPath.Remove.Misc + } + } + } + } + } + } + if oProtocolBgpPolicyImportRules.Name != "" { + nestedProtocolBgpPolicyImportRules.Name = oProtocolBgpPolicyImportRules.Name + } + nestedProtocol.Bgp.Policy.Import.Rules = append(nestedProtocol.Bgp.Policy.Import.Rules, nestedProtocolBgpPolicyImportRules) + } + } + } + } + if o.Protocol.Bgp.AuthProfile != nil { + nestedProtocol.Bgp.AuthProfile = []ProtocolBgpAuthProfile{} + for _, oProtocolBgpAuthProfile := range o.Protocol.Bgp.AuthProfile { + nestedProtocolBgpAuthProfile := ProtocolBgpAuthProfile{} + if oProtocolBgpAuthProfile.Misc != nil { + entry.Misc["ProtocolBgpAuthProfile"] = oProtocolBgpAuthProfile.Misc + } + if oProtocolBgpAuthProfile.Secret != nil { + nestedProtocolBgpAuthProfile.Secret = oProtocolBgpAuthProfile.Secret + } + if oProtocolBgpAuthProfile.Name != "" { + nestedProtocolBgpAuthProfile.Name = oProtocolBgpAuthProfile.Name + } + nestedProtocol.Bgp.AuthProfile = append(nestedProtocol.Bgp.AuthProfile, nestedProtocolBgpAuthProfile) + } + } + if o.Protocol.Bgp.Enable != nil { + nestedProtocol.Bgp.Enable = util.AsBool(o.Protocol.Bgp.Enable, nil) + } + if o.Protocol.Bgp.InstallRoute != nil { + nestedProtocol.Bgp.InstallRoute = util.AsBool(o.Protocol.Bgp.InstallRoute, nil) + } + if o.Protocol.Bgp.RoutingOptions != nil { + nestedProtocol.Bgp.RoutingOptions = &ProtocolBgpRoutingOptions{} + if o.Protocol.Bgp.RoutingOptions.Misc != nil { + entry.Misc["ProtocolBgpRoutingOptions"] = o.Protocol.Bgp.RoutingOptions.Misc + } + if o.Protocol.Bgp.RoutingOptions.Med != nil { + nestedProtocol.Bgp.RoutingOptions.Med = &ProtocolBgpRoutingOptionsMed{} + if o.Protocol.Bgp.RoutingOptions.Med.Misc != nil { + entry.Misc["ProtocolBgpRoutingOptionsMed"] = o.Protocol.Bgp.RoutingOptions.Med.Misc + } + if o.Protocol.Bgp.RoutingOptions.Med.AlwaysCompareMed != nil { + nestedProtocol.Bgp.RoutingOptions.Med.AlwaysCompareMed = util.AsBool(o.Protocol.Bgp.RoutingOptions.Med.AlwaysCompareMed, nil) + } + if o.Protocol.Bgp.RoutingOptions.Med.DeterministicMedComparison != nil { + nestedProtocol.Bgp.RoutingOptions.Med.DeterministicMedComparison = util.AsBool(o.Protocol.Bgp.RoutingOptions.Med.DeterministicMedComparison, nil) + } + } + if o.Protocol.Bgp.RoutingOptions.ReflectorClusterId != nil { + nestedProtocol.Bgp.RoutingOptions.ReflectorClusterId = o.Protocol.Bgp.RoutingOptions.ReflectorClusterId + } + if o.Protocol.Bgp.RoutingOptions.Aggregate != nil { + nestedProtocol.Bgp.RoutingOptions.Aggregate = &ProtocolBgpRoutingOptionsAggregate{} + if o.Protocol.Bgp.RoutingOptions.Aggregate.Misc != nil { + entry.Misc["ProtocolBgpRoutingOptionsAggregate"] = o.Protocol.Bgp.RoutingOptions.Aggregate.Misc + } + if o.Protocol.Bgp.RoutingOptions.Aggregate.AggregateMed != nil { + nestedProtocol.Bgp.RoutingOptions.Aggregate.AggregateMed = util.AsBool(o.Protocol.Bgp.RoutingOptions.Aggregate.AggregateMed, nil) + } + } + if o.Protocol.Bgp.RoutingOptions.AsFormat != nil { + nestedProtocol.Bgp.RoutingOptions.AsFormat = o.Protocol.Bgp.RoutingOptions.AsFormat + } + if o.Protocol.Bgp.RoutingOptions.ConfederationMemberAs != nil { + nestedProtocol.Bgp.RoutingOptions.ConfederationMemberAs = o.Protocol.Bgp.RoutingOptions.ConfederationMemberAs + } + if o.Protocol.Bgp.RoutingOptions.DefaultLocalPreference != nil { + nestedProtocol.Bgp.RoutingOptions.DefaultLocalPreference = o.Protocol.Bgp.RoutingOptions.DefaultLocalPreference + } + if o.Protocol.Bgp.RoutingOptions.GracefulRestart != nil { + nestedProtocol.Bgp.RoutingOptions.GracefulRestart = &ProtocolBgpRoutingOptionsGracefulRestart{} + if o.Protocol.Bgp.RoutingOptions.GracefulRestart.Misc != nil { + entry.Misc["ProtocolBgpRoutingOptionsGracefulRestart"] = o.Protocol.Bgp.RoutingOptions.GracefulRestart.Misc + } + if o.Protocol.Bgp.RoutingOptions.GracefulRestart.Enable != nil { + nestedProtocol.Bgp.RoutingOptions.GracefulRestart.Enable = util.AsBool(o.Protocol.Bgp.RoutingOptions.GracefulRestart.Enable, nil) + } + if o.Protocol.Bgp.RoutingOptions.GracefulRestart.LocalRestartTime != nil { + nestedProtocol.Bgp.RoutingOptions.GracefulRestart.LocalRestartTime = o.Protocol.Bgp.RoutingOptions.GracefulRestart.LocalRestartTime + } + if o.Protocol.Bgp.RoutingOptions.GracefulRestart.MaxPeerRestartTime != nil { + nestedProtocol.Bgp.RoutingOptions.GracefulRestart.MaxPeerRestartTime = o.Protocol.Bgp.RoutingOptions.GracefulRestart.MaxPeerRestartTime + } + if o.Protocol.Bgp.RoutingOptions.GracefulRestart.StaleRouteTime != nil { + nestedProtocol.Bgp.RoutingOptions.GracefulRestart.StaleRouteTime = o.Protocol.Bgp.RoutingOptions.GracefulRestart.StaleRouteTime + } + } + } + if o.Protocol.Bgp.AllowRedistDefaultRoute != nil { + nestedProtocol.Bgp.AllowRedistDefaultRoute = util.AsBool(o.Protocol.Bgp.AllowRedistDefaultRoute, nil) + } + if o.Protocol.Bgp.EcmpMultiAs != nil { + nestedProtocol.Bgp.EcmpMultiAs = util.AsBool(o.Protocol.Bgp.EcmpMultiAs, nil) + } + if o.Protocol.Bgp.GlobalBfd != nil { + nestedProtocol.Bgp.GlobalBfd = &ProtocolBgpGlobalBfd{} + if o.Protocol.Bgp.GlobalBfd.Misc != nil { + entry.Misc["ProtocolBgpGlobalBfd"] = o.Protocol.Bgp.GlobalBfd.Misc + } + if o.Protocol.Bgp.GlobalBfd.Profile != nil { + nestedProtocol.Bgp.GlobalBfd.Profile = o.Protocol.Bgp.GlobalBfd.Profile + } + } + if o.Protocol.Bgp.LocalAs != nil { + nestedProtocol.Bgp.LocalAs = o.Protocol.Bgp.LocalAs + } + if o.Protocol.Bgp.RouterId != nil { + nestedProtocol.Bgp.RouterId = o.Protocol.Bgp.RouterId + } + } + if o.Protocol.Ospf != nil { + nestedProtocol.Ospf = &ProtocolOspf{} + if o.Protocol.Ospf.Misc != nil { + entry.Misc["ProtocolOspf"] = o.Protocol.Ospf.Misc + } + if o.Protocol.Ospf.RouterId != nil { + nestedProtocol.Ospf.RouterId = o.Protocol.Ospf.RouterId + } + if o.Protocol.Ospf.Timers != nil { + nestedProtocol.Ospf.Timers = &ProtocolOspfTimers{} + if o.Protocol.Ospf.Timers.Misc != nil { + entry.Misc["ProtocolOspfTimers"] = o.Protocol.Ospf.Timers.Misc + } + if o.Protocol.Ospf.Timers.LsaInterval != nil { + nestedProtocol.Ospf.Timers.LsaInterval = o.Protocol.Ospf.Timers.LsaInterval + } + if o.Protocol.Ospf.Timers.SpfCalculationDelay != nil { + nestedProtocol.Ospf.Timers.SpfCalculationDelay = o.Protocol.Ospf.Timers.SpfCalculationDelay + } + } + if o.Protocol.Ospf.Area != nil { + nestedProtocol.Ospf.Area = []ProtocolOspfArea{} + for _, oProtocolOspfArea := range o.Protocol.Ospf.Area { + nestedProtocolOspfArea := ProtocolOspfArea{} + if oProtocolOspfArea.Misc != nil { + entry.Misc["ProtocolOspfArea"] = oProtocolOspfArea.Misc + } + if oProtocolOspfArea.VirtualLink != nil { + nestedProtocolOspfArea.VirtualLink = []ProtocolOspfAreaVirtualLink{} + for _, oProtocolOspfAreaVirtualLink := range oProtocolOspfArea.VirtualLink { + nestedProtocolOspfAreaVirtualLink := ProtocolOspfAreaVirtualLink{} + if oProtocolOspfAreaVirtualLink.Misc != nil { + entry.Misc["ProtocolOspfAreaVirtualLink"] = oProtocolOspfAreaVirtualLink.Misc + } + if oProtocolOspfAreaVirtualLink.NeighborId != nil { + nestedProtocolOspfAreaVirtualLink.NeighborId = oProtocolOspfAreaVirtualLink.NeighborId + } + if oProtocolOspfAreaVirtualLink.DeadCounts != nil { + nestedProtocolOspfAreaVirtualLink.DeadCounts = oProtocolOspfAreaVirtualLink.DeadCounts + } + if oProtocolOspfAreaVirtualLink.Authentication != nil { + nestedProtocolOspfAreaVirtualLink.Authentication = oProtocolOspfAreaVirtualLink.Authentication + } + if oProtocolOspfAreaVirtualLink.Bfd != nil { + nestedProtocolOspfAreaVirtualLink.Bfd = &ProtocolOspfAreaVirtualLinkBfd{} + if oProtocolOspfAreaVirtualLink.Bfd.Misc != nil { + entry.Misc["ProtocolOspfAreaVirtualLinkBfd"] = oProtocolOspfAreaVirtualLink.Bfd.Misc + } + if oProtocolOspfAreaVirtualLink.Bfd.Profile != nil { + nestedProtocolOspfAreaVirtualLink.Bfd.Profile = oProtocolOspfAreaVirtualLink.Bfd.Profile + } + } + if oProtocolOspfAreaVirtualLink.TransitDelay != nil { + nestedProtocolOspfAreaVirtualLink.TransitDelay = oProtocolOspfAreaVirtualLink.TransitDelay + } + if oProtocolOspfAreaVirtualLink.Name != "" { + nestedProtocolOspfAreaVirtualLink.Name = oProtocolOspfAreaVirtualLink.Name + } + if oProtocolOspfAreaVirtualLink.TransitAreaId != nil { + nestedProtocolOspfAreaVirtualLink.TransitAreaId = oProtocolOspfAreaVirtualLink.TransitAreaId + } + if oProtocolOspfAreaVirtualLink.Enable != nil { + nestedProtocolOspfAreaVirtualLink.Enable = util.AsBool(oProtocolOspfAreaVirtualLink.Enable, nil) + } + if oProtocolOspfAreaVirtualLink.HelloInterval != nil { + nestedProtocolOspfAreaVirtualLink.HelloInterval = oProtocolOspfAreaVirtualLink.HelloInterval + } + if oProtocolOspfAreaVirtualLink.RetransmitInterval != nil { + nestedProtocolOspfAreaVirtualLink.RetransmitInterval = oProtocolOspfAreaVirtualLink.RetransmitInterval + } + nestedProtocolOspfArea.VirtualLink = append(nestedProtocolOspfArea.VirtualLink, nestedProtocolOspfAreaVirtualLink) + } + } + if oProtocolOspfArea.Name != "" { + nestedProtocolOspfArea.Name = oProtocolOspfArea.Name + } + if oProtocolOspfArea.Type != nil { + nestedProtocolOspfArea.Type = &ProtocolOspfAreaType{} + if oProtocolOspfArea.Type.Misc != nil { + entry.Misc["ProtocolOspfAreaType"] = oProtocolOspfArea.Type.Misc + } + if oProtocolOspfArea.Type.Normal != nil { + nestedProtocolOspfArea.Type.Normal = &ProtocolOspfAreaTypeNormal{} + if oProtocolOspfArea.Type.Normal.Misc != nil { + entry.Misc["ProtocolOspfAreaTypeNormal"] = oProtocolOspfArea.Type.Normal.Misc + } + } + if oProtocolOspfArea.Type.Stub != nil { + nestedProtocolOspfArea.Type.Stub = &ProtocolOspfAreaTypeStub{} + if oProtocolOspfArea.Type.Stub.Misc != nil { + entry.Misc["ProtocolOspfAreaTypeStub"] = oProtocolOspfArea.Type.Stub.Misc + } + if oProtocolOspfArea.Type.Stub.DefaultRoute != nil { + nestedProtocolOspfArea.Type.Stub.DefaultRoute = &ProtocolOspfAreaTypeStubDefaultRoute{} + if oProtocolOspfArea.Type.Stub.DefaultRoute.Misc != nil { + entry.Misc["ProtocolOspfAreaTypeStubDefaultRoute"] = oProtocolOspfArea.Type.Stub.DefaultRoute.Misc + } + if oProtocolOspfArea.Type.Stub.DefaultRoute.Disable != nil { + nestedProtocolOspfArea.Type.Stub.DefaultRoute.Disable = &ProtocolOspfAreaTypeStubDefaultRouteDisable{} + if oProtocolOspfArea.Type.Stub.DefaultRoute.Disable.Misc != nil { + entry.Misc["ProtocolOspfAreaTypeStubDefaultRouteDisable"] = oProtocolOspfArea.Type.Stub.DefaultRoute.Disable.Misc + } + } + if oProtocolOspfArea.Type.Stub.DefaultRoute.Advertise != nil { + nestedProtocolOspfArea.Type.Stub.DefaultRoute.Advertise = &ProtocolOspfAreaTypeStubDefaultRouteAdvertise{} + if oProtocolOspfArea.Type.Stub.DefaultRoute.Advertise.Misc != nil { + entry.Misc["ProtocolOspfAreaTypeStubDefaultRouteAdvertise"] = oProtocolOspfArea.Type.Stub.DefaultRoute.Advertise.Misc + } + if oProtocolOspfArea.Type.Stub.DefaultRoute.Advertise.Metric != nil { + nestedProtocolOspfArea.Type.Stub.DefaultRoute.Advertise.Metric = oProtocolOspfArea.Type.Stub.DefaultRoute.Advertise.Metric + } + } + } + if oProtocolOspfArea.Type.Stub.AcceptSummary != nil { + nestedProtocolOspfArea.Type.Stub.AcceptSummary = util.AsBool(oProtocolOspfArea.Type.Stub.AcceptSummary, nil) + } + } + if oProtocolOspfArea.Type.Nssa != nil { + nestedProtocolOspfArea.Type.Nssa = &ProtocolOspfAreaTypeNssa{} + if oProtocolOspfArea.Type.Nssa.Misc != nil { + entry.Misc["ProtocolOspfAreaTypeNssa"] = oProtocolOspfArea.Type.Nssa.Misc + } + if oProtocolOspfArea.Type.Nssa.DefaultRoute != nil { + nestedProtocolOspfArea.Type.Nssa.DefaultRoute = &ProtocolOspfAreaTypeNssaDefaultRoute{} + if oProtocolOspfArea.Type.Nssa.DefaultRoute.Misc != nil { + entry.Misc["ProtocolOspfAreaTypeNssaDefaultRoute"] = oProtocolOspfArea.Type.Nssa.DefaultRoute.Misc + } + if oProtocolOspfArea.Type.Nssa.DefaultRoute.Disable != nil { + nestedProtocolOspfArea.Type.Nssa.DefaultRoute.Disable = &ProtocolOspfAreaTypeNssaDefaultRouteDisable{} + if oProtocolOspfArea.Type.Nssa.DefaultRoute.Disable.Misc != nil { + entry.Misc["ProtocolOspfAreaTypeNssaDefaultRouteDisable"] = oProtocolOspfArea.Type.Nssa.DefaultRoute.Disable.Misc + } + } + if oProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise != nil { + nestedProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise = &ProtocolOspfAreaTypeNssaDefaultRouteAdvertise{} + if oProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise.Misc != nil { + entry.Misc["ProtocolOspfAreaTypeNssaDefaultRouteAdvertise"] = oProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise.Misc + } + if oProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise.Metric != nil { + nestedProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise.Metric = oProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise.Metric + } + if oProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise.Type != nil { + nestedProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise.Type = oProtocolOspfArea.Type.Nssa.DefaultRoute.Advertise.Type + } + } + } + if oProtocolOspfArea.Type.Nssa.NssaExtRange != nil { + nestedProtocolOspfArea.Type.Nssa.NssaExtRange = []ProtocolOspfAreaTypeNssaNssaExtRange{} + for _, oProtocolOspfAreaTypeNssaNssaExtRange := range oProtocolOspfArea.Type.Nssa.NssaExtRange { + nestedProtocolOspfAreaTypeNssaNssaExtRange := ProtocolOspfAreaTypeNssaNssaExtRange{} + if oProtocolOspfAreaTypeNssaNssaExtRange.Misc != nil { + entry.Misc["ProtocolOspfAreaTypeNssaNssaExtRange"] = oProtocolOspfAreaTypeNssaNssaExtRange.Misc + } + if oProtocolOspfAreaTypeNssaNssaExtRange.Name != "" { + nestedProtocolOspfAreaTypeNssaNssaExtRange.Name = oProtocolOspfAreaTypeNssaNssaExtRange.Name + } + if oProtocolOspfAreaTypeNssaNssaExtRange.Advertise != nil { + nestedProtocolOspfAreaTypeNssaNssaExtRange.Advertise = &ProtocolOspfAreaTypeNssaNssaExtRangeAdvertise{} + if oProtocolOspfAreaTypeNssaNssaExtRange.Advertise.Misc != nil { + entry.Misc["ProtocolOspfAreaTypeNssaNssaExtRangeAdvertise"] = oProtocolOspfAreaTypeNssaNssaExtRange.Advertise.Misc + } + } + if oProtocolOspfAreaTypeNssaNssaExtRange.Suppress != nil { + nestedProtocolOspfAreaTypeNssaNssaExtRange.Suppress = &ProtocolOspfAreaTypeNssaNssaExtRangeSuppress{} + if oProtocolOspfAreaTypeNssaNssaExtRange.Suppress.Misc != nil { + entry.Misc["ProtocolOspfAreaTypeNssaNssaExtRangeSuppress"] = oProtocolOspfAreaTypeNssaNssaExtRange.Suppress.Misc + } + } + nestedProtocolOspfArea.Type.Nssa.NssaExtRange = append(nestedProtocolOspfArea.Type.Nssa.NssaExtRange, nestedProtocolOspfAreaTypeNssaNssaExtRange) + } + } + if oProtocolOspfArea.Type.Nssa.AcceptSummary != nil { + nestedProtocolOspfArea.Type.Nssa.AcceptSummary = util.AsBool(oProtocolOspfArea.Type.Nssa.AcceptSummary, nil) + } + } + } + if oProtocolOspfArea.Range != nil { + nestedProtocolOspfArea.Range = []ProtocolOspfAreaRange{} + for _, oProtocolOspfAreaRange := range oProtocolOspfArea.Range { + nestedProtocolOspfAreaRange := ProtocolOspfAreaRange{} + if oProtocolOspfAreaRange.Misc != nil { + entry.Misc["ProtocolOspfAreaRange"] = oProtocolOspfAreaRange.Misc + } + if oProtocolOspfAreaRange.Name != "" { + nestedProtocolOspfAreaRange.Name = oProtocolOspfAreaRange.Name + } + if oProtocolOspfAreaRange.Advertise != nil { + nestedProtocolOspfAreaRange.Advertise = &ProtocolOspfAreaRangeAdvertise{} + if oProtocolOspfAreaRange.Advertise.Misc != nil { + entry.Misc["ProtocolOspfAreaRangeAdvertise"] = oProtocolOspfAreaRange.Advertise.Misc + } + } + if oProtocolOspfAreaRange.Suppress != nil { + nestedProtocolOspfAreaRange.Suppress = &ProtocolOspfAreaRangeSuppress{} + if oProtocolOspfAreaRange.Suppress.Misc != nil { + entry.Misc["ProtocolOspfAreaRangeSuppress"] = oProtocolOspfAreaRange.Suppress.Misc + } + } + nestedProtocolOspfArea.Range = append(nestedProtocolOspfArea.Range, nestedProtocolOspfAreaRange) + } + } + if oProtocolOspfArea.Interface != nil { + nestedProtocolOspfArea.Interface = []ProtocolOspfAreaInterface{} + for _, oProtocolOspfAreaInterface := range oProtocolOspfArea.Interface { + nestedProtocolOspfAreaInterface := ProtocolOspfAreaInterface{} + if oProtocolOspfAreaInterface.Misc != nil { + entry.Misc["ProtocolOspfAreaInterface"] = oProtocolOspfAreaInterface.Misc + } + if oProtocolOspfAreaInterface.DeadCounts != nil { + nestedProtocolOspfAreaInterface.DeadCounts = oProtocolOspfAreaInterface.DeadCounts + } + if oProtocolOspfAreaInterface.Neighbor != nil { + nestedProtocolOspfAreaInterface.Neighbor = []ProtocolOspfAreaInterfaceNeighbor{} + for _, oProtocolOspfAreaInterfaceNeighbor := range oProtocolOspfAreaInterface.Neighbor { + nestedProtocolOspfAreaInterfaceNeighbor := ProtocolOspfAreaInterfaceNeighbor{} + if oProtocolOspfAreaInterfaceNeighbor.Misc != nil { + entry.Misc["ProtocolOspfAreaInterfaceNeighbor"] = oProtocolOspfAreaInterfaceNeighbor.Misc + } + if oProtocolOspfAreaInterfaceNeighbor.Name != "" { + nestedProtocolOspfAreaInterfaceNeighbor.Name = oProtocolOspfAreaInterfaceNeighbor.Name + } + nestedProtocolOspfAreaInterface.Neighbor = append(nestedProtocolOspfAreaInterface.Neighbor, nestedProtocolOspfAreaInterfaceNeighbor) + } + } + if oProtocolOspfAreaInterface.Name != "" { + nestedProtocolOspfAreaInterface.Name = oProtocolOspfAreaInterface.Name + } + if oProtocolOspfAreaInterface.Enable != nil { + nestedProtocolOspfAreaInterface.Enable = util.AsBool(oProtocolOspfAreaInterface.Enable, nil) + } + if oProtocolOspfAreaInterface.RetransmitInterval != nil { + nestedProtocolOspfAreaInterface.RetransmitInterval = oProtocolOspfAreaInterface.RetransmitInterval + } + if oProtocolOspfAreaInterface.LinkType != nil { + nestedProtocolOspfAreaInterface.LinkType = &ProtocolOspfAreaInterfaceLinkType{} + if oProtocolOspfAreaInterface.LinkType.Misc != nil { + entry.Misc["ProtocolOspfAreaInterfaceLinkType"] = oProtocolOspfAreaInterface.LinkType.Misc + } + if oProtocolOspfAreaInterface.LinkType.P2mp != nil { + nestedProtocolOspfAreaInterface.LinkType.P2mp = &ProtocolOspfAreaInterfaceLinkTypeP2mp{} + if oProtocolOspfAreaInterface.LinkType.P2mp.Misc != nil { + entry.Misc["ProtocolOspfAreaInterfaceLinkTypeP2mp"] = oProtocolOspfAreaInterface.LinkType.P2mp.Misc + } + } + if oProtocolOspfAreaInterface.LinkType.Broadcast != nil { + nestedProtocolOspfAreaInterface.LinkType.Broadcast = &ProtocolOspfAreaInterfaceLinkTypeBroadcast{} + if oProtocolOspfAreaInterface.LinkType.Broadcast.Misc != nil { + entry.Misc["ProtocolOspfAreaInterfaceLinkTypeBroadcast"] = oProtocolOspfAreaInterface.LinkType.Broadcast.Misc + } + } + if oProtocolOspfAreaInterface.LinkType.P2p != nil { + nestedProtocolOspfAreaInterface.LinkType.P2p = &ProtocolOspfAreaInterfaceLinkTypeP2p{} + if oProtocolOspfAreaInterface.LinkType.P2p.Misc != nil { + entry.Misc["ProtocolOspfAreaInterfaceLinkTypeP2p"] = oProtocolOspfAreaInterface.LinkType.P2p.Misc + } + } + } + if oProtocolOspfAreaInterface.Bfd != nil { + nestedProtocolOspfAreaInterface.Bfd = &ProtocolOspfAreaInterfaceBfd{} + if oProtocolOspfAreaInterface.Bfd.Misc != nil { + entry.Misc["ProtocolOspfAreaInterfaceBfd"] = oProtocolOspfAreaInterface.Bfd.Misc + } + if oProtocolOspfAreaInterface.Bfd.Profile != nil { + nestedProtocolOspfAreaInterface.Bfd.Profile = oProtocolOspfAreaInterface.Bfd.Profile + } + } + if oProtocolOspfAreaInterface.Passive != nil { + nestedProtocolOspfAreaInterface.Passive = util.AsBool(oProtocolOspfAreaInterface.Passive, nil) + } + if oProtocolOspfAreaInterface.TransitDelay != nil { + nestedProtocolOspfAreaInterface.TransitDelay = oProtocolOspfAreaInterface.TransitDelay + } + if oProtocolOspfAreaInterface.Metric != nil { + nestedProtocolOspfAreaInterface.Metric = oProtocolOspfAreaInterface.Metric + } + if oProtocolOspfAreaInterface.HelloInterval != nil { + nestedProtocolOspfAreaInterface.HelloInterval = oProtocolOspfAreaInterface.HelloInterval + } + if oProtocolOspfAreaInterface.Authentication != nil { + nestedProtocolOspfAreaInterface.Authentication = oProtocolOspfAreaInterface.Authentication + } + if oProtocolOspfAreaInterface.GrDelay != nil { + nestedProtocolOspfAreaInterface.GrDelay = oProtocolOspfAreaInterface.GrDelay + } + if oProtocolOspfAreaInterface.Priority != nil { + nestedProtocolOspfAreaInterface.Priority = oProtocolOspfAreaInterface.Priority + } + nestedProtocolOspfArea.Interface = append(nestedProtocolOspfArea.Interface, nestedProtocolOspfAreaInterface) + } + } + nestedProtocol.Ospf.Area = append(nestedProtocol.Ospf.Area, nestedProtocolOspfArea) + } + } + if o.Protocol.Ospf.AuthProfile != nil { + nestedProtocol.Ospf.AuthProfile = []ProtocolOspfAuthProfile{} + for _, oProtocolOspfAuthProfile := range o.Protocol.Ospf.AuthProfile { + nestedProtocolOspfAuthProfile := ProtocolOspfAuthProfile{} + if oProtocolOspfAuthProfile.Misc != nil { + entry.Misc["ProtocolOspfAuthProfile"] = oProtocolOspfAuthProfile.Misc + } + if oProtocolOspfAuthProfile.Name != "" { + nestedProtocolOspfAuthProfile.Name = oProtocolOspfAuthProfile.Name + } + if oProtocolOspfAuthProfile.Password != nil { + nestedProtocolOspfAuthProfile.Password = oProtocolOspfAuthProfile.Password + } + if oProtocolOspfAuthProfile.Md5 != nil { + nestedProtocolOspfAuthProfile.Md5 = []ProtocolOspfAuthProfileMd5{} + for _, oProtocolOspfAuthProfileMd5 := range oProtocolOspfAuthProfile.Md5 { + nestedProtocolOspfAuthProfileMd5 := ProtocolOspfAuthProfileMd5{} + if oProtocolOspfAuthProfileMd5.Misc != nil { + entry.Misc["ProtocolOspfAuthProfileMd5"] = oProtocolOspfAuthProfileMd5.Misc + } + if oProtocolOspfAuthProfileMd5.Key != nil { + nestedProtocolOspfAuthProfileMd5.Key = oProtocolOspfAuthProfileMd5.Key + } + if oProtocolOspfAuthProfileMd5.Preferred != nil { + nestedProtocolOspfAuthProfileMd5.Preferred = util.AsBool(oProtocolOspfAuthProfileMd5.Preferred, nil) + } + if oProtocolOspfAuthProfileMd5.Name != "" { + nestedProtocolOspfAuthProfileMd5.Name = oProtocolOspfAuthProfileMd5.Name + } + nestedProtocolOspfAuthProfile.Md5 = append(nestedProtocolOspfAuthProfile.Md5, nestedProtocolOspfAuthProfileMd5) + } + } + nestedProtocol.Ospf.AuthProfile = append(nestedProtocol.Ospf.AuthProfile, nestedProtocolOspfAuthProfile) + } + } + if o.Protocol.Ospf.Enable != nil { + nestedProtocol.Ospf.Enable = util.AsBool(o.Protocol.Ospf.Enable, nil) + } + if o.Protocol.Ospf.ExportRules != nil { + nestedProtocol.Ospf.ExportRules = []ProtocolOspfExportRules{} + for _, oProtocolOspfExportRules := range o.Protocol.Ospf.ExportRules { + nestedProtocolOspfExportRules := ProtocolOspfExportRules{} + if oProtocolOspfExportRules.Misc != nil { + entry.Misc["ProtocolOspfExportRules"] = oProtocolOspfExportRules.Misc + } + if oProtocolOspfExportRules.Metric != nil { + nestedProtocolOspfExportRules.Metric = oProtocolOspfExportRules.Metric + } + if oProtocolOspfExportRules.Name != "" { + nestedProtocolOspfExportRules.Name = oProtocolOspfExportRules.Name + } + if oProtocolOspfExportRules.NewPathType != nil { + nestedProtocolOspfExportRules.NewPathType = oProtocolOspfExportRules.NewPathType + } + if oProtocolOspfExportRules.NewTag != nil { + nestedProtocolOspfExportRules.NewTag = oProtocolOspfExportRules.NewTag + } + nestedProtocol.Ospf.ExportRules = append(nestedProtocol.Ospf.ExportRules, nestedProtocolOspfExportRules) + } + } + if o.Protocol.Ospf.Rfc1583 != nil { + nestedProtocol.Ospf.Rfc1583 = util.AsBool(o.Protocol.Ospf.Rfc1583, nil) + } + if o.Protocol.Ospf.AllowRedistDefaultRoute != nil { + nestedProtocol.Ospf.AllowRedistDefaultRoute = util.AsBool(o.Protocol.Ospf.AllowRedistDefaultRoute, nil) + } + if o.Protocol.Ospf.GlobalBfd != nil { + nestedProtocol.Ospf.GlobalBfd = &ProtocolOspfGlobalBfd{} + if o.Protocol.Ospf.GlobalBfd.Misc != nil { + entry.Misc["ProtocolOspfGlobalBfd"] = o.Protocol.Ospf.GlobalBfd.Misc + } + if o.Protocol.Ospf.GlobalBfd.Profile != nil { + nestedProtocol.Ospf.GlobalBfd.Profile = o.Protocol.Ospf.GlobalBfd.Profile + } + } + if o.Protocol.Ospf.GracefulRestart != nil { + nestedProtocol.Ospf.GracefulRestart = &ProtocolOspfGracefulRestart{} + if o.Protocol.Ospf.GracefulRestart.Misc != nil { + entry.Misc["ProtocolOspfGracefulRestart"] = o.Protocol.Ospf.GracefulRestart.Misc + } + if o.Protocol.Ospf.GracefulRestart.Enable != nil { + nestedProtocol.Ospf.GracefulRestart.Enable = util.AsBool(o.Protocol.Ospf.GracefulRestart.Enable, nil) + } + if o.Protocol.Ospf.GracefulRestart.GracePeriod != nil { + nestedProtocol.Ospf.GracefulRestart.GracePeriod = o.Protocol.Ospf.GracefulRestart.GracePeriod + } + if o.Protocol.Ospf.GracefulRestart.HelperEnable != nil { + nestedProtocol.Ospf.GracefulRestart.HelperEnable = util.AsBool(o.Protocol.Ospf.GracefulRestart.HelperEnable, nil) + } + if o.Protocol.Ospf.GracefulRestart.MaxNeighborRestartTime != nil { + nestedProtocol.Ospf.GracefulRestart.MaxNeighborRestartTime = o.Protocol.Ospf.GracefulRestart.MaxNeighborRestartTime + } + if o.Protocol.Ospf.GracefulRestart.StrictLSAChecking != nil { + nestedProtocol.Ospf.GracefulRestart.StrictLSAChecking = util.AsBool(o.Protocol.Ospf.GracefulRestart.StrictLSAChecking, nil) + } + } + if o.Protocol.Ospf.RejectDefaultRoute != nil { + nestedProtocol.Ospf.RejectDefaultRoute = util.AsBool(o.Protocol.Ospf.RejectDefaultRoute, nil) + } + } + } + entry.Protocol = nestedProtocol + + var nestedRoutingTable *RoutingTable + if o.RoutingTable != nil { + nestedRoutingTable = &RoutingTable{} + if o.RoutingTable.Misc != nil { + entry.Misc["RoutingTable"] = o.RoutingTable.Misc + } + if o.RoutingTable.Ip != nil { + nestedRoutingTable.Ip = &RoutingTableIp{} + if o.RoutingTable.Ip.Misc != nil { + entry.Misc["RoutingTableIp"] = o.RoutingTable.Ip.Misc + } + if o.RoutingTable.Ip.StaticRoute != nil { + nestedRoutingTable.Ip.StaticRoute = []RoutingTableIpStaticRoute{} + for _, oRoutingTableIpStaticRoute := range o.RoutingTable.Ip.StaticRoute { + nestedRoutingTableIpStaticRoute := RoutingTableIpStaticRoute{} + if oRoutingTableIpStaticRoute.Misc != nil { + entry.Misc["RoutingTableIpStaticRoute"] = oRoutingTableIpStaticRoute.Misc + } + if oRoutingTableIpStaticRoute.Metric != nil { + nestedRoutingTableIpStaticRoute.Metric = oRoutingTableIpStaticRoute.Metric + } + if oRoutingTableIpStaticRoute.Nexthop != nil { + nestedRoutingTableIpStaticRoute.Nexthop = &RoutingTableIpStaticRouteNexthop{} + if oRoutingTableIpStaticRoute.Nexthop.Misc != nil { + entry.Misc["RoutingTableIpStaticRouteNexthop"] = oRoutingTableIpStaticRoute.Nexthop.Misc + } + if oRoutingTableIpStaticRoute.Nexthop.IpAddress != nil { + nestedRoutingTableIpStaticRoute.Nexthop.IpAddress = oRoutingTableIpStaticRoute.Nexthop.IpAddress + } + if oRoutingTableIpStaticRoute.Nexthop.Fqdn != nil { + nestedRoutingTableIpStaticRoute.Nexthop.Fqdn = oRoutingTableIpStaticRoute.Nexthop.Fqdn + } + if oRoutingTableIpStaticRoute.Nexthop.NextVr != nil { + nestedRoutingTableIpStaticRoute.Nexthop.NextVr = oRoutingTableIpStaticRoute.Nexthop.NextVr + } + if oRoutingTableIpStaticRoute.Nexthop.Receive != nil { + nestedRoutingTableIpStaticRoute.Nexthop.Receive = &RoutingTableIpStaticRouteNexthopReceive{} + if oRoutingTableIpStaticRoute.Nexthop.Receive.Misc != nil { + entry.Misc["RoutingTableIpStaticRouteNexthopReceive"] = oRoutingTableIpStaticRoute.Nexthop.Receive.Misc + } + } + if oRoutingTableIpStaticRoute.Nexthop.Discard != nil { + nestedRoutingTableIpStaticRoute.Nexthop.Discard = &RoutingTableIpStaticRouteNexthopDiscard{} + if oRoutingTableIpStaticRoute.Nexthop.Discard.Misc != nil { + entry.Misc["RoutingTableIpStaticRouteNexthopDiscard"] = oRoutingTableIpStaticRoute.Nexthop.Discard.Misc + } + } + } + if oRoutingTableIpStaticRoute.PathMonitor != nil { + nestedRoutingTableIpStaticRoute.PathMonitor = &RoutingTableIpStaticRoutePathMonitor{} + if oRoutingTableIpStaticRoute.PathMonitor.Misc != nil { + entry.Misc["RoutingTableIpStaticRoutePathMonitor"] = oRoutingTableIpStaticRoute.PathMonitor.Misc + } + if oRoutingTableIpStaticRoute.PathMonitor.HoldTime != nil { + nestedRoutingTableIpStaticRoute.PathMonitor.HoldTime = oRoutingTableIpStaticRoute.PathMonitor.HoldTime + } + if oRoutingTableIpStaticRoute.PathMonitor.MonitorDestinations != nil { + nestedRoutingTableIpStaticRoute.PathMonitor.MonitorDestinations = []RoutingTableIpStaticRoutePathMonitorMonitorDestinations{} + for _, oRoutingTableIpStaticRoutePathMonitorMonitorDestinations := range oRoutingTableIpStaticRoute.PathMonitor.MonitorDestinations { + nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations := RoutingTableIpStaticRoutePathMonitorMonitorDestinations{} + if oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Misc != nil { + entry.Misc["RoutingTableIpStaticRoutePathMonitorMonitorDestinations"] = oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Misc + } + if oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Count != nil { + nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Count = oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Count + } + if oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Name != "" { + nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Name = oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Name + } + if oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Enable != nil { + nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Enable = util.AsBool(oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Enable, nil) + } + if oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Source != nil { + nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Source = oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Source + } + if oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Destination != nil { + nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Destination = oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Destination + } + if oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Interval != nil { + nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Interval = oRoutingTableIpStaticRoutePathMonitorMonitorDestinations.Interval + } + nestedRoutingTableIpStaticRoute.PathMonitor.MonitorDestinations = append(nestedRoutingTableIpStaticRoute.PathMonitor.MonitorDestinations, nestedRoutingTableIpStaticRoutePathMonitorMonitorDestinations) + } + } + if oRoutingTableIpStaticRoute.PathMonitor.Enable != nil { + nestedRoutingTableIpStaticRoute.PathMonitor.Enable = util.AsBool(oRoutingTableIpStaticRoute.PathMonitor.Enable, nil) + } + if oRoutingTableIpStaticRoute.PathMonitor.FailureCondition != nil { + nestedRoutingTableIpStaticRoute.PathMonitor.FailureCondition = oRoutingTableIpStaticRoute.PathMonitor.FailureCondition + } + } + if oRoutingTableIpStaticRoute.RouteTable != nil { + nestedRoutingTableIpStaticRoute.RouteTable = &RoutingTableIpStaticRouteRouteTable{} + if oRoutingTableIpStaticRoute.RouteTable.Misc != nil { + entry.Misc["RoutingTableIpStaticRouteRouteTable"] = oRoutingTableIpStaticRoute.RouteTable.Misc + } + if oRoutingTableIpStaticRoute.RouteTable.NoInstall != nil { + nestedRoutingTableIpStaticRoute.RouteTable.NoInstall = &RoutingTableIpStaticRouteRouteTableNoInstall{} + if oRoutingTableIpStaticRoute.RouteTable.NoInstall.Misc != nil { + entry.Misc["RoutingTableIpStaticRouteRouteTableNoInstall"] = oRoutingTableIpStaticRoute.RouteTable.NoInstall.Misc + } + } + if oRoutingTableIpStaticRoute.RouteTable.Unicast != nil { + nestedRoutingTableIpStaticRoute.RouteTable.Unicast = &RoutingTableIpStaticRouteRouteTableUnicast{} + if oRoutingTableIpStaticRoute.RouteTable.Unicast.Misc != nil { + entry.Misc["RoutingTableIpStaticRouteRouteTableUnicast"] = oRoutingTableIpStaticRoute.RouteTable.Unicast.Misc + } + } + if oRoutingTableIpStaticRoute.RouteTable.Multicast != nil { + nestedRoutingTableIpStaticRoute.RouteTable.Multicast = &RoutingTableIpStaticRouteRouteTableMulticast{} + if oRoutingTableIpStaticRoute.RouteTable.Multicast.Misc != nil { + entry.Misc["RoutingTableIpStaticRouteRouteTableMulticast"] = oRoutingTableIpStaticRoute.RouteTable.Multicast.Misc + } + } + if oRoutingTableIpStaticRoute.RouteTable.Both != nil { + nestedRoutingTableIpStaticRoute.RouteTable.Both = &RoutingTableIpStaticRouteRouteTableBoth{} + if oRoutingTableIpStaticRoute.RouteTable.Both.Misc != nil { + entry.Misc["RoutingTableIpStaticRouteRouteTableBoth"] = oRoutingTableIpStaticRoute.RouteTable.Both.Misc + } + } + } + if oRoutingTableIpStaticRoute.Bfd != nil { + nestedRoutingTableIpStaticRoute.Bfd = &RoutingTableIpStaticRouteBfd{} + if oRoutingTableIpStaticRoute.Bfd.Misc != nil { + entry.Misc["RoutingTableIpStaticRouteBfd"] = oRoutingTableIpStaticRoute.Bfd.Misc + } + if oRoutingTableIpStaticRoute.Bfd.Profile != nil { + nestedRoutingTableIpStaticRoute.Bfd.Profile = oRoutingTableIpStaticRoute.Bfd.Profile + } + } + if oRoutingTableIpStaticRoute.Name != "" { + nestedRoutingTableIpStaticRoute.Name = oRoutingTableIpStaticRoute.Name + } + if oRoutingTableIpStaticRoute.Destination != nil { + nestedRoutingTableIpStaticRoute.Destination = oRoutingTableIpStaticRoute.Destination + } + if oRoutingTableIpStaticRoute.Interface != nil { + nestedRoutingTableIpStaticRoute.Interface = oRoutingTableIpStaticRoute.Interface + } + if oRoutingTableIpStaticRoute.AdminDist != nil { + nestedRoutingTableIpStaticRoute.AdminDist = oRoutingTableIpStaticRoute.AdminDist + } + nestedRoutingTable.Ip.StaticRoute = append(nestedRoutingTable.Ip.StaticRoute, nestedRoutingTableIpStaticRoute) + } + } + } + if o.RoutingTable.Ipv6 != nil { + nestedRoutingTable.Ipv6 = &RoutingTableIpv6{} + if o.RoutingTable.Ipv6.Misc != nil { + entry.Misc["RoutingTableIpv6"] = o.RoutingTable.Ipv6.Misc + } + if o.RoutingTable.Ipv6.StaticRoute != nil { + nestedRoutingTable.Ipv6.StaticRoute = []RoutingTableIpv6StaticRoute{} + for _, oRoutingTableIpv6StaticRoute := range o.RoutingTable.Ipv6.StaticRoute { + nestedRoutingTableIpv6StaticRoute := RoutingTableIpv6StaticRoute{} + if oRoutingTableIpv6StaticRoute.Misc != nil { + entry.Misc["RoutingTableIpv6StaticRoute"] = oRoutingTableIpv6StaticRoute.Misc + } + if oRoutingTableIpv6StaticRoute.Destination != nil { + nestedRoutingTableIpv6StaticRoute.Destination = oRoutingTableIpv6StaticRoute.Destination + } + if oRoutingTableIpv6StaticRoute.Metric != nil { + nestedRoutingTableIpv6StaticRoute.Metric = oRoutingTableIpv6StaticRoute.Metric + } + if oRoutingTableIpv6StaticRoute.Nexthop != nil { + nestedRoutingTableIpv6StaticRoute.Nexthop = &RoutingTableIpv6StaticRouteNexthop{} + if oRoutingTableIpv6StaticRoute.Nexthop.Misc != nil { + entry.Misc["RoutingTableIpv6StaticRouteNexthop"] = oRoutingTableIpv6StaticRoute.Nexthop.Misc + } + if oRoutingTableIpv6StaticRoute.Nexthop.Receive != nil { + nestedRoutingTableIpv6StaticRoute.Nexthop.Receive = &RoutingTableIpv6StaticRouteNexthopReceive{} + if oRoutingTableIpv6StaticRoute.Nexthop.Receive.Misc != nil { + entry.Misc["RoutingTableIpv6StaticRouteNexthopReceive"] = oRoutingTableIpv6StaticRoute.Nexthop.Receive.Misc + } + } + if oRoutingTableIpv6StaticRoute.Nexthop.Discard != nil { + nestedRoutingTableIpv6StaticRoute.Nexthop.Discard = &RoutingTableIpv6StaticRouteNexthopDiscard{} + if oRoutingTableIpv6StaticRoute.Nexthop.Discard.Misc != nil { + entry.Misc["RoutingTableIpv6StaticRouteNexthopDiscard"] = oRoutingTableIpv6StaticRoute.Nexthop.Discard.Misc + } + } + if oRoutingTableIpv6StaticRoute.Nexthop.Ipv6Address != nil { + nestedRoutingTableIpv6StaticRoute.Nexthop.Ipv6Address = oRoutingTableIpv6StaticRoute.Nexthop.Ipv6Address + } + if oRoutingTableIpv6StaticRoute.Nexthop.NextVr != nil { + nestedRoutingTableIpv6StaticRoute.Nexthop.NextVr = oRoutingTableIpv6StaticRoute.Nexthop.NextVr + } + } + if oRoutingTableIpv6StaticRoute.PathMonitor != nil { + nestedRoutingTableIpv6StaticRoute.PathMonitor = &RoutingTableIpv6StaticRoutePathMonitor{} + if oRoutingTableIpv6StaticRoute.PathMonitor.Misc != nil { + entry.Misc["RoutingTableIpv6StaticRoutePathMonitor"] = oRoutingTableIpv6StaticRoute.PathMonitor.Misc + } + if oRoutingTableIpv6StaticRoute.PathMonitor.FailureCondition != nil { + nestedRoutingTableIpv6StaticRoute.PathMonitor.FailureCondition = oRoutingTableIpv6StaticRoute.PathMonitor.FailureCondition + } + if oRoutingTableIpv6StaticRoute.PathMonitor.HoldTime != nil { + nestedRoutingTableIpv6StaticRoute.PathMonitor.HoldTime = oRoutingTableIpv6StaticRoute.PathMonitor.HoldTime + } + if oRoutingTableIpv6StaticRoute.PathMonitor.MonitorDestinations != nil { + nestedRoutingTableIpv6StaticRoute.PathMonitor.MonitorDestinations = []RoutingTableIpv6StaticRoutePathMonitorMonitorDestinations{} + for _, oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations := range oRoutingTableIpv6StaticRoute.PathMonitor.MonitorDestinations { + nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations := RoutingTableIpv6StaticRoutePathMonitorMonitorDestinations{} + if oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Misc != nil { + entry.Misc["RoutingTableIpv6StaticRoutePathMonitorMonitorDestinations"] = oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Misc + } + if oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Interval != nil { + nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Interval = oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Interval + } + if oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Count != nil { + nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Count = oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Count + } + if oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Name != "" { + nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Name = oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Name + } + if oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Enable != nil { + nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Enable = util.AsBool(oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Enable, nil) + } + if oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Source != nil { + nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Source = oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Source + } + if oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Destination != nil { + nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Destination = oRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations.Destination + } + nestedRoutingTableIpv6StaticRoute.PathMonitor.MonitorDestinations = append(nestedRoutingTableIpv6StaticRoute.PathMonitor.MonitorDestinations, nestedRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations) + } + } + if oRoutingTableIpv6StaticRoute.PathMonitor.Enable != nil { + nestedRoutingTableIpv6StaticRoute.PathMonitor.Enable = util.AsBool(oRoutingTableIpv6StaticRoute.PathMonitor.Enable, nil) + } + } + if oRoutingTableIpv6StaticRoute.Name != "" { + nestedRoutingTableIpv6StaticRoute.Name = oRoutingTableIpv6StaticRoute.Name + } + if oRoutingTableIpv6StaticRoute.Interface != nil { + nestedRoutingTableIpv6StaticRoute.Interface = oRoutingTableIpv6StaticRoute.Interface + } + if oRoutingTableIpv6StaticRoute.AdminDist != nil { + nestedRoutingTableIpv6StaticRoute.AdminDist = oRoutingTableIpv6StaticRoute.AdminDist + } + if oRoutingTableIpv6StaticRoute.Option != nil { + nestedRoutingTableIpv6StaticRoute.Option = &RoutingTableIpv6StaticRouteOption{} + if oRoutingTableIpv6StaticRoute.Option.Misc != nil { + entry.Misc["RoutingTableIpv6StaticRouteOption"] = oRoutingTableIpv6StaticRoute.Option.Misc + } + } + if oRoutingTableIpv6StaticRoute.RouteTable != nil { + nestedRoutingTableIpv6StaticRoute.RouteTable = &RoutingTableIpv6StaticRouteRouteTable{} + if oRoutingTableIpv6StaticRoute.RouteTable.Misc != nil { + entry.Misc["RoutingTableIpv6StaticRouteRouteTable"] = oRoutingTableIpv6StaticRoute.RouteTable.Misc + } + if oRoutingTableIpv6StaticRoute.RouteTable.Unicast != nil { + nestedRoutingTableIpv6StaticRoute.RouteTable.Unicast = &RoutingTableIpv6StaticRouteRouteTableUnicast{} + if oRoutingTableIpv6StaticRoute.RouteTable.Unicast.Misc != nil { + entry.Misc["RoutingTableIpv6StaticRouteRouteTableUnicast"] = oRoutingTableIpv6StaticRoute.RouteTable.Unicast.Misc + } + } + if oRoutingTableIpv6StaticRoute.RouteTable.NoInstall != nil { + nestedRoutingTableIpv6StaticRoute.RouteTable.NoInstall = &RoutingTableIpv6StaticRouteRouteTableNoInstall{} + if oRoutingTableIpv6StaticRoute.RouteTable.NoInstall.Misc != nil { + entry.Misc["RoutingTableIpv6StaticRouteRouteTableNoInstall"] = oRoutingTableIpv6StaticRoute.RouteTable.NoInstall.Misc + } + } + } + if oRoutingTableIpv6StaticRoute.Bfd != nil { + nestedRoutingTableIpv6StaticRoute.Bfd = &RoutingTableIpv6StaticRouteBfd{} + if oRoutingTableIpv6StaticRoute.Bfd.Misc != nil { + entry.Misc["RoutingTableIpv6StaticRouteBfd"] = oRoutingTableIpv6StaticRoute.Bfd.Misc + } + if oRoutingTableIpv6StaticRoute.Bfd.Profile != nil { + nestedRoutingTableIpv6StaticRoute.Bfd.Profile = oRoutingTableIpv6StaticRoute.Bfd.Profile + } + } + nestedRoutingTable.Ipv6.StaticRoute = append(nestedRoutingTable.Ipv6.StaticRoute, nestedRoutingTableIpv6StaticRoute) + } + } + } + } + entry.RoutingTable = nestedRoutingTable + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !matchAdminDists(a.AdminDists, b.AdminDists) { + return false + } + if !matchEcmp(a.Ecmp, b.Ecmp) { + return false + } + if !util.OrderedListsMatch(a.Interface, b.Interface) { + return false + } + if !matchMulticast(a.Multicast, b.Multicast) { + return false + } + if !matchProtocol(a.Protocol, b.Protocol) { + return false + } + if !matchRoutingTable(a.RoutingTable, b.RoutingTable) { + return false + } + + return true +} + +func matchRoutingTableIpStaticRouteRouteTableUnicast(a *RoutingTableIpStaticRouteRouteTableUnicast, b *RoutingTableIpStaticRouteRouteTableUnicast) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRoutingTableIpStaticRouteRouteTableMulticast(a *RoutingTableIpStaticRouteRouteTableMulticast, b *RoutingTableIpStaticRouteRouteTableMulticast) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRoutingTableIpStaticRouteRouteTableBoth(a *RoutingTableIpStaticRouteRouteTableBoth, b *RoutingTableIpStaticRouteRouteTableBoth) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRoutingTableIpStaticRouteRouteTableNoInstall(a *RoutingTableIpStaticRouteRouteTableNoInstall, b *RoutingTableIpStaticRouteRouteTableNoInstall) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRoutingTableIpStaticRouteRouteTable(a *RoutingTableIpStaticRouteRouteTable, b *RoutingTableIpStaticRouteRouteTable) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchRoutingTableIpStaticRouteRouteTableNoInstall(a.NoInstall, b.NoInstall) { + return false + } + if !matchRoutingTableIpStaticRouteRouteTableUnicast(a.Unicast, b.Unicast) { + return false + } + if !matchRoutingTableIpStaticRouteRouteTableMulticast(a.Multicast, b.Multicast) { + return false + } + if !matchRoutingTableIpStaticRouteRouteTableBoth(a.Both, b.Both) { + return false + } + return true +} +func matchRoutingTableIpStaticRouteBfd(a *RoutingTableIpStaticRouteBfd, b *RoutingTableIpStaticRouteBfd) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } + return true +} +func matchRoutingTableIpStaticRouteNexthopReceive(a *RoutingTableIpStaticRouteNexthopReceive, b *RoutingTableIpStaticRouteNexthopReceive) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRoutingTableIpStaticRouteNexthopDiscard(a *RoutingTableIpStaticRouteNexthopDiscard, b *RoutingTableIpStaticRouteNexthopDiscard) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRoutingTableIpStaticRouteNexthop(a *RoutingTableIpStaticRouteNexthop, b *RoutingTableIpStaticRouteNexthop) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchRoutingTableIpStaticRouteNexthopReceive(a.Receive, b.Receive) { + return false + } + if !matchRoutingTableIpStaticRouteNexthopDiscard(a.Discard, b.Discard) { + return false + } + if !util.StringsMatch(a.IpAddress, b.IpAddress) { + return false + } + if !util.StringsMatch(a.Fqdn, b.Fqdn) { + return false + } + if !util.StringsMatch(a.NextVr, b.NextVr) { + return false + } + return true +} +func matchRoutingTableIpStaticRoutePathMonitorMonitorDestinations(a []RoutingTableIpStaticRoutePathMonitorMonitorDestinations, b []RoutingTableIpStaticRoutePathMonitorMonitorDestinations) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Interval, b.Interval) { + return false + } + if !util.Ints64Match(a.Count, b.Count) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.StringsMatch(a.Source, b.Source) { + return false + } + if !util.StringsMatch(a.Destination, b.Destination) { + return false + } + } + } + return true +} +func matchRoutingTableIpStaticRoutePathMonitor(a *RoutingTableIpStaticRoutePathMonitor, b *RoutingTableIpStaticRoutePathMonitor) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.HoldTime, b.HoldTime) { + return false + } + if !matchRoutingTableIpStaticRoutePathMonitorMonitorDestinations(a.MonitorDestinations, b.MonitorDestinations) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.StringsMatch(a.FailureCondition, b.FailureCondition) { + return false + } + return true +} +func matchRoutingTableIpStaticRoute(a []RoutingTableIpStaticRoute, b []RoutingTableIpStaticRoute) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !matchRoutingTableIpStaticRouteNexthop(a.Nexthop, b.Nexthop) { + return false + } + if !matchRoutingTableIpStaticRoutePathMonitor(a.PathMonitor, b.PathMonitor) { + return false + } + if !util.Ints64Match(a.Metric, b.Metric) { + return false + } + if !util.StringsMatch(a.Interface, b.Interface) { + return false + } + if !util.Ints64Match(a.AdminDist, b.AdminDist) { + return false + } + if !matchRoutingTableIpStaticRouteRouteTable(a.RouteTable, b.RouteTable) { + return false + } + if !matchRoutingTableIpStaticRouteBfd(a.Bfd, b.Bfd) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.Destination, b.Destination) { + return false + } + } + } + return true +} +func matchRoutingTableIp(a *RoutingTableIp, b *RoutingTableIp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchRoutingTableIpStaticRoute(a.StaticRoute, b.StaticRoute) { + return false + } + return true +} +func matchRoutingTableIpv6StaticRouteNexthopReceive(a *RoutingTableIpv6StaticRouteNexthopReceive, b *RoutingTableIpv6StaticRouteNexthopReceive) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRoutingTableIpv6StaticRouteNexthopDiscard(a *RoutingTableIpv6StaticRouteNexthopDiscard, b *RoutingTableIpv6StaticRouteNexthopDiscard) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRoutingTableIpv6StaticRouteNexthop(a *RoutingTableIpv6StaticRouteNexthop, b *RoutingTableIpv6StaticRouteNexthop) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchRoutingTableIpv6StaticRouteNexthopReceive(a.Receive, b.Receive) { + return false + } + if !matchRoutingTableIpv6StaticRouteNexthopDiscard(a.Discard, b.Discard) { + return false + } + if !util.StringsMatch(a.Ipv6Address, b.Ipv6Address) { + return false + } + if !util.StringsMatch(a.NextVr, b.NextVr) { + return false + } + return true +} +func matchRoutingTableIpv6StaticRouteOption(a *RoutingTableIpv6StaticRouteOption, b *RoutingTableIpv6StaticRouteOption) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRoutingTableIpv6StaticRouteRouteTableUnicast(a *RoutingTableIpv6StaticRouteRouteTableUnicast, b *RoutingTableIpv6StaticRouteRouteTableUnicast) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRoutingTableIpv6StaticRouteRouteTableNoInstall(a *RoutingTableIpv6StaticRouteRouteTableNoInstall, b *RoutingTableIpv6StaticRouteRouteTableNoInstall) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRoutingTableIpv6StaticRouteRouteTable(a *RoutingTableIpv6StaticRouteRouteTable, b *RoutingTableIpv6StaticRouteRouteTable) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchRoutingTableIpv6StaticRouteRouteTableUnicast(a.Unicast, b.Unicast) { + return false + } + if !matchRoutingTableIpv6StaticRouteRouteTableNoInstall(a.NoInstall, b.NoInstall) { + return false + } + return true +} +func matchRoutingTableIpv6StaticRouteBfd(a *RoutingTableIpv6StaticRouteBfd, b *RoutingTableIpv6StaticRouteBfd) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } + return true +} +func matchRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations(a []RoutingTableIpv6StaticRoutePathMonitorMonitorDestinations, b []RoutingTableIpv6StaticRoutePathMonitorMonitorDestinations) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.StringsMatch(a.Source, b.Source) { + return false + } + if !util.StringsMatch(a.Destination, b.Destination) { + return false + } + if !util.Ints64Match(a.Interval, b.Interval) { + return false + } + if !util.Ints64Match(a.Count, b.Count) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchRoutingTableIpv6StaticRoutePathMonitor(a *RoutingTableIpv6StaticRoutePathMonitor, b *RoutingTableIpv6StaticRoutePathMonitor) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.StringsMatch(a.FailureCondition, b.FailureCondition) { + return false + } + if !util.Ints64Match(a.HoldTime, b.HoldTime) { + return false + } + if !matchRoutingTableIpv6StaticRoutePathMonitorMonitorDestinations(a.MonitorDestinations, b.MonitorDestinations) { + return false + } + return true +} +func matchRoutingTableIpv6StaticRoute(a []RoutingTableIpv6StaticRoute, b []RoutingTableIpv6StaticRoute) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.Destination, b.Destination) { + return false + } + if !util.Ints64Match(a.Metric, b.Metric) { + return false + } + if !matchRoutingTableIpv6StaticRouteNexthop(a.Nexthop, b.Nexthop) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.Interface, b.Interface) { + return false + } + if !util.Ints64Match(a.AdminDist, b.AdminDist) { + return false + } + if !matchRoutingTableIpv6StaticRouteOption(a.Option, b.Option) { + return false + } + if !matchRoutingTableIpv6StaticRouteRouteTable(a.RouteTable, b.RouteTable) { + return false + } + if !matchRoutingTableIpv6StaticRouteBfd(a.Bfd, b.Bfd) { + return false + } + if !matchRoutingTableIpv6StaticRoutePathMonitor(a.PathMonitor, b.PathMonitor) { + return false + } + } + } + return true +} +func matchRoutingTableIpv6(a *RoutingTableIpv6, b *RoutingTableIpv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchRoutingTableIpv6StaticRoute(a.StaticRoute, b.StaticRoute) { + return false + } + return true +} +func matchRoutingTable(a *RoutingTable, b *RoutingTable) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchRoutingTableIp(a.Ip, b.Ip) { + return false + } + if !matchRoutingTableIpv6(a.Ipv6, b.Ipv6) { + return false + } + return true +} +func matchAdminDists(a *AdminDists, b *AdminDists) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Ospfv3Ext, b.Ospfv3Ext) { + return false + } + if !util.Ints64Match(a.Rip, b.Rip) { + return false + } + if !util.Ints64Match(a.StaticIpv6, b.StaticIpv6) { + return false + } + if !util.Ints64Match(a.Ibgp, b.Ibgp) { + return false + } + if !util.Ints64Match(a.OspfExt, b.OspfExt) { + return false + } + if !util.Ints64Match(a.OspfInt, b.OspfInt) { + return false + } + if !util.Ints64Match(a.Ebgp, b.Ebgp) { + return false + } + if !util.Ints64Match(a.Ospfv3Int, b.Ospfv3Int) { + return false + } + if !util.Ints64Match(a.Static, b.Static) { + return false + } + return true +} +func matchEcmpAlgorithmIpModulo(a *EcmpAlgorithmIpModulo, b *EcmpAlgorithmIpModulo) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchEcmpAlgorithmWeightedRoundRobinInterface(a []EcmpAlgorithmWeightedRoundRobinInterface, b []EcmpAlgorithmWeightedRoundRobinInterface) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Weight, b.Weight) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchEcmpAlgorithmWeightedRoundRobin(a *EcmpAlgorithmWeightedRoundRobin, b *EcmpAlgorithmWeightedRoundRobin) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchEcmpAlgorithmWeightedRoundRobinInterface(a.Interface, b.Interface) { + return false + } + return true +} +func matchEcmpAlgorithmBalancedRoundRobin(a *EcmpAlgorithmBalancedRoundRobin, b *EcmpAlgorithmBalancedRoundRobin) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchEcmpAlgorithmIpHash(a *EcmpAlgorithmIpHash, b *EcmpAlgorithmIpHash) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.HashSeed, b.HashSeed) { + return false + } + if !util.BoolsMatch(a.SrcOnly, b.SrcOnly) { + return false + } + if !util.BoolsMatch(a.UsePort, b.UsePort) { + return false + } + return true +} +func matchEcmpAlgorithm(a *EcmpAlgorithm, b *EcmpAlgorithm) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchEcmpAlgorithmWeightedRoundRobin(a.WeightedRoundRobin, b.WeightedRoundRobin) { + return false + } + if !matchEcmpAlgorithmBalancedRoundRobin(a.BalancedRoundRobin, b.BalancedRoundRobin) { + return false + } + if !matchEcmpAlgorithmIpHash(a.IpHash, b.IpHash) { + return false + } + if !matchEcmpAlgorithmIpModulo(a.IpModulo, b.IpModulo) { + return false + } + return true +} +func matchEcmp(a *Ecmp, b *Ecmp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchEcmpAlgorithm(a.Algorithm, b.Algorithm) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.MaxPath, b.MaxPath) { + return false + } + if !util.BoolsMatch(a.StrictSourcePath, b.StrictSourcePath) { + return false + } + if !util.BoolsMatch(a.SymmetricReturn, b.SymmetricReturn) { + return false + } + return true +} +func matchMulticastInterfaceGroupGroupPermissionAnySourceMulticast(a []MulticastInterfaceGroupGroupPermissionAnySourceMulticast, b []MulticastInterfaceGroupGroupPermissionAnySourceMulticast) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.GroupAddress, b.GroupAddress) { + return false + } + if !util.BoolsMatch(a.Included, b.Included) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast(a []MulticastInterfaceGroupGroupPermissionSourceSpecificMulticast, b []MulticastInterfaceGroupGroupPermissionSourceSpecificMulticast) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.GroupAddress, b.GroupAddress) { + return false + } + if !util.StringsMatch(a.SourceAddress, b.SourceAddress) { + return false + } + if !util.BoolsMatch(a.Included, b.Included) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchMulticastInterfaceGroupGroupPermission(a *MulticastInterfaceGroupGroupPermission, b *MulticastInterfaceGroupGroupPermission) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchMulticastInterfaceGroupGroupPermissionAnySourceMulticast(a.AnySourceMulticast, b.AnySourceMulticast) { + return false + } + if !matchMulticastInterfaceGroupGroupPermissionSourceSpecificMulticast(a.SourceSpecificMulticast, b.SourceSpecificMulticast) { + return false + } + return true +} +func matchMulticastInterfaceGroupIgmp(a *MulticastInterfaceGroupIgmp, b *MulticastInterfaceGroupIgmp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.StringsMatch(a.Version, b.Version) { + return false + } + if !util.FloatsMatch(a.LastMemberQueryInterval, b.LastMemberQueryInterval) { + return false + } + if !util.StringsMatch(a.Robustness, b.Robustness) { + return false + } + if !util.BoolsMatch(a.RouterAlertPolicing, b.RouterAlertPolicing) { + return false + } + if !util.FloatsMatch(a.MaxQueryResponseTime, b.MaxQueryResponseTime) { + return false + } + if !util.Ints64Match(a.QueryInterval, b.QueryInterval) { + return false + } + if !util.BoolsMatch(a.ImmediateLeave, b.ImmediateLeave) { + return false + } + if !util.StringsMatch(a.MaxGroups, b.MaxGroups) { + return false + } + if !util.StringsMatch(a.MaxSources, b.MaxSources) { + return false + } + return true +} +func matchMulticastInterfaceGroupPimAllowedNeighbors(a []MulticastInterfaceGroupPimAllowedNeighbors, b []MulticastInterfaceGroupPimAllowedNeighbors) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchMulticastInterfaceGroupPim(a *MulticastInterfaceGroupPim, b *MulticastInterfaceGroupPim) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchMulticastInterfaceGroupPimAllowedNeighbors(a.AllowedNeighbors, b.AllowedNeighbors) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.AssertInterval, b.AssertInterval) { + return false + } + if !util.Ints64Match(a.HelloInterval, b.HelloInterval) { + return false + } + if !util.Ints64Match(a.JoinPruneInterval, b.JoinPruneInterval) { + return false + } + if !util.Ints64Match(a.DrPriority, b.DrPriority) { + return false + } + if !util.BoolsMatch(a.BsrBorder, b.BsrBorder) { + return false + } + return true +} +func matchMulticastInterfaceGroup(a []MulticastInterfaceGroup, b []MulticastInterfaceGroup) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.OrderedListsMatch(a.Interface, b.Interface) { + return false + } + if !matchMulticastInterfaceGroupGroupPermission(a.GroupPermission, b.GroupPermission) { + return false + } + if !matchMulticastInterfaceGroupIgmp(a.Igmp, b.Igmp) { + return false + } + if !matchMulticastInterfaceGroupPim(a.Pim, b.Pim) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchMulticastRpExternalRp(a []MulticastRpExternalRp, b []MulticastRpExternalRp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.OrderedListsMatch(a.GroupAddresses, b.GroupAddresses) { + return false + } + if !util.BoolsMatch(a.Override, b.Override) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchMulticastRpLocalRpCandidateRp(a *MulticastRpLocalRpCandidateRp, b *MulticastRpLocalRpCandidateRp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Address, b.Address) { + return false + } + if !util.Ints64Match(a.AdvertisementInterval, b.AdvertisementInterval) { + return false + } + if !util.OrderedListsMatch(a.GroupAddresses, b.GroupAddresses) { + return false + } + if !util.StringsMatch(a.Interface, b.Interface) { + return false + } + if !util.Ints64Match(a.Priority, b.Priority) { + return false + } + return true +} +func matchMulticastRpLocalRpStaticRp(a *MulticastRpLocalRpStaticRp, b *MulticastRpLocalRpStaticRp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Interface, b.Interface) { + return false + } + if !util.BoolsMatch(a.Override, b.Override) { + return false + } + if !util.StringsMatch(a.Address, b.Address) { + return false + } + if !util.OrderedListsMatch(a.GroupAddresses, b.GroupAddresses) { + return false + } + return true +} +func matchMulticastRpLocalRp(a *MulticastRpLocalRp, b *MulticastRpLocalRp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchMulticastRpLocalRpCandidateRp(a.CandidateRp, b.CandidateRp) { + return false + } + if !matchMulticastRpLocalRpStaticRp(a.StaticRp, b.StaticRp) { + return false + } + return true +} +func matchMulticastRp(a *MulticastRp, b *MulticastRp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchMulticastRpExternalRp(a.ExternalRp, b.ExternalRp) { + return false + } + if !matchMulticastRpLocalRp(a.LocalRp, b.LocalRp) { + return false + } + return true +} +func matchMulticastSptThreshold(a []MulticastSptThreshold, b []MulticastSptThreshold) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.Threshold, b.Threshold) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchMulticastSsmAddressSpace(a []MulticastSsmAddressSpace, b []MulticastSsmAddressSpace) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.GroupAddress, b.GroupAddress) { + return false + } + if !util.BoolsMatch(a.Included, b.Included) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchMulticast(a *Multicast, b *Multicast) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchMulticastInterfaceGroup(a.InterfaceGroup, b.InterfaceGroup) { + return false + } + if !util.Ints64Match(a.RouteAgeoutTime, b.RouteAgeoutTime) { + return false + } + if !matchMulticastRp(a.Rp, b.Rp) { + return false + } + if !matchMulticastSptThreshold(a.SptThreshold, b.SptThreshold) { + return false + } + if !matchMulticastSsmAddressSpace(a.SsmAddressSpace, b.SsmAddressSpace) { + return false + } + return true +} +func matchProtocolRedistProfileFilterOspf(a *ProtocolRedistProfileFilterOspf, b *ProtocolRedistProfileFilterOspf) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.OrderedListsMatch(a.Tag, b.Tag) { + return false + } + if !util.OrderedListsMatch(a.PathType, b.PathType) { + return false + } + if !util.OrderedListsMatch(a.Area, b.Area) { + return false + } + return true +} +func matchProtocolRedistProfileFilterBgp(a *ProtocolRedistProfileFilterBgp, b *ProtocolRedistProfileFilterBgp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.OrderedListsMatch(a.Community, b.Community) { + return false + } + if !util.OrderedListsMatch(a.ExtendedCommunity, b.ExtendedCommunity) { + return false + } + return true +} +func matchProtocolRedistProfileFilter(a *ProtocolRedistProfileFilter, b *ProtocolRedistProfileFilter) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.OrderedListsMatch(a.Nexthop, b.Nexthop) { + return false + } + if !matchProtocolRedistProfileFilterOspf(a.Ospf, b.Ospf) { + return false + } + if !matchProtocolRedistProfileFilterBgp(a.Bgp, b.Bgp) { + return false + } + if !util.OrderedListsMatch(a.Type, b.Type) { + return false + } + if !util.OrderedListsMatch(a.Interface, b.Interface) { + return false + } + if !util.OrderedListsMatch(a.Destination, b.Destination) { + return false + } + return true +} +func matchProtocolRedistProfileActionNoRedist(a *ProtocolRedistProfileActionNoRedist, b *ProtocolRedistProfileActionNoRedist) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolRedistProfileActionRedist(a *ProtocolRedistProfileActionRedist, b *ProtocolRedistProfileActionRedist) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolRedistProfileAction(a *ProtocolRedistProfileAction, b *ProtocolRedistProfileAction) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolRedistProfileActionNoRedist(a.NoRedist, b.NoRedist) { + return false + } + if !matchProtocolRedistProfileActionRedist(a.Redist, b.Redist) { + return false + } + return true +} +func matchProtocolRedistProfile(a []ProtocolRedistProfile, b []ProtocolRedistProfile) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Priority, b.Priority) { + return false + } + if !matchProtocolRedistProfileFilter(a.Filter, b.Filter) { + return false + } + if !matchProtocolRedistProfileAction(a.Action, b.Action) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchProtocolRedistProfileIpv6FilterOspfv3(a *ProtocolRedistProfileIpv6FilterOspfv3, b *ProtocolRedistProfileIpv6FilterOspfv3) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.OrderedListsMatch(a.PathType, b.PathType) { + return false + } + if !util.OrderedListsMatch(a.Area, b.Area) { + return false + } + if !util.OrderedListsMatch(a.Tag, b.Tag) { + return false + } + return true +} +func matchProtocolRedistProfileIpv6FilterBgp(a *ProtocolRedistProfileIpv6FilterBgp, b *ProtocolRedistProfileIpv6FilterBgp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.OrderedListsMatch(a.Community, b.Community) { + return false + } + if !util.OrderedListsMatch(a.ExtendedCommunity, b.ExtendedCommunity) { + return false + } + return true +} +func matchProtocolRedistProfileIpv6Filter(a *ProtocolRedistProfileIpv6Filter, b *ProtocolRedistProfileIpv6Filter) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.OrderedListsMatch(a.Destination, b.Destination) { + return false + } + if !util.OrderedListsMatch(a.Nexthop, b.Nexthop) { + return false + } + if !matchProtocolRedistProfileIpv6FilterOspfv3(a.Ospfv3, b.Ospfv3) { + return false + } + if !matchProtocolRedistProfileIpv6FilterBgp(a.Bgp, b.Bgp) { + return false + } + if !util.OrderedListsMatch(a.Type, b.Type) { + return false + } + if !util.OrderedListsMatch(a.Interface, b.Interface) { + return false + } + return true +} +func matchProtocolRedistProfileIpv6ActionNoRedist(a *ProtocolRedistProfileIpv6ActionNoRedist, b *ProtocolRedistProfileIpv6ActionNoRedist) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolRedistProfileIpv6ActionRedist(a *ProtocolRedistProfileIpv6ActionRedist, b *ProtocolRedistProfileIpv6ActionRedist) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolRedistProfileIpv6Action(a *ProtocolRedistProfileIpv6Action, b *ProtocolRedistProfileIpv6Action) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolRedistProfileIpv6ActionRedist(a.Redist, b.Redist) { + return false + } + if !matchProtocolRedistProfileIpv6ActionNoRedist(a.NoRedist, b.NoRedist) { + return false + } + return true +} +func matchProtocolRedistProfileIpv6(a []ProtocolRedistProfileIpv6, b []ProtocolRedistProfileIpv6) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Priority, b.Priority) { + return false + } + if !matchProtocolRedistProfileIpv6Filter(a.Filter, b.Filter) { + return false + } + if !matchProtocolRedistProfileIpv6Action(a.Action, b.Action) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchProtocolRipInterfaceDefaultRouteDisable(a *ProtocolRipInterfaceDefaultRouteDisable, b *ProtocolRipInterfaceDefaultRouteDisable) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolRipInterfaceDefaultRouteAdvertise(a *ProtocolRipInterfaceDefaultRouteAdvertise, b *ProtocolRipInterfaceDefaultRouteAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Metric, b.Metric) { + return false + } + return true +} +func matchProtocolRipInterfaceDefaultRoute(a *ProtocolRipInterfaceDefaultRoute, b *ProtocolRipInterfaceDefaultRoute) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolRipInterfaceDefaultRouteDisable(a.Disable, b.Disable) { + return false + } + if !matchProtocolRipInterfaceDefaultRouteAdvertise(a.Advertise, b.Advertise) { + return false + } + return true +} +func matchProtocolRipInterfaceBfd(a *ProtocolRipInterfaceBfd, b *ProtocolRipInterfaceBfd) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } + return true +} +func matchProtocolRipInterface(a []ProtocolRipInterface, b []ProtocolRipInterface) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.StringsMatch(a.Authentication, b.Authentication) { + return false + } + if !util.StringsMatch(a.Mode, b.Mode) { + return false + } + if !matchProtocolRipInterfaceDefaultRoute(a.DefaultRoute, b.DefaultRoute) { + return false + } + if !matchProtocolRipInterfaceBfd(a.Bfd, b.Bfd) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchProtocolRipTimers(a *ProtocolRipTimers, b *ProtocolRipTimers) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.DeleteIntervals, b.DeleteIntervals) { + return false + } + if !util.Ints64Match(a.ExpireIntervals, b.ExpireIntervals) { + return false + } + if !util.Ints64Match(a.IntervalSeconds, b.IntervalSeconds) { + return false + } + if !util.Ints64Match(a.UpdateIntervals, b.UpdateIntervals) { + return false + } + return true +} +func matchProtocolRipAuthProfileMd5(a []ProtocolRipAuthProfileMd5, b []ProtocolRipAuthProfileMd5) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.Preferred, b.Preferred) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.Key, b.Key) { + return false + } + } + } + return true +} +func matchProtocolRipAuthProfile(a []ProtocolRipAuthProfile, b []ProtocolRipAuthProfile) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.Password, b.Password) { + return false + } + if !matchProtocolRipAuthProfileMd5(a.Md5, b.Md5) { + return false + } + } + } + return true +} +func matchProtocolRipExportRules(a []ProtocolRipExportRules, b []ProtocolRipExportRules) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Metric, b.Metric) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchProtocolRipGlobalBfd(a *ProtocolRipGlobalBfd, b *ProtocolRipGlobalBfd) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } + return true +} +func matchProtocolRip(a *ProtocolRip, b *ProtocolRip) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolRipTimers(a.Timers, b.Timers) { + return false + } + if !util.BoolsMatch(a.AllowRedistDefaultRoute, b.AllowRedistDefaultRoute) { + return false + } + if !matchProtocolRipAuthProfile(a.AuthProfile, b.AuthProfile) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchProtocolRipExportRules(a.ExportRules, b.ExportRules) { + return false + } + if !matchProtocolRipGlobalBfd(a.GlobalBfd, b.GlobalBfd) { + return false + } + if !matchProtocolRipInterface(a.Interface, b.Interface) { + return false + } + if !util.BoolsMatch(a.RejectDefaultRoute, b.RejectDefaultRoute) { + return false + } + return true +} +func matchProtocolBgpGlobalBfd(a *ProtocolBgpGlobalBfd, b *ProtocolBgpGlobalBfd) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } + return true +} +func matchProtocolBgpPeerGroupTypeIbgp(a *ProtocolBgpPeerGroupTypeIbgp, b *ProtocolBgpPeerGroupTypeIbgp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.ExportNexthop, b.ExportNexthop) { + return false + } + return true +} +func matchProtocolBgpPeerGroupTypeEbgpConfed(a *ProtocolBgpPeerGroupTypeEbgpConfed, b *ProtocolBgpPeerGroupTypeEbgpConfed) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.ExportNexthop, b.ExportNexthop) { + return false + } + return true +} +func matchProtocolBgpPeerGroupTypeIbgpConfed(a *ProtocolBgpPeerGroupTypeIbgpConfed, b *ProtocolBgpPeerGroupTypeIbgpConfed) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.ExportNexthop, b.ExportNexthop) { + return false + } + return true +} +func matchProtocolBgpPeerGroupTypeEbgp(a *ProtocolBgpPeerGroupTypeEbgp, b *ProtocolBgpPeerGroupTypeEbgp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.ImportNexthop, b.ImportNexthop) { + return false + } + if !util.StringsMatch(a.ExportNexthop, b.ExportNexthop) { + return false + } + if !util.BoolsMatch(a.RemovePrivateAs, b.RemovePrivateAs) { + return false + } + return true +} +func matchProtocolBgpPeerGroupType(a *ProtocolBgpPeerGroupType, b *ProtocolBgpPeerGroupType) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPeerGroupTypeIbgpConfed(a.IbgpConfed, b.IbgpConfed) { + return false + } + if !matchProtocolBgpPeerGroupTypeEbgp(a.Ebgp, b.Ebgp) { + return false + } + if !matchProtocolBgpPeerGroupTypeIbgp(a.Ibgp, b.Ibgp) { + return false + } + if !matchProtocolBgpPeerGroupTypeEbgpConfed(a.EbgpConfed, b.EbgpConfed) { + return false + } + return true +} +func matchProtocolBgpPeerGroupPeerLocalAddress(a *ProtocolBgpPeerGroupPeerLocalAddress, b *ProtocolBgpPeerGroupPeerLocalAddress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Interface, b.Interface) { + return false + } + if !util.StringsMatch(a.Ip, b.Ip) { + return false + } + return true +} +func matchProtocolBgpPeerGroupPeerConnectionOptionsIncomingBgpConnection(a *ProtocolBgpPeerGroupPeerConnectionOptionsIncomingBgpConnection, b *ProtocolBgpPeerGroupPeerConnectionOptionsIncomingBgpConnection) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.RemotePort, b.RemotePort) { + return false + } + if !util.BoolsMatch(a.Allow, b.Allow) { + return false + } + return true +} +func matchProtocolBgpPeerGroupPeerConnectionOptionsOutgoingBgpConnection(a *ProtocolBgpPeerGroupPeerConnectionOptionsOutgoingBgpConnection, b *ProtocolBgpPeerGroupPeerConnectionOptionsOutgoingBgpConnection) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.LocalPort, b.LocalPort) { + return false + } + if !util.BoolsMatch(a.Allow, b.Allow) { + return false + } + return true +} +func matchProtocolBgpPeerGroupPeerConnectionOptions(a *ProtocolBgpPeerGroupPeerConnectionOptions, b *ProtocolBgpPeerGroupPeerConnectionOptions) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Authentication, b.Authentication) { + return false + } + if !util.Ints64Match(a.MinRouteAdvInterval, b.MinRouteAdvInterval) { + return false + } + if !util.Ints64Match(a.Multihop, b.Multihop) { + return false + } + if !util.Ints64Match(a.OpenDelayTime, b.OpenDelayTime) { + return false + } + if !matchProtocolBgpPeerGroupPeerConnectionOptionsOutgoingBgpConnection(a.OutgoingBgpConnection, b.OutgoingBgpConnection) { + return false + } + if !util.StringsMatch(a.KeepAliveInterval, b.KeepAliveInterval) { + return false + } + if !util.StringsMatch(a.HoldTime, b.HoldTime) { + return false + } + if !util.Ints64Match(a.IdleHoldTime, b.IdleHoldTime) { + return false + } + if !matchProtocolBgpPeerGroupPeerConnectionOptionsIncomingBgpConnection(a.IncomingBgpConnection, b.IncomingBgpConnection) { + return false + } + return true +} +func matchProtocolBgpPeerGroupPeerSubsequentAddressFamilyIdentifier(a *ProtocolBgpPeerGroupPeerSubsequentAddressFamilyIdentifier, b *ProtocolBgpPeerGroupPeerSubsequentAddressFamilyIdentifier) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Unicast, b.Unicast) { + return false + } + if !util.BoolsMatch(a.Multicast, b.Multicast) { + return false + } + return true +} +func matchProtocolBgpPeerGroupPeerPeerAddress(a *ProtocolBgpPeerGroupPeerPeerAddress, b *ProtocolBgpPeerGroupPeerPeerAddress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Ip, b.Ip) { + return false + } + if !util.StringsMatch(a.Fqdn, b.Fqdn) { + return false + } + return true +} +func matchProtocolBgpPeerGroupPeerBfd(a *ProtocolBgpPeerGroupPeerBfd, b *ProtocolBgpPeerGroupPeerBfd) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } + return true +} +func matchProtocolBgpPeerGroupPeer(a []ProtocolBgpPeerGroupPeer, b []ProtocolBgpPeerGroupPeer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.PeerAs, b.PeerAs) { + return false + } + if !util.StringsMatch(a.ReflectorClient, b.ReflectorClient) { + return false + } + if !matchProtocolBgpPeerGroupPeerSubsequentAddressFamilyIdentifier(a.SubsequentAddressFamilyIdentifier, b.SubsequentAddressFamilyIdentifier) { + return false + } + if !matchProtocolBgpPeerGroupPeerConnectionOptions(a.ConnectionOptions, b.ConnectionOptions) { + return false + } + if !util.BoolsMatch(a.EnableMpBgp, b.EnableMpBgp) { + return false + } + if !util.StringsMatch(a.AddressFamilyIdentifier, b.AddressFamilyIdentifier) { + return false + } + if !util.StringsMatch(a.MaxPrefixes, b.MaxPrefixes) { + return false + } + if !matchProtocolBgpPeerGroupPeerPeerAddress(a.PeerAddress, b.PeerAddress) { + return false + } + if !matchProtocolBgpPeerGroupPeerBfd(a.Bfd, b.Bfd) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.BoolsMatch(a.EnableSenderSideLoopDetection, b.EnableSenderSideLoopDetection) { + return false + } + if !util.StringsMatch(a.PeeringType, b.PeeringType) { + return false + } + if !matchProtocolBgpPeerGroupPeerLocalAddress(a.LocalAddress, b.LocalAddress) { + return false + } + } + } + return true +} +func matchProtocolBgpPeerGroup(a []ProtocolBgpPeerGroup, b []ProtocolBgpPeerGroup) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !matchProtocolBgpPeerGroupType(a.Type, b.Type) { + return false + } + if !matchProtocolBgpPeerGroupPeer(a.Peer, b.Peer) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.BoolsMatch(a.AggregatedConfedAsPath, b.AggregatedConfedAsPath) { + return false + } + if !util.BoolsMatch(a.SoftResetWithStoredInfo, b.SoftResetWithStoredInfo) { + return false + } + } + } + return true +} +func matchProtocolBgpRedistRules(a []ProtocolBgpRedistRules, b []ProtocolBgpRedistRules) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.AddressFamilyIdentifier, b.AddressFamilyIdentifier) { + return false + } + if !util.StringsMatch(a.SetOrigin, b.SetOrigin) { + return false + } + if !util.OrderedListsMatch(a.SetExtendedCommunity, b.SetExtendedCommunity) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.OrderedListsMatch(a.SetCommunity, b.SetCommunity) { + return false + } + if !util.StringsMatch(a.RouteTable, b.RouteTable) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.SetMed, b.SetMed) { + return false + } + if !util.Ints64Match(a.SetLocalPreference, b.SetLocalPreference) { + return false + } + if !util.Ints64Match(a.SetAsPathLimit, b.SetAsPathLimit) { + return false + } + if !util.Ints64Match(a.Metric, b.Metric) { + return false + } + } + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityNone(a *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityNone, b *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityRemoveAll(a *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityRemoveAll, b *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityRemoveAll) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunity(a *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunity, b *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityNone(a.None, b.None) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunityRemoveAll(a.RemoveAll, b.RemoveAll) { + return false + } + if !util.StringsMatch(a.RemoveRegex, b.RemoveRegex) { + return false + } + if !util.OrderedListsMatch(a.Append, b.Append) { + return false + } + if !util.OrderedListsMatch(a.Overwrite, b.Overwrite) { + return false + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathNone(a *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathNone, b *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathRemove(a *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathRemove, b *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathRemove) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPath(a *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPath, b *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPath) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathNone(a.None, b.None) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPathRemove(a.Remove, b.Remove) { + return false + } + if !util.Ints64Match(a.Prepend, b.Prepend) { + return false + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityRemoveAll(a *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityRemoveAll, b *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityRemoveAll) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityNone(a *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityNone, b *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunity(a *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunity, b *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityNone(a.None, b.None) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunityRemoveAll(a.RemoveAll, b.RemoveAll) { + return false + } + if !util.StringsMatch(a.RemoveRegex, b.RemoveRegex) { + return false + } + if !util.OrderedListsMatch(a.Append, b.Append) { + return false + } + if !util.OrderedListsMatch(a.Overwrite, b.Overwrite) { + return false + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributes(a *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributes, b *ProtocolBgpPolicyAggregationAddressAggregateRouteAttributes) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesAsPath(a.AsPath, b.AsPath) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesCommunity(a.Community, b.Community) { + return false + } + if !util.Ints64Match(a.LocalPreference, b.LocalPreference) { + return false + } + if !util.Ints64Match(a.Med, b.Med) { + return false + } + if !util.Ints64Match(a.Weight, b.Weight) { + return false + } + if !util.StringsMatch(a.Nexthop, b.Nexthop) { + return false + } + if !util.StringsMatch(a.Origin, b.Origin) { + return false + } + if !util.Ints64Match(a.AsPathLimit, b.AsPathLimit) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributesExtendedCommunity(a.ExtendedCommunity, b.ExtendedCommunity) { + return false + } + return true +} +func matchProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAsPath(a *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAsPath, b *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAsPath) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyAggregationAddressSuppressFiltersMatchCommunity(a *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchCommunity, b *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyAggregationAddressSuppressFiltersMatchExtendedCommunity(a *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchExtendedCommunity, b *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchExtendedCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix(a []ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix, b []ProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.Exact, b.Exact) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchProtocolBgpPolicyAggregationAddressSuppressFiltersMatch(a *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatch, b *ProtocolBgpPolicyAggregationAddressSuppressFiltersMatch) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Med, b.Med) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAddressPrefix(a.AddressPrefix, b.AddressPrefix) { + return false + } + if !util.OrderedListsMatch(a.Nexthop, b.Nexthop) { + return false + } + if !util.OrderedListsMatch(a.FromPeer, b.FromPeer) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressSuppressFiltersMatchAsPath(a.AsPath, b.AsPath) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressSuppressFiltersMatchCommunity(a.Community, b.Community) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressSuppressFiltersMatchExtendedCommunity(a.ExtendedCommunity, b.ExtendedCommunity) { + return false + } + if !util.StringsMatch(a.RouteTable, b.RouteTable) { + return false + } + return true +} +func matchProtocolBgpPolicyAggregationAddressSuppressFilters(a []ProtocolBgpPolicyAggregationAddressSuppressFilters, b []ProtocolBgpPolicyAggregationAddressSuppressFilters) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressSuppressFiltersMatch(a.Match, b.Match) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix(a []ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix, b []ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.Exact, b.Exact) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAsPath(a *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAsPath, b *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAsPath) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchCommunity(a *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchCommunity, b *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchExtendedCommunity(a *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchExtendedCommunity, b *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchExtendedCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatch(a *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatch, b *ProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatch) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.RouteTable, b.RouteTable) { + return false + } + if !util.Ints64Match(a.Med, b.Med) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAddressPrefix(a.AddressPrefix, b.AddressPrefix) { + return false + } + if !util.OrderedListsMatch(a.Nexthop, b.Nexthop) { + return false + } + if !util.OrderedListsMatch(a.FromPeer, b.FromPeer) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchAsPath(a.AsPath, b.AsPath) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchCommunity(a.Community, b.Community) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatchExtendedCommunity(a.ExtendedCommunity, b.ExtendedCommunity) { + return false + } + return true +} +func matchProtocolBgpPolicyAggregationAddressAdvertiseFilters(a []ProtocolBgpPolicyAggregationAddressAdvertiseFilters, b []ProtocolBgpPolicyAggregationAddressAdvertiseFilters) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressAdvertiseFiltersMatch(a.Match, b.Match) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchProtocolBgpPolicyAggregationAddress(a []ProtocolBgpPolicyAggregationAddress, b []ProtocolBgpPolicyAggregationAddress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.Prefix, b.Prefix) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.BoolsMatch(a.Summary, b.Summary) { + return false + } + if !util.BoolsMatch(a.AsSet, b.AsSet) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressAggregateRouteAttributes(a.AggregateRouteAttributes, b.AggregateRouteAttributes) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressSuppressFilters(a.SuppressFilters, b.SuppressFilters) { + return false + } + if !matchProtocolBgpPolicyAggregationAddressAdvertiseFilters(a.AdvertiseFilters, b.AdvertiseFilters) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchProtocolBgpPolicyAggregation(a *ProtocolBgpPolicyAggregation, b *ProtocolBgpPolicyAggregation) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyAggregationAddress(a.Address, b.Address) { + return false + } + return true +} +func matchProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix(a []ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix, b []ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAsPath(a *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAsPath, b *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAsPath) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchCommunity(a *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchCommunity, b *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchExtendedCommunity(a *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchExtendedCommunity, b *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchExtendedCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatch(a *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatch, b *ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatch) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAsPath(a.AsPath, b.AsPath) { + return false + } + if !matchProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchCommunity(a.Community, b.Community) { + return false + } + if !matchProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchExtendedCommunity(a.ExtendedCommunity, b.ExtendedCommunity) { + return false + } + if !util.StringsMatch(a.RouteTable, b.RouteTable) { + return false + } + if !util.Ints64Match(a.Med, b.Med) { + return false + } + if !matchProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatchAddressPrefix(a.AddressPrefix, b.AddressPrefix) { + return false + } + if !util.OrderedListsMatch(a.Nexthop, b.Nexthop) { + return false + } + if !util.OrderedListsMatch(a.FromPeer, b.FromPeer) { + return false + } + return true +} +func matchProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters(a []ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters, b []ProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFiltersMatch(a.Match, b.Match) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAsPath(a *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAsPath, b *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAsPath) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchCommunity(a *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchCommunity, b *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchExtendedCommunity(a *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchExtendedCommunity, b *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchExtendedCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix(a []ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix, b []ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } } - if o.AdministrativeDistances.OspfExt != nil { - nestedAdministrativeDistances.OspfExt = o.AdministrativeDistances.OspfExt + } + return true +} +func matchProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatch(a *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatch, b *ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatch) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.RouteTable, b.RouteTable) { + return false + } + if !util.Ints64Match(a.Med, b.Med) { + return false + } + if !matchProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAddressPrefix(a.AddressPrefix, b.AddressPrefix) { + return false + } + if !util.OrderedListsMatch(a.Nexthop, b.Nexthop) { + return false + } + if !util.OrderedListsMatch(a.FromPeer, b.FromPeer) { + return false + } + if !matchProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchAsPath(a.AsPath, b.AsPath) { + return false + } + if !matchProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchCommunity(a.Community, b.Community) { + return false + } + if !matchProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatchExtendedCommunity(a.ExtendedCommunity, b.ExtendedCommunity) { + return false + } + return true +} +func matchProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters(a []ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters, b []ProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFiltersMatch(a.Match, b.Match) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } } - if o.AdministrativeDistances.Ospfv3Int != nil { - nestedAdministrativeDistances.Ospfv3Int = o.AdministrativeDistances.Ospfv3Int + } + return true +} +func matchProtocolBgpPolicyConditionalAdvertisementPolicy(a []ProtocolBgpPolicyConditionalAdvertisementPolicy, b []ProtocolBgpPolicyConditionalAdvertisementPolicy) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.OrderedListsMatch(a.UsedBy, b.UsedBy) { + return false + } + if !matchProtocolBgpPolicyConditionalAdvertisementPolicyNonExistFilters(a.NonExistFilters, b.NonExistFilters) { + return false + } + if !matchProtocolBgpPolicyConditionalAdvertisementPolicyAdvertiseFilters(a.AdvertiseFilters, b.AdvertiseFilters) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } } - if o.AdministrativeDistances.Ospfv3Ext != nil { - nestedAdministrativeDistances.Ospfv3Ext = o.AdministrativeDistances.Ospfv3Ext + } + return true +} +func matchProtocolBgpPolicyConditionalAdvertisement(a *ProtocolBgpPolicyConditionalAdvertisement, b *ProtocolBgpPolicyConditionalAdvertisement) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyConditionalAdvertisementPolicy(a.Policy, b.Policy) { + return false + } + return true +} +func matchProtocolBgpPolicyExportRulesMatchAsPath(a *ProtocolBgpPolicyExportRulesMatchAsPath, b *ProtocolBgpPolicyExportRulesMatchAsPath) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyExportRulesMatchCommunity(a *ProtocolBgpPolicyExportRulesMatchCommunity, b *ProtocolBgpPolicyExportRulesMatchCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyExportRulesMatchExtendedCommunity(a *ProtocolBgpPolicyExportRulesMatchExtendedCommunity, b *ProtocolBgpPolicyExportRulesMatchExtendedCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyExportRulesMatchAddressPrefix(a []ProtocolBgpPolicyExportRulesMatchAddressPrefix, b []ProtocolBgpPolicyExportRulesMatchAddressPrefix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.Exact, b.Exact) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } } - if o.AdministrativeDistances.Ibgp != nil { - nestedAdministrativeDistances.Ibgp = o.AdministrativeDistances.Ibgp + } + return true +} +func matchProtocolBgpPolicyExportRulesMatch(a *ProtocolBgpPolicyExportRulesMatch, b *ProtocolBgpPolicyExportRulesMatch) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.OrderedListsMatch(a.Nexthop, b.Nexthop) { + return false + } + if !util.OrderedListsMatch(a.FromPeer, b.FromPeer) { + return false + } + if !matchProtocolBgpPolicyExportRulesMatchAsPath(a.AsPath, b.AsPath) { + return false + } + if !matchProtocolBgpPolicyExportRulesMatchCommunity(a.Community, b.Community) { + return false + } + if !matchProtocolBgpPolicyExportRulesMatchExtendedCommunity(a.ExtendedCommunity, b.ExtendedCommunity) { + return false + } + if !util.StringsMatch(a.RouteTable, b.RouteTable) { + return false + } + if !util.Ints64Match(a.Med, b.Med) { + return false + } + if !matchProtocolBgpPolicyExportRulesMatchAddressPrefix(a.AddressPrefix, b.AddressPrefix) { + return false + } + return true +} +func matchProtocolBgpPolicyExportRulesActionDeny(a *ProtocolBgpPolicyExportRulesActionDeny, b *ProtocolBgpPolicyExportRulesActionDeny) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyExportRulesActionAllowUpdateAsPathNone(a *ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathNone, b *ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyExportRulesActionAllowUpdateAsPathRemove(a *ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathRemove, b *ProtocolBgpPolicyExportRulesActionAllowUpdateAsPathRemove) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyExportRulesActionAllowUpdateAsPath(a *ProtocolBgpPolicyExportRulesActionAllowUpdateAsPath, b *ProtocolBgpPolicyExportRulesActionAllowUpdateAsPath) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyExportRulesActionAllowUpdateAsPathNone(a.None, b.None) { + return false + } + if !matchProtocolBgpPolicyExportRulesActionAllowUpdateAsPathRemove(a.Remove, b.Remove) { + return false + } + if !util.Ints64Match(a.Prepend, b.Prepend) { + return false + } + if !util.Ints64Match(a.RemoveAndPrepend, b.RemoveAndPrepend) { + return false + } + return true +} +func matchProtocolBgpPolicyExportRulesActionAllowUpdateCommunityNone(a *ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityNone, b *ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyExportRulesActionAllowUpdateCommunityRemoveAll(a *ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityRemoveAll, b *ProtocolBgpPolicyExportRulesActionAllowUpdateCommunityRemoveAll) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyExportRulesActionAllowUpdateCommunity(a *ProtocolBgpPolicyExportRulesActionAllowUpdateCommunity, b *ProtocolBgpPolicyExportRulesActionAllowUpdateCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyExportRulesActionAllowUpdateCommunityNone(a.None, b.None) { + return false + } + if !matchProtocolBgpPolicyExportRulesActionAllowUpdateCommunityRemoveAll(a.RemoveAll, b.RemoveAll) { + return false + } + if !util.StringsMatch(a.RemoveRegex, b.RemoveRegex) { + return false + } + if !util.OrderedListsMatch(a.Append, b.Append) { + return false + } + if !util.OrderedListsMatch(a.Overwrite, b.Overwrite) { + return false + } + return true +} +func matchProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityNone(a *ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityNone, b *ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityRemoveAll(a *ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityRemoveAll, b *ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityRemoveAll) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunity(a *ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunity, b *ProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.OrderedListsMatch(a.Append, b.Append) { + return false + } + if !util.OrderedListsMatch(a.Overwrite, b.Overwrite) { + return false + } + if !matchProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityNone(a.None, b.None) { + return false + } + if !matchProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunityRemoveAll(a.RemoveAll, b.RemoveAll) { + return false + } + if !util.StringsMatch(a.RemoveRegex, b.RemoveRegex) { + return false + } + return true +} +func matchProtocolBgpPolicyExportRulesActionAllowUpdate(a *ProtocolBgpPolicyExportRulesActionAllowUpdate, b *ProtocolBgpPolicyExportRulesActionAllowUpdate) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyExportRulesActionAllowUpdateExtendedCommunity(a.ExtendedCommunity, b.ExtendedCommunity) { + return false + } + if !util.Ints64Match(a.LocalPreference, b.LocalPreference) { + return false + } + if !util.Ints64Match(a.Med, b.Med) { + return false + } + if !util.StringsMatch(a.Nexthop, b.Nexthop) { + return false + } + if !util.StringsMatch(a.Origin, b.Origin) { + return false + } + if !util.Ints64Match(a.AsPathLimit, b.AsPathLimit) { + return false + } + if !matchProtocolBgpPolicyExportRulesActionAllowUpdateAsPath(a.AsPath, b.AsPath) { + return false + } + if !matchProtocolBgpPolicyExportRulesActionAllowUpdateCommunity(a.Community, b.Community) { + return false + } + return true +} +func matchProtocolBgpPolicyExportRulesActionAllow(a *ProtocolBgpPolicyExportRulesActionAllow, b *ProtocolBgpPolicyExportRulesActionAllow) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyExportRulesActionAllowUpdate(a.Update, b.Update) { + return false + } + return true +} +func matchProtocolBgpPolicyExportRulesAction(a *ProtocolBgpPolicyExportRulesAction, b *ProtocolBgpPolicyExportRulesAction) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyExportRulesActionDeny(a.Deny, b.Deny) { + return false + } + if !matchProtocolBgpPolicyExportRulesActionAllow(a.Allow, b.Allow) { + return false + } + return true +} +func matchProtocolBgpPolicyExportRules(a []ProtocolBgpPolicyExportRules, b []ProtocolBgpPolicyExportRules) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.OrderedListsMatch(a.UsedBy, b.UsedBy) { + return false + } + if !matchProtocolBgpPolicyExportRulesMatch(a.Match, b.Match) { + return false + } + if !matchProtocolBgpPolicyExportRulesAction(a.Action, b.Action) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } } - if o.AdministrativeDistances.Ebgp != nil { - nestedAdministrativeDistances.Ebgp = o.AdministrativeDistances.Ebgp + } + return true +} +func matchProtocolBgpPolicyExport(a *ProtocolBgpPolicyExport, b *ProtocolBgpPolicyExport) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyExportRules(a.Rules, b.Rules) { + return false + } + return true +} +func matchProtocolBgpPolicyImportRulesMatchAddressPrefix(a []ProtocolBgpPolicyImportRulesMatchAddressPrefix, b []ProtocolBgpPolicyImportRulesMatchAddressPrefix) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.Exact, b.Exact) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } } - if o.AdministrativeDistances.Rip != nil { - nestedAdministrativeDistances.Rip = o.AdministrativeDistances.Rip + } + return true +} +func matchProtocolBgpPolicyImportRulesMatchAsPath(a *ProtocolBgpPolicyImportRulesMatchAsPath, b *ProtocolBgpPolicyImportRulesMatchAsPath) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyImportRulesMatchCommunity(a *ProtocolBgpPolicyImportRulesMatchCommunity, b *ProtocolBgpPolicyImportRulesMatchCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyImportRulesMatchExtendedCommunity(a *ProtocolBgpPolicyImportRulesMatchExtendedCommunity, b *ProtocolBgpPolicyImportRulesMatchExtendedCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Regex, b.Regex) { + return false + } + return true +} +func matchProtocolBgpPolicyImportRulesMatch(a *ProtocolBgpPolicyImportRulesMatch, b *ProtocolBgpPolicyImportRulesMatch) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyImportRulesMatchAddressPrefix(a.AddressPrefix, b.AddressPrefix) { + return false + } + if !util.OrderedListsMatch(a.Nexthop, b.Nexthop) { + return false + } + if !util.OrderedListsMatch(a.FromPeer, b.FromPeer) { + return false + } + if !matchProtocolBgpPolicyImportRulesMatchAsPath(a.AsPath, b.AsPath) { + return false + } + if !matchProtocolBgpPolicyImportRulesMatchCommunity(a.Community, b.Community) { + return false + } + if !matchProtocolBgpPolicyImportRulesMatchExtendedCommunity(a.ExtendedCommunity, b.ExtendedCommunity) { + return false + } + if !util.StringsMatch(a.RouteTable, b.RouteTable) { + return false + } + if !util.Ints64Match(a.Med, b.Med) { + return false + } + return true +} +func matchProtocolBgpPolicyImportRulesActionDeny(a *ProtocolBgpPolicyImportRulesActionDeny, b *ProtocolBgpPolicyImportRulesActionDeny) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyImportRulesActionAllowUpdateAsPathNone(a *ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathNone, b *ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyImportRulesActionAllowUpdateAsPathRemove(a *ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathRemove, b *ProtocolBgpPolicyImportRulesActionAllowUpdateAsPathRemove) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyImportRulesActionAllowUpdateAsPath(a *ProtocolBgpPolicyImportRulesActionAllowUpdateAsPath, b *ProtocolBgpPolicyImportRulesActionAllowUpdateAsPath) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyImportRulesActionAllowUpdateAsPathNone(a.None, b.None) { + return false + } + if !matchProtocolBgpPolicyImportRulesActionAllowUpdateAsPathRemove(a.Remove, b.Remove) { + return false + } + return true +} +func matchProtocolBgpPolicyImportRulesActionAllowUpdateCommunityNone(a *ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityNone, b *ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyImportRulesActionAllowUpdateCommunityRemoveAll(a *ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityRemoveAll, b *ProtocolBgpPolicyImportRulesActionAllowUpdateCommunityRemoveAll) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyImportRulesActionAllowUpdateCommunity(a *ProtocolBgpPolicyImportRulesActionAllowUpdateCommunity, b *ProtocolBgpPolicyImportRulesActionAllowUpdateCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyImportRulesActionAllowUpdateCommunityNone(a.None, b.None) { + return false + } + if !matchProtocolBgpPolicyImportRulesActionAllowUpdateCommunityRemoveAll(a.RemoveAll, b.RemoveAll) { + return false + } + if !util.StringsMatch(a.RemoveRegex, b.RemoveRegex) { + return false + } + if !util.OrderedListsMatch(a.Append, b.Append) { + return false + } + if !util.OrderedListsMatch(a.Overwrite, b.Overwrite) { + return false + } + return true +} +func matchProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityNone(a *ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityNone, b *ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityNone) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityRemoveAll(a *ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityRemoveAll, b *ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityRemoveAll) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunity(a *ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunity, b *ProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunity) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.RemoveRegex, b.RemoveRegex) { + return false + } + if !util.OrderedListsMatch(a.Append, b.Append) { + return false + } + if !util.OrderedListsMatch(a.Overwrite, b.Overwrite) { + return false + } + if !matchProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityNone(a.None, b.None) { + return false + } + if !matchProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunityRemoveAll(a.RemoveAll, b.RemoveAll) { + return false + } + return true +} +func matchProtocolBgpPolicyImportRulesActionAllowUpdate(a *ProtocolBgpPolicyImportRulesActionAllowUpdate, b *ProtocolBgpPolicyImportRulesActionAllowUpdate) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.LocalPreference, b.LocalPreference) { + return false + } + if !util.Ints64Match(a.Weight, b.Weight) { + return false + } + if !util.StringsMatch(a.Nexthop, b.Nexthop) { + return false + } + if !matchProtocolBgpPolicyImportRulesActionAllowUpdateAsPath(a.AsPath, b.AsPath) { + return false + } + if !util.Ints64Match(a.Med, b.Med) { + return false + } + if !util.StringsMatch(a.Origin, b.Origin) { + return false + } + if !util.Ints64Match(a.AsPathLimit, b.AsPathLimit) { + return false + } + if !matchProtocolBgpPolicyImportRulesActionAllowUpdateCommunity(a.Community, b.Community) { + return false + } + if !matchProtocolBgpPolicyImportRulesActionAllowUpdateExtendedCommunity(a.ExtendedCommunity, b.ExtendedCommunity) { + return false + } + return true +} +func matchProtocolBgpPolicyImportRulesActionAllow(a *ProtocolBgpPolicyImportRulesActionAllow, b *ProtocolBgpPolicyImportRulesActionAllow) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Dampening, b.Dampening) { + return false + } + if !matchProtocolBgpPolicyImportRulesActionAllowUpdate(a.Update, b.Update) { + return false + } + return true +} +func matchProtocolBgpPolicyImportRulesAction(a *ProtocolBgpPolicyImportRulesAction, b *ProtocolBgpPolicyImportRulesAction) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyImportRulesActionAllow(a.Allow, b.Allow) { + return false + } + if !matchProtocolBgpPolicyImportRulesActionDeny(a.Deny, b.Deny) { + return false + } + return true +} +func matchProtocolBgpPolicyImportRules(a []ProtocolBgpPolicyImportRules, b []ProtocolBgpPolicyImportRules) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.OrderedListsMatch(a.UsedBy, b.UsedBy) { + return false + } + if !matchProtocolBgpPolicyImportRulesMatch(a.Match, b.Match) { + return false + } + if !matchProtocolBgpPolicyImportRulesAction(a.Action, b.Action) { + return false + } } - if o.AdministrativeDistances.StaticIpv6 != nil { - nestedAdministrativeDistances.StaticIpv6 = o.AdministrativeDistances.StaticIpv6 + } + return true +} +func matchProtocolBgpPolicyImport(a *ProtocolBgpPolicyImport, b *ProtocolBgpPolicyImport) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyImportRules(a.Rules, b.Rules) { + return false + } + return true +} +func matchProtocolBgpPolicy(a *ProtocolBgpPolicy, b *ProtocolBgpPolicy) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicyImport(a.Import, b.Import) { + return false + } + if !matchProtocolBgpPolicyAggregation(a.Aggregation, b.Aggregation) { + return false + } + if !matchProtocolBgpPolicyConditionalAdvertisement(a.ConditionalAdvertisement, b.ConditionalAdvertisement) { + return false + } + if !matchProtocolBgpPolicyExport(a.Export, b.Export) { + return false + } + return true +} +func matchProtocolBgpDampeningProfile(a []ProtocolBgpDampeningProfile, b []ProtocolBgpDampeningProfile) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.MaxHoldTime, b.MaxHoldTime) { + return false + } + if !util.Ints64Match(a.DecayHalfLifeReachable, b.DecayHalfLifeReachable) { + return false + } + if !util.Ints64Match(a.DecayHalfLifeUnreachable, b.DecayHalfLifeUnreachable) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.FloatsMatch(a.Cutoff, b.Cutoff) { + return false + } + if !util.FloatsMatch(a.Reuse, b.Reuse) { + return false + } } - if o.AdministrativeDistances.OspfInt != nil { - nestedAdministrativeDistances.OspfInt = o.AdministrativeDistances.OspfInt + } + return true +} +func matchProtocolBgpRoutingOptionsMed(a *ProtocolBgpRoutingOptionsMed, b *ProtocolBgpRoutingOptionsMed) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.AlwaysCompareMed, b.AlwaysCompareMed) { + return false + } + if !util.BoolsMatch(a.DeterministicMedComparison, b.DeterministicMedComparison) { + return false + } + return true +} +func matchProtocolBgpRoutingOptionsAggregate(a *ProtocolBgpRoutingOptionsAggregate, b *ProtocolBgpRoutingOptionsAggregate) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.AggregateMed, b.AggregateMed) { + return false + } + return true +} +func matchProtocolBgpRoutingOptionsGracefulRestart(a *ProtocolBgpRoutingOptionsGracefulRestart, b *ProtocolBgpRoutingOptionsGracefulRestart) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.LocalRestartTime, b.LocalRestartTime) { + return false + } + if !util.Ints64Match(a.MaxPeerRestartTime, b.MaxPeerRestartTime) { + return false + } + if !util.Ints64Match(a.StaleRouteTime, b.StaleRouteTime) { + return false + } + return true +} +func matchProtocolBgpRoutingOptions(a *ProtocolBgpRoutingOptions, b *ProtocolBgpRoutingOptions) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpRoutingOptionsAggregate(a.Aggregate, b.Aggregate) { + return false + } + if !util.StringsMatch(a.AsFormat, b.AsFormat) { + return false + } + if !util.StringsMatch(a.ConfederationMemberAs, b.ConfederationMemberAs) { + return false + } + if !util.Ints64Match(a.DefaultLocalPreference, b.DefaultLocalPreference) { + return false + } + if !matchProtocolBgpRoutingOptionsGracefulRestart(a.GracefulRestart, b.GracefulRestart) { + return false + } + if !matchProtocolBgpRoutingOptionsMed(a.Med, b.Med) { + return false + } + if !util.StringsMatch(a.ReflectorClusterId, b.ReflectorClusterId) { + return false + } + return true +} +func matchProtocolBgpAuthProfile(a []ProtocolBgpAuthProfile, b []ProtocolBgpAuthProfile) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.Secret, b.Secret) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } } - if o.AdministrativeDistances.Static != nil { - nestedAdministrativeDistances.Static = o.AdministrativeDistances.Static + } + return true +} +func matchProtocolBgp(a *ProtocolBgp, b *ProtocolBgp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolBgpPolicy(a.Policy, b.Policy) { + return false + } + if !matchProtocolBgpDampeningProfile(a.DampeningProfile, b.DampeningProfile) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.BoolsMatch(a.InstallRoute, b.InstallRoute) { + return false + } + if !matchProtocolBgpRoutingOptions(a.RoutingOptions, b.RoutingOptions) { + return false + } + if !matchProtocolBgpAuthProfile(a.AuthProfile, b.AuthProfile) { + return false + } + if !util.BoolsMatch(a.EcmpMultiAs, b.EcmpMultiAs) { + return false + } + if !matchProtocolBgpGlobalBfd(a.GlobalBfd, b.GlobalBfd) { + return false + } + if !util.StringsMatch(a.LocalAs, b.LocalAs) { + return false + } + if !util.StringsMatch(a.RouterId, b.RouterId) { + return false + } + if !util.BoolsMatch(a.AllowRedistDefaultRoute, b.AllowRedistDefaultRoute) { + return false + } + if !matchProtocolBgpPeerGroup(a.PeerGroup, b.PeerGroup) { + return false + } + if !matchProtocolBgpRedistRules(a.RedistRules, b.RedistRules) { + return false + } + if !util.BoolsMatch(a.RejectDefaultRoute, b.RejectDefaultRoute) { + return false + } + if !util.BoolsMatch(a.EnforceFirstAs, b.EnforceFirstAs) { + return false + } + return true +} +func matchProtocolOspfGracefulRestart(a *ProtocolOspfGracefulRestart, b *ProtocolOspfGracefulRestart) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.MaxNeighborRestartTime, b.MaxNeighborRestartTime) { + return false + } + if !util.BoolsMatch(a.StrictLSAChecking, b.StrictLSAChecking) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.GracePeriod, b.GracePeriod) { + return false + } + if !util.BoolsMatch(a.HelperEnable, b.HelperEnable) { + return false + } + return true +} +func matchProtocolOspfGlobalBfd(a *ProtocolOspfGlobalBfd, b *ProtocolOspfGlobalBfd) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } + return true +} +func matchProtocolOspfExportRules(a []ProtocolOspfExportRules, b []ProtocolOspfExportRules) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.NewPathType, b.NewPathType) { + return false + } + if !util.StringsMatch(a.NewTag, b.NewTag) { + return false + } + if !util.Ints64Match(a.Metric, b.Metric) { + return false + } } } - entry.AdministrativeDistances = nestedAdministrativeDistances - - var nestedEcmp *EcmpXml - if o.Ecmp != nil { - nestedEcmp = &EcmpXml{} - if _, ok := o.Misc["Ecmp"]; ok { - nestedEcmp.Misc = o.Misc["Ecmp"] - } - if o.Ecmp.MaxPaths != nil { - nestedEcmp.MaxPaths = o.Ecmp.MaxPaths - } - if o.Ecmp.Algorithm != nil { - nestedEcmp.Algorithm = &EcmpAlgorithmXml{} - if _, ok := o.Misc["EcmpAlgorithm"]; ok { - nestedEcmp.Algorithm.Misc = o.Misc["EcmpAlgorithm"] + return true +} +func matchProtocolOspfTimers(a *ProtocolOspfTimers, b *ProtocolOspfTimers) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.FloatsMatch(a.SpfCalculationDelay, b.SpfCalculationDelay) { + return false + } + if !util.FloatsMatch(a.LsaInterval, b.LsaInterval) { + return false + } + return true +} +func matchProtocolOspfAreaTypeNormal(a *ProtocolOspfAreaTypeNormal, b *ProtocolOspfAreaTypeNormal) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfAreaTypeStubDefaultRouteDisable(a *ProtocolOspfAreaTypeStubDefaultRouteDisable, b *ProtocolOspfAreaTypeStubDefaultRouteDisable) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfAreaTypeStubDefaultRouteAdvertise(a *ProtocolOspfAreaTypeStubDefaultRouteAdvertise, b *ProtocolOspfAreaTypeStubDefaultRouteAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Metric, b.Metric) { + return false + } + return true +} +func matchProtocolOspfAreaTypeStubDefaultRoute(a *ProtocolOspfAreaTypeStubDefaultRoute, b *ProtocolOspfAreaTypeStubDefaultRoute) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolOspfAreaTypeStubDefaultRouteDisable(a.Disable, b.Disable) { + return false + } + if !matchProtocolOspfAreaTypeStubDefaultRouteAdvertise(a.Advertise, b.Advertise) { + return false + } + return true +} +func matchProtocolOspfAreaTypeStub(a *ProtocolOspfAreaTypeStub, b *ProtocolOspfAreaTypeStub) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.AcceptSummary, b.AcceptSummary) { + return false + } + if !matchProtocolOspfAreaTypeStubDefaultRoute(a.DefaultRoute, b.DefaultRoute) { + return false + } + return true +} +func matchProtocolOspfAreaTypeNssaDefaultRouteDisable(a *ProtocolOspfAreaTypeNssaDefaultRouteDisable, b *ProtocolOspfAreaTypeNssaDefaultRouteDisable) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfAreaTypeNssaDefaultRouteAdvertise(a *ProtocolOspfAreaTypeNssaDefaultRouteAdvertise, b *ProtocolOspfAreaTypeNssaDefaultRouteAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Metric, b.Metric) { + return false + } + if !util.StringsMatch(a.Type, b.Type) { + return false + } + return true +} +func matchProtocolOspfAreaTypeNssaDefaultRoute(a *ProtocolOspfAreaTypeNssaDefaultRoute, b *ProtocolOspfAreaTypeNssaDefaultRoute) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolOspfAreaTypeNssaDefaultRouteDisable(a.Disable, b.Disable) { + return false + } + if !matchProtocolOspfAreaTypeNssaDefaultRouteAdvertise(a.Advertise, b.Advertise) { + return false + } + return true +} +func matchProtocolOspfAreaTypeNssaNssaExtRangeAdvertise(a *ProtocolOspfAreaTypeNssaNssaExtRangeAdvertise, b *ProtocolOspfAreaTypeNssaNssaExtRangeAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfAreaTypeNssaNssaExtRangeSuppress(a *ProtocolOspfAreaTypeNssaNssaExtRangeSuppress, b *ProtocolOspfAreaTypeNssaNssaExtRangeSuppress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfAreaTypeNssaNssaExtRange(a []ProtocolOspfAreaTypeNssaNssaExtRange, b []ProtocolOspfAreaTypeNssaNssaExtRange) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false } - if o.Ecmp.Algorithm.WeightedRoundRobin != nil { - nestedEcmp.Algorithm.WeightedRoundRobin = &EcmpAlgorithmWeightedRoundRobinXml{} - if _, ok := o.Misc["EcmpAlgorithmWeightedRoundRobin"]; ok { - nestedEcmp.Algorithm.WeightedRoundRobin.Misc = o.Misc["EcmpAlgorithmWeightedRoundRobin"] - } - if o.Ecmp.Algorithm.WeightedRoundRobin.Interfaces != nil { - nestedEcmp.Algorithm.WeightedRoundRobin.Interfaces = []EcmpAlgorithmWeightedRoundRobinInterfacesXml{} - for _, oEcmpAlgorithmWeightedRoundRobinInterfaces := range o.Ecmp.Algorithm.WeightedRoundRobin.Interfaces { - nestedEcmpAlgorithmWeightedRoundRobinInterfaces := EcmpAlgorithmWeightedRoundRobinInterfacesXml{} - if _, ok := o.Misc["EcmpAlgorithmWeightedRoundRobinInterfaces"]; ok { - nestedEcmpAlgorithmWeightedRoundRobinInterfaces.Misc = o.Misc["EcmpAlgorithmWeightedRoundRobinInterfaces"] - } - if oEcmpAlgorithmWeightedRoundRobinInterfaces.Weight != nil { - nestedEcmpAlgorithmWeightedRoundRobinInterfaces.Weight = oEcmpAlgorithmWeightedRoundRobinInterfaces.Weight - } - if oEcmpAlgorithmWeightedRoundRobinInterfaces.Name != "" { - nestedEcmpAlgorithmWeightedRoundRobinInterfaces.Name = oEcmpAlgorithmWeightedRoundRobinInterfaces.Name - } - nestedEcmp.Algorithm.WeightedRoundRobin.Interfaces = append(nestedEcmp.Algorithm.WeightedRoundRobin.Interfaces, nestedEcmpAlgorithmWeightedRoundRobinInterfaces) - } - } + if !matchProtocolOspfAreaTypeNssaNssaExtRangeAdvertise(a.Advertise, b.Advertise) { + return false } - if o.Ecmp.Algorithm.BalancedRoundRobin != nil { - nestedEcmp.Algorithm.BalancedRoundRobin = &EcmpAlgorithmBalancedRoundRobinXml{} - if _, ok := o.Misc["EcmpAlgorithmBalancedRoundRobin"]; ok { - nestedEcmp.Algorithm.BalancedRoundRobin.Misc = o.Misc["EcmpAlgorithmBalancedRoundRobin"] - } + if !matchProtocolOspfAreaTypeNssaNssaExtRangeSuppress(a.Suppress, b.Suppress) { + return false } - if o.Ecmp.Algorithm.IpModulo != nil { - nestedEcmp.Algorithm.IpModulo = &EcmpAlgorithmIpModuloXml{} - if _, ok := o.Misc["EcmpAlgorithmIpModulo"]; ok { - nestedEcmp.Algorithm.IpModulo.Misc = o.Misc["EcmpAlgorithmIpModulo"] - } + } + } + return true +} +func matchProtocolOspfAreaTypeNssa(a *ProtocolOspfAreaTypeNssa, b *ProtocolOspfAreaTypeNssa) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.AcceptSummary, b.AcceptSummary) { + return false + } + if !matchProtocolOspfAreaTypeNssaDefaultRoute(a.DefaultRoute, b.DefaultRoute) { + return false + } + if !matchProtocolOspfAreaTypeNssaNssaExtRange(a.NssaExtRange, b.NssaExtRange) { + return false + } + return true +} +func matchProtocolOspfAreaType(a *ProtocolOspfAreaType, b *ProtocolOspfAreaType) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolOspfAreaTypeStub(a.Stub, b.Stub) { + return false + } + if !matchProtocolOspfAreaTypeNssa(a.Nssa, b.Nssa) { + return false + } + if !matchProtocolOspfAreaTypeNormal(a.Normal, b.Normal) { + return false + } + return true +} +func matchProtocolOspfAreaRangeAdvertise(a *ProtocolOspfAreaRangeAdvertise, b *ProtocolOspfAreaRangeAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfAreaRangeSuppress(a *ProtocolOspfAreaRangeSuppress, b *ProtocolOspfAreaRangeSuppress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfAreaRange(a []ProtocolOspfAreaRange, b []ProtocolOspfAreaRange) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false } - if o.Ecmp.Algorithm.IpHash != nil { - nestedEcmp.Algorithm.IpHash = &EcmpAlgorithmIpHashXml{} - if _, ok := o.Misc["EcmpAlgorithmIpHash"]; ok { - nestedEcmp.Algorithm.IpHash.Misc = o.Misc["EcmpAlgorithmIpHash"] - } - if o.Ecmp.Algorithm.IpHash.SrcOnly != nil { - nestedEcmp.Algorithm.IpHash.SrcOnly = util.YesNo(o.Ecmp.Algorithm.IpHash.SrcOnly, nil) - } - if o.Ecmp.Algorithm.IpHash.UsePort != nil { - nestedEcmp.Algorithm.IpHash.UsePort = util.YesNo(o.Ecmp.Algorithm.IpHash.UsePort, nil) - } - if o.Ecmp.Algorithm.IpHash.HashSeed != nil { - nestedEcmp.Algorithm.IpHash.HashSeed = o.Ecmp.Algorithm.IpHash.HashSeed - } + if !matchProtocolOspfAreaRangeAdvertise(a.Advertise, b.Advertise) { + return false + } + if !matchProtocolOspfAreaRangeSuppress(a.Suppress, b.Suppress) { + return false } - } - if o.Ecmp.Enable != nil { - nestedEcmp.Enable = util.YesNo(o.Ecmp.Enable, nil) - } - if o.Ecmp.SymmetricReturn != nil { - nestedEcmp.SymmetricReturn = util.YesNo(o.Ecmp.SymmetricReturn, nil) - } - if o.Ecmp.StrictSourcePath != nil { - nestedEcmp.StrictSourcePath = util.YesNo(o.Ecmp.StrictSourcePath, nil) } } - entry.Ecmp = nestedEcmp - - entry.Interfaces = util.StrToMem(o.Interfaces) - var nestedProtocol *ProtocolXml - if o.Protocol != nil { - nestedProtocol = &ProtocolXml{} - if _, ok := o.Misc["Protocol"]; ok { - nestedProtocol.Misc = o.Misc["Protocol"] + return true +} +func matchProtocolOspfAreaInterfaceNeighbor(a []ProtocolOspfAreaInterfaceNeighbor, b []ProtocolOspfAreaInterfaceNeighbor) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } } - if o.Protocol.Bgp != nil { - nestedProtocol.Bgp = &ProtocolBgpXml{} - if _, ok := o.Misc["ProtocolBgp"]; ok { - nestedProtocol.Bgp.Misc = o.Misc["ProtocolBgp"] + } + return true +} +func matchProtocolOspfAreaInterfaceLinkTypeBroadcast(a *ProtocolOspfAreaInterfaceLinkTypeBroadcast, b *ProtocolOspfAreaInterfaceLinkTypeBroadcast) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfAreaInterfaceLinkTypeP2p(a *ProtocolOspfAreaInterfaceLinkTypeP2p, b *ProtocolOspfAreaInterfaceLinkTypeP2p) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfAreaInterfaceLinkTypeP2mp(a *ProtocolOspfAreaInterfaceLinkTypeP2mp, b *ProtocolOspfAreaInterfaceLinkTypeP2mp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfAreaInterfaceLinkType(a *ProtocolOspfAreaInterfaceLinkType, b *ProtocolOspfAreaInterfaceLinkType) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolOspfAreaInterfaceLinkTypeP2p(a.P2p, b.P2p) { + return false + } + if !matchProtocolOspfAreaInterfaceLinkTypeP2mp(a.P2mp, b.P2mp) { + return false + } + if !matchProtocolOspfAreaInterfaceLinkTypeBroadcast(a.Broadcast, b.Broadcast) { + return false + } + return true +} +func matchProtocolOspfAreaInterfaceBfd(a *ProtocolOspfAreaInterfaceBfd, b *ProtocolOspfAreaInterfaceBfd) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } + return true +} +func matchProtocolOspfAreaInterface(a []ProtocolOspfAreaInterface, b []ProtocolOspfAreaInterface) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.Ints64Match(a.Priority, b.Priority) { + return false } - if o.Protocol.Bgp.Enable != nil { - nestedProtocol.Bgp.Enable = util.YesNo(o.Protocol.Bgp.Enable, nil) + if !util.Ints64Match(a.HelloInterval, b.HelloInterval) { + return false } - } - if o.Protocol.Rip != nil { - nestedProtocol.Rip = &ProtocolRipXml{} - if _, ok := o.Misc["ProtocolRip"]; ok { - nestedProtocol.Rip.Misc = o.Misc["ProtocolRip"] + if !util.StringsMatch(a.Authentication, b.Authentication) { + return false } - if o.Protocol.Rip.Enable != nil { - nestedProtocol.Rip.Enable = util.YesNo(o.Protocol.Rip.Enable, nil) + if !util.Ints64Match(a.GrDelay, b.GrDelay) { + return false } - } - if o.Protocol.Ospf != nil { - nestedProtocol.Ospf = &ProtocolOspfXml{} - if _, ok := o.Misc["ProtocolOspf"]; ok { - nestedProtocol.Ospf.Misc = o.Misc["ProtocolOspf"] + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.DeadCounts, b.DeadCounts) { + return false } - if o.Protocol.Ospf.Enable != nil { - nestedProtocol.Ospf.Enable = util.YesNo(o.Protocol.Ospf.Enable, nil) + if !matchProtocolOspfAreaInterfaceNeighbor(a.Neighbor, b.Neighbor) { + return false } - } - if o.Protocol.Ospfv3 != nil { - nestedProtocol.Ospfv3 = &ProtocolOspfv3Xml{} - if _, ok := o.Misc["ProtocolOspfv3"]; ok { - nestedProtocol.Ospfv3.Misc = o.Misc["ProtocolOspfv3"] + if !util.StringsEqual(a.Name, b.Name) { + return false } - if o.Protocol.Ospfv3.Enable != nil { - nestedProtocol.Ospfv3.Enable = util.YesNo(o.Protocol.Ospfv3.Enable, nil) + if !util.BoolsMatch(a.Passive, b.Passive) { + return false } - } - } - entry.Protocol = nestedProtocol - - var nestedRoutingTable *RoutingTableXml - if o.RoutingTable != nil { - nestedRoutingTable = &RoutingTableXml{} - if _, ok := o.Misc["RoutingTable"]; ok { - nestedRoutingTable.Misc = o.Misc["RoutingTable"] - } - if o.RoutingTable.Ip != nil { - nestedRoutingTable.Ip = &RoutingTableIpXml{} - if _, ok := o.Misc["RoutingTableIp"]; ok { - nestedRoutingTable.Ip.Misc = o.Misc["RoutingTableIp"] + if !util.Ints64Match(a.RetransmitInterval, b.RetransmitInterval) { + return false } - if o.RoutingTable.Ip.StaticRoutes != nil { - nestedRoutingTable.Ip.StaticRoutes = []RoutingTableIpStaticRoutesXml{} - for _, oRoutingTableIpStaticRoutes := range o.RoutingTable.Ip.StaticRoutes { - nestedRoutingTableIpStaticRoutes := RoutingTableIpStaticRoutesXml{} - if _, ok := o.Misc["RoutingTableIpStaticRoutes"]; ok { - nestedRoutingTableIpStaticRoutes.Misc = o.Misc["RoutingTableIpStaticRoutes"] - } - if oRoutingTableIpStaticRoutes.RouteTable != nil { - nestedRoutingTableIpStaticRoutes.RouteTable = oRoutingTableIpStaticRoutes.RouteTable - } - if oRoutingTableIpStaticRoutes.Name != "" { - nestedRoutingTableIpStaticRoutes.Name = oRoutingTableIpStaticRoutes.Name - } - if oRoutingTableIpStaticRoutes.Destination != nil { - nestedRoutingTableIpStaticRoutes.Destination = oRoutingTableIpStaticRoutes.Destination - } - if oRoutingTableIpStaticRoutes.Interface != nil { - nestedRoutingTableIpStaticRoutes.Interface = oRoutingTableIpStaticRoutes.Interface - } - if oRoutingTableIpStaticRoutes.NextHop != nil { - nestedRoutingTableIpStaticRoutes.NextHop = &RoutingTableIpStaticRoutesNextHopXml{} - if _, ok := o.Misc["RoutingTableIpStaticRoutesNextHop"]; ok { - nestedRoutingTableIpStaticRoutes.NextHop.Misc = o.Misc["RoutingTableIpStaticRoutesNextHop"] - } - if oRoutingTableIpStaticRoutes.NextHop.IpAddress != nil { - nestedRoutingTableIpStaticRoutes.NextHop.IpAddress = oRoutingTableIpStaticRoutes.NextHop.IpAddress - } - if oRoutingTableIpStaticRoutes.NextHop.Fqdn != nil { - nestedRoutingTableIpStaticRoutes.NextHop.Fqdn = oRoutingTableIpStaticRoutes.NextHop.Fqdn - } - if oRoutingTableIpStaticRoutes.NextHop.NextVr != nil { - nestedRoutingTableIpStaticRoutes.NextHop.NextVr = oRoutingTableIpStaticRoutes.NextHop.NextVr - } - if oRoutingTableIpStaticRoutes.NextHop.Tunnel != nil { - nestedRoutingTableIpStaticRoutes.NextHop.Tunnel = oRoutingTableIpStaticRoutes.NextHop.Tunnel - } - } - if oRoutingTableIpStaticRoutes.AdminDist != nil { - nestedRoutingTableIpStaticRoutes.AdminDist = oRoutingTableIpStaticRoutes.AdminDist - } - if oRoutingTableIpStaticRoutes.Metric != nil { - nestedRoutingTableIpStaticRoutes.Metric = oRoutingTableIpStaticRoutes.Metric - } - nestedRoutingTable.Ip.StaticRoutes = append(nestedRoutingTable.Ip.StaticRoutes, nestedRoutingTableIpStaticRoutes) - } + if !matchProtocolOspfAreaInterfaceLinkType(a.LinkType, b.LinkType) { + return false } - } - if o.RoutingTable.Ipv6 != nil { - nestedRoutingTable.Ipv6 = &RoutingTableIpv6Xml{} - if _, ok := o.Misc["RoutingTableIpv6"]; ok { - nestedRoutingTable.Ipv6.Misc = o.Misc["RoutingTableIpv6"] + if !matchProtocolOspfAreaInterfaceBfd(a.Bfd, b.Bfd) { + return false } - if o.RoutingTable.Ipv6.StaticRoutes != nil { - nestedRoutingTable.Ipv6.StaticRoutes = []RoutingTableIpv6StaticRoutesXml{} - for _, oRoutingTableIpv6StaticRoutes := range o.RoutingTable.Ipv6.StaticRoutes { - nestedRoutingTableIpv6StaticRoutes := RoutingTableIpv6StaticRoutesXml{} - if _, ok := o.Misc["RoutingTableIpv6StaticRoutes"]; ok { - nestedRoutingTableIpv6StaticRoutes.Misc = o.Misc["RoutingTableIpv6StaticRoutes"] - } - if oRoutingTableIpv6StaticRoutes.RouteTable != nil { - nestedRoutingTableIpv6StaticRoutes.RouteTable = oRoutingTableIpv6StaticRoutes.RouteTable - } - if oRoutingTableIpv6StaticRoutes.Name != "" { - nestedRoutingTableIpv6StaticRoutes.Name = oRoutingTableIpv6StaticRoutes.Name - } - if oRoutingTableIpv6StaticRoutes.Destination != nil { - nestedRoutingTableIpv6StaticRoutes.Destination = oRoutingTableIpv6StaticRoutes.Destination - } - if oRoutingTableIpv6StaticRoutes.Interface != nil { - nestedRoutingTableIpv6StaticRoutes.Interface = oRoutingTableIpv6StaticRoutes.Interface - } - if oRoutingTableIpv6StaticRoutes.NextHop != nil { - nestedRoutingTableIpv6StaticRoutes.NextHop = &RoutingTableIpv6StaticRoutesNextHopXml{} - if _, ok := o.Misc["RoutingTableIpv6StaticRoutesNextHop"]; ok { - nestedRoutingTableIpv6StaticRoutes.NextHop.Misc = o.Misc["RoutingTableIpv6StaticRoutesNextHop"] - } - if oRoutingTableIpv6StaticRoutes.NextHop.Fqdn != nil { - nestedRoutingTableIpv6StaticRoutes.NextHop.Fqdn = oRoutingTableIpv6StaticRoutes.NextHop.Fqdn - } - if oRoutingTableIpv6StaticRoutes.NextHop.NextVr != nil { - nestedRoutingTableIpv6StaticRoutes.NextHop.NextVr = oRoutingTableIpv6StaticRoutes.NextHop.NextVr - } - if oRoutingTableIpv6StaticRoutes.NextHop.Tunnel != nil { - nestedRoutingTableIpv6StaticRoutes.NextHop.Tunnel = oRoutingTableIpv6StaticRoutes.NextHop.Tunnel - } - if oRoutingTableIpv6StaticRoutes.NextHop.Ipv6Address != nil { - nestedRoutingTableIpv6StaticRoutes.NextHop.Ipv6Address = oRoutingTableIpv6StaticRoutes.NextHop.Ipv6Address - } - } - if oRoutingTableIpv6StaticRoutes.AdminDist != nil { - nestedRoutingTableIpv6StaticRoutes.AdminDist = oRoutingTableIpv6StaticRoutes.AdminDist - } - if oRoutingTableIpv6StaticRoutes.Metric != nil { - nestedRoutingTableIpv6StaticRoutes.Metric = oRoutingTableIpv6StaticRoutes.Metric - } - nestedRoutingTable.Ipv6.StaticRoutes = append(nestedRoutingTable.Ipv6.StaticRoutes, nestedRoutingTableIpv6StaticRoutes) - } + if !util.Ints64Match(a.Metric, b.Metric) { + return false + } + if !util.Ints64Match(a.TransitDelay, b.TransitDelay) { + return false } } } - entry.RoutingTable = nestedRoutingTable - - entry.Misc = o.Misc["Entry"] - - return entry, nil + return true } -func (c *entryXmlContainer) Normalize() ([]*Entry, error) { - entryList := make([]*Entry, 0, len(c.Answer)) - for _, o := range c.Answer { - entry := &Entry{ - Misc: make(map[string][]generic.Xml), - } - entry.Name = o.Name - var nestedAdministrativeDistances *AdministrativeDistances - if o.AdministrativeDistances != nil { - nestedAdministrativeDistances = &AdministrativeDistances{} - if o.AdministrativeDistances.Misc != nil { - entry.Misc["AdministrativeDistances"] = o.AdministrativeDistances.Misc +func matchProtocolOspfAreaVirtualLinkBfd(a *ProtocolOspfAreaVirtualLinkBfd, b *ProtocolOspfAreaVirtualLinkBfd) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } + return true +} +func matchProtocolOspfAreaVirtualLink(a []ProtocolOspfAreaVirtualLink, b []ProtocolOspfAreaVirtualLink) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false } - if o.AdministrativeDistances.Ospfv3Ext != nil { - nestedAdministrativeDistances.Ospfv3Ext = o.AdministrativeDistances.Ospfv3Ext + if !util.StringsMatch(a.TransitAreaId, b.TransitAreaId) { + return false } - if o.AdministrativeDistances.Ibgp != nil { - nestedAdministrativeDistances.Ibgp = o.AdministrativeDistances.Ibgp + if !util.BoolsMatch(a.Enable, b.Enable) { + return false } - if o.AdministrativeDistances.Ebgp != nil { - nestedAdministrativeDistances.Ebgp = o.AdministrativeDistances.Ebgp + if !util.Ints64Match(a.HelloInterval, b.HelloInterval) { + return false } - if o.AdministrativeDistances.Rip != nil { - nestedAdministrativeDistances.Rip = o.AdministrativeDistances.Rip + if !util.Ints64Match(a.RetransmitInterval, b.RetransmitInterval) { + return false } - if o.AdministrativeDistances.StaticIpv6 != nil { - nestedAdministrativeDistances.StaticIpv6 = o.AdministrativeDistances.StaticIpv6 + if !util.Ints64Match(a.TransitDelay, b.TransitDelay) { + return false } - if o.AdministrativeDistances.OspfExt != nil { - nestedAdministrativeDistances.OspfExt = o.AdministrativeDistances.OspfExt + if !util.StringsMatch(a.NeighborId, b.NeighborId) { + return false } - if o.AdministrativeDistances.Ospfv3Int != nil { - nestedAdministrativeDistances.Ospfv3Int = o.AdministrativeDistances.Ospfv3Int + if !util.Ints64Match(a.DeadCounts, b.DeadCounts) { + return false } - if o.AdministrativeDistances.Static != nil { - nestedAdministrativeDistances.Static = o.AdministrativeDistances.Static + if !util.StringsMatch(a.Authentication, b.Authentication) { + return false } - if o.AdministrativeDistances.OspfInt != nil { - nestedAdministrativeDistances.OspfInt = o.AdministrativeDistances.OspfInt + if !matchProtocolOspfAreaVirtualLinkBfd(a.Bfd, b.Bfd) { + return false } } - entry.AdministrativeDistances = nestedAdministrativeDistances - - var nestedEcmp *Ecmp - if o.Ecmp != nil { - nestedEcmp = &Ecmp{} - if o.Ecmp.Misc != nil { - entry.Misc["Ecmp"] = o.Ecmp.Misc - } - if o.Ecmp.MaxPaths != nil { - nestedEcmp.MaxPaths = o.Ecmp.MaxPaths + } + return true +} +func matchProtocolOspfArea(a []ProtocolOspfArea, b []ProtocolOspfArea) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !matchProtocolOspfAreaInterface(a.Interface, b.Interface) { + return false } - if o.Ecmp.Algorithm != nil { - nestedEcmp.Algorithm = &EcmpAlgorithm{} - if o.Ecmp.Algorithm.Misc != nil { - entry.Misc["EcmpAlgorithm"] = o.Ecmp.Algorithm.Misc - } - if o.Ecmp.Algorithm.IpModulo != nil { - nestedEcmp.Algorithm.IpModulo = &EcmpAlgorithmIpModulo{} - if o.Ecmp.Algorithm.IpModulo.Misc != nil { - entry.Misc["EcmpAlgorithmIpModulo"] = o.Ecmp.Algorithm.IpModulo.Misc - } - } - if o.Ecmp.Algorithm.IpHash != nil { - nestedEcmp.Algorithm.IpHash = &EcmpAlgorithmIpHash{} - if o.Ecmp.Algorithm.IpHash.Misc != nil { - entry.Misc["EcmpAlgorithmIpHash"] = o.Ecmp.Algorithm.IpHash.Misc - } - if o.Ecmp.Algorithm.IpHash.SrcOnly != nil { - nestedEcmp.Algorithm.IpHash.SrcOnly = util.AsBool(o.Ecmp.Algorithm.IpHash.SrcOnly, nil) - } - if o.Ecmp.Algorithm.IpHash.UsePort != nil { - nestedEcmp.Algorithm.IpHash.UsePort = util.AsBool(o.Ecmp.Algorithm.IpHash.UsePort, nil) - } - if o.Ecmp.Algorithm.IpHash.HashSeed != nil { - nestedEcmp.Algorithm.IpHash.HashSeed = o.Ecmp.Algorithm.IpHash.HashSeed - } - } - if o.Ecmp.Algorithm.WeightedRoundRobin != nil { - nestedEcmp.Algorithm.WeightedRoundRobin = &EcmpAlgorithmWeightedRoundRobin{} - if o.Ecmp.Algorithm.WeightedRoundRobin.Misc != nil { - entry.Misc["EcmpAlgorithmWeightedRoundRobin"] = o.Ecmp.Algorithm.WeightedRoundRobin.Misc - } - if o.Ecmp.Algorithm.WeightedRoundRobin.Interfaces != nil { - nestedEcmp.Algorithm.WeightedRoundRobin.Interfaces = []EcmpAlgorithmWeightedRoundRobinInterfaces{} - for _, oEcmpAlgorithmWeightedRoundRobinInterfaces := range o.Ecmp.Algorithm.WeightedRoundRobin.Interfaces { - nestedEcmpAlgorithmWeightedRoundRobinInterfaces := EcmpAlgorithmWeightedRoundRobinInterfaces{} - if oEcmpAlgorithmWeightedRoundRobinInterfaces.Misc != nil { - entry.Misc["EcmpAlgorithmWeightedRoundRobinInterfaces"] = oEcmpAlgorithmWeightedRoundRobinInterfaces.Misc - } - if oEcmpAlgorithmWeightedRoundRobinInterfaces.Name != "" { - nestedEcmpAlgorithmWeightedRoundRobinInterfaces.Name = oEcmpAlgorithmWeightedRoundRobinInterfaces.Name - } - if oEcmpAlgorithmWeightedRoundRobinInterfaces.Weight != nil { - nestedEcmpAlgorithmWeightedRoundRobinInterfaces.Weight = oEcmpAlgorithmWeightedRoundRobinInterfaces.Weight - } - nestedEcmp.Algorithm.WeightedRoundRobin.Interfaces = append(nestedEcmp.Algorithm.WeightedRoundRobin.Interfaces, nestedEcmpAlgorithmWeightedRoundRobinInterfaces) - } - } - } - if o.Ecmp.Algorithm.BalancedRoundRobin != nil { - nestedEcmp.Algorithm.BalancedRoundRobin = &EcmpAlgorithmBalancedRoundRobin{} - if o.Ecmp.Algorithm.BalancedRoundRobin.Misc != nil { - entry.Misc["EcmpAlgorithmBalancedRoundRobin"] = o.Ecmp.Algorithm.BalancedRoundRobin.Misc - } - } + if !matchProtocolOspfAreaVirtualLink(a.VirtualLink, b.VirtualLink) { + return false } - if o.Ecmp.Enable != nil { - nestedEcmp.Enable = util.AsBool(o.Ecmp.Enable, nil) + if !util.StringsEqual(a.Name, b.Name) { + return false } - if o.Ecmp.SymmetricReturn != nil { - nestedEcmp.SymmetricReturn = util.AsBool(o.Ecmp.SymmetricReturn, nil) + if !matchProtocolOspfAreaType(a.Type, b.Type) { + return false } - if o.Ecmp.StrictSourcePath != nil { - nestedEcmp.StrictSourcePath = util.AsBool(o.Ecmp.StrictSourcePath, nil) + if !matchProtocolOspfAreaRange(a.Range, b.Range) { + return false } } - entry.Ecmp = nestedEcmp - - entry.Interfaces = util.MemToStr(o.Interfaces) - var nestedProtocol *Protocol - if o.Protocol != nil { - nestedProtocol = &Protocol{} - if o.Protocol.Misc != nil { - entry.Misc["Protocol"] = o.Protocol.Misc + } + return true +} +func matchProtocolOspfAuthProfileMd5(a []ProtocolOspfAuthProfileMd5, b []ProtocolOspfAuthProfileMd5) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.Key, b.Key) { + return false } - if o.Protocol.Rip != nil { - nestedProtocol.Rip = &ProtocolRip{} - if o.Protocol.Rip.Misc != nil { - entry.Misc["ProtocolRip"] = o.Protocol.Rip.Misc - } - if o.Protocol.Rip.Enable != nil { - nestedProtocol.Rip.Enable = util.AsBool(o.Protocol.Rip.Enable, nil) - } + if !util.BoolsMatch(a.Preferred, b.Preferred) { + return false } - if o.Protocol.Ospf != nil { - nestedProtocol.Ospf = &ProtocolOspf{} - if o.Protocol.Ospf.Misc != nil { - entry.Misc["ProtocolOspf"] = o.Protocol.Ospf.Misc - } - if o.Protocol.Ospf.Enable != nil { - nestedProtocol.Ospf.Enable = util.AsBool(o.Protocol.Ospf.Enable, nil) - } + if !util.StringsEqual(a.Name, b.Name) { + return false } - if o.Protocol.Ospfv3 != nil { - nestedProtocol.Ospfv3 = &ProtocolOspfv3{} - if o.Protocol.Ospfv3.Misc != nil { - entry.Misc["ProtocolOspfv3"] = o.Protocol.Ospfv3.Misc - } - if o.Protocol.Ospfv3.Enable != nil { - nestedProtocol.Ospfv3.Enable = util.AsBool(o.Protocol.Ospfv3.Enable, nil) - } + } + } + return true +} +func matchProtocolOspfAuthProfile(a []ProtocolOspfAuthProfile, b []ProtocolOspfAuthProfile) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false } - if o.Protocol.Bgp != nil { - nestedProtocol.Bgp = &ProtocolBgp{} - if o.Protocol.Bgp.Misc != nil { - entry.Misc["ProtocolBgp"] = o.Protocol.Bgp.Misc - } - if o.Protocol.Bgp.Enable != nil { - nestedProtocol.Bgp.Enable = util.AsBool(o.Protocol.Bgp.Enable, nil) - } + if !util.StringsMatch(a.Password, b.Password) { + return false + } + if !matchProtocolOspfAuthProfileMd5(a.Md5, b.Md5) { + return false } } - entry.Protocol = nestedProtocol - - var nestedRoutingTable *RoutingTable - if o.RoutingTable != nil { - nestedRoutingTable = &RoutingTable{} - if o.RoutingTable.Misc != nil { - entry.Misc["RoutingTable"] = o.RoutingTable.Misc + } + return true +} +func matchProtocolOspf(a *ProtocolOspf, b *ProtocolOspf) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolOspfGracefulRestart(a.GracefulRestart, b.GracefulRestart) { + return false + } + if !util.BoolsMatch(a.RejectDefaultRoute, b.RejectDefaultRoute) { + return false + } + if !util.BoolsMatch(a.Rfc1583, b.Rfc1583) { + return false + } + if !util.BoolsMatch(a.AllowRedistDefaultRoute, b.AllowRedistDefaultRoute) { + return false + } + if !matchProtocolOspfGlobalBfd(a.GlobalBfd, b.GlobalBfd) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !matchProtocolOspfExportRules(a.ExportRules, b.ExportRules) { + return false + } + if !util.StringsMatch(a.RouterId, b.RouterId) { + return false + } + if !matchProtocolOspfTimers(a.Timers, b.Timers) { + return false + } + if !matchProtocolOspfArea(a.Area, b.Area) { + return false + } + if !matchProtocolOspfAuthProfile(a.AuthProfile, b.AuthProfile) { + return false + } + return true +} +func matchProtocolOspfv3Timers(a *ProtocolOspfv3Timers, b *ProtocolOspfv3Timers) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.FloatsMatch(a.LsaInterval, b.LsaInterval) { + return false + } + if !util.FloatsMatch(a.SpfCalculationDelay, b.SpfCalculationDelay) { + return false + } + return true +} +func matchProtocolOspfv3AreaTypeNormal(a *ProtocolOspfv3AreaTypeNormal, b *ProtocolOspfv3AreaTypeNormal) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfv3AreaTypeStubDefaultRouteDisable(a *ProtocolOspfv3AreaTypeStubDefaultRouteDisable, b *ProtocolOspfv3AreaTypeStubDefaultRouteDisable) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfv3AreaTypeStubDefaultRouteAdvertise(a *ProtocolOspfv3AreaTypeStubDefaultRouteAdvertise, b *ProtocolOspfv3AreaTypeStubDefaultRouteAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Metric, b.Metric) { + return false + } + return true +} +func matchProtocolOspfv3AreaTypeStubDefaultRoute(a *ProtocolOspfv3AreaTypeStubDefaultRoute, b *ProtocolOspfv3AreaTypeStubDefaultRoute) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolOspfv3AreaTypeStubDefaultRouteDisable(a.Disable, b.Disable) { + return false + } + if !matchProtocolOspfv3AreaTypeStubDefaultRouteAdvertise(a.Advertise, b.Advertise) { + return false + } + return true +} +func matchProtocolOspfv3AreaTypeStub(a *ProtocolOspfv3AreaTypeStub, b *ProtocolOspfv3AreaTypeStub) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.AcceptSummary, b.AcceptSummary) { + return false + } + if !matchProtocolOspfv3AreaTypeStubDefaultRoute(a.DefaultRoute, b.DefaultRoute) { + return false + } + return true +} +func matchProtocolOspfv3AreaTypeNssaNssaExtRangeAdvertise(a *ProtocolOspfv3AreaTypeNssaNssaExtRangeAdvertise, b *ProtocolOspfv3AreaTypeNssaNssaExtRangeAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfv3AreaTypeNssaNssaExtRangeSuppress(a *ProtocolOspfv3AreaTypeNssaNssaExtRangeSuppress, b *ProtocolOspfv3AreaTypeNssaNssaExtRangeSuppress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfv3AreaTypeNssaNssaExtRange(a []ProtocolOspfv3AreaTypeNssaNssaExtRange, b []ProtocolOspfv3AreaTypeNssaNssaExtRange) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false } - if o.RoutingTable.Ip != nil { - nestedRoutingTable.Ip = &RoutingTableIp{} - if o.RoutingTable.Ip.Misc != nil { - entry.Misc["RoutingTableIp"] = o.RoutingTable.Ip.Misc - } - if o.RoutingTable.Ip.StaticRoutes != nil { - nestedRoutingTable.Ip.StaticRoutes = []RoutingTableIpStaticRoutes{} - for _, oRoutingTableIpStaticRoutes := range o.RoutingTable.Ip.StaticRoutes { - nestedRoutingTableIpStaticRoutes := RoutingTableIpStaticRoutes{} - if oRoutingTableIpStaticRoutes.Misc != nil { - entry.Misc["RoutingTableIpStaticRoutes"] = oRoutingTableIpStaticRoutes.Misc - } - if oRoutingTableIpStaticRoutes.Name != "" { - nestedRoutingTableIpStaticRoutes.Name = oRoutingTableIpStaticRoutes.Name - } - if oRoutingTableIpStaticRoutes.Destination != nil { - nestedRoutingTableIpStaticRoutes.Destination = oRoutingTableIpStaticRoutes.Destination - } - if oRoutingTableIpStaticRoutes.Interface != nil { - nestedRoutingTableIpStaticRoutes.Interface = oRoutingTableIpStaticRoutes.Interface - } - if oRoutingTableIpStaticRoutes.NextHop != nil { - nestedRoutingTableIpStaticRoutes.NextHop = &RoutingTableIpStaticRoutesNextHop{} - if oRoutingTableIpStaticRoutes.NextHop.Misc != nil { - entry.Misc["RoutingTableIpStaticRoutesNextHop"] = oRoutingTableIpStaticRoutes.NextHop.Misc - } - if oRoutingTableIpStaticRoutes.NextHop.IpAddress != nil { - nestedRoutingTableIpStaticRoutes.NextHop.IpAddress = oRoutingTableIpStaticRoutes.NextHop.IpAddress - } - if oRoutingTableIpStaticRoutes.NextHop.Fqdn != nil { - nestedRoutingTableIpStaticRoutes.NextHop.Fqdn = oRoutingTableIpStaticRoutes.NextHop.Fqdn - } - if oRoutingTableIpStaticRoutes.NextHop.NextVr != nil { - nestedRoutingTableIpStaticRoutes.NextHop.NextVr = oRoutingTableIpStaticRoutes.NextHop.NextVr - } - if oRoutingTableIpStaticRoutes.NextHop.Tunnel != nil { - nestedRoutingTableIpStaticRoutes.NextHop.Tunnel = oRoutingTableIpStaticRoutes.NextHop.Tunnel - } - } - if oRoutingTableIpStaticRoutes.AdminDist != nil { - nestedRoutingTableIpStaticRoutes.AdminDist = oRoutingTableIpStaticRoutes.AdminDist - } - if oRoutingTableIpStaticRoutes.Metric != nil { - nestedRoutingTableIpStaticRoutes.Metric = oRoutingTableIpStaticRoutes.Metric - } - if oRoutingTableIpStaticRoutes.RouteTable != nil { - nestedRoutingTableIpStaticRoutes.RouteTable = oRoutingTableIpStaticRoutes.RouteTable - } - nestedRoutingTable.Ip.StaticRoutes = append(nestedRoutingTable.Ip.StaticRoutes, nestedRoutingTableIpStaticRoutes) - } - } + if !matchProtocolOspfv3AreaTypeNssaNssaExtRangeAdvertise(a.Advertise, b.Advertise) { + return false } - if o.RoutingTable.Ipv6 != nil { - nestedRoutingTable.Ipv6 = &RoutingTableIpv6{} - if o.RoutingTable.Ipv6.Misc != nil { - entry.Misc["RoutingTableIpv6"] = o.RoutingTable.Ipv6.Misc - } - if o.RoutingTable.Ipv6.StaticRoutes != nil { - nestedRoutingTable.Ipv6.StaticRoutes = []RoutingTableIpv6StaticRoutes{} - for _, oRoutingTableIpv6StaticRoutes := range o.RoutingTable.Ipv6.StaticRoutes { - nestedRoutingTableIpv6StaticRoutes := RoutingTableIpv6StaticRoutes{} - if oRoutingTableIpv6StaticRoutes.Misc != nil { - entry.Misc["RoutingTableIpv6StaticRoutes"] = oRoutingTableIpv6StaticRoutes.Misc - } - if oRoutingTableIpv6StaticRoutes.Destination != nil { - nestedRoutingTableIpv6StaticRoutes.Destination = oRoutingTableIpv6StaticRoutes.Destination - } - if oRoutingTableIpv6StaticRoutes.Interface != nil { - nestedRoutingTableIpv6StaticRoutes.Interface = oRoutingTableIpv6StaticRoutes.Interface - } - if oRoutingTableIpv6StaticRoutes.NextHop != nil { - nestedRoutingTableIpv6StaticRoutes.NextHop = &RoutingTableIpv6StaticRoutesNextHop{} - if oRoutingTableIpv6StaticRoutes.NextHop.Misc != nil { - entry.Misc["RoutingTableIpv6StaticRoutesNextHop"] = oRoutingTableIpv6StaticRoutes.NextHop.Misc - } - if oRoutingTableIpv6StaticRoutes.NextHop.Ipv6Address != nil { - nestedRoutingTableIpv6StaticRoutes.NextHop.Ipv6Address = oRoutingTableIpv6StaticRoutes.NextHop.Ipv6Address - } - if oRoutingTableIpv6StaticRoutes.NextHop.Fqdn != nil { - nestedRoutingTableIpv6StaticRoutes.NextHop.Fqdn = oRoutingTableIpv6StaticRoutes.NextHop.Fqdn - } - if oRoutingTableIpv6StaticRoutes.NextHop.NextVr != nil { - nestedRoutingTableIpv6StaticRoutes.NextHop.NextVr = oRoutingTableIpv6StaticRoutes.NextHop.NextVr - } - if oRoutingTableIpv6StaticRoutes.NextHop.Tunnel != nil { - nestedRoutingTableIpv6StaticRoutes.NextHop.Tunnel = oRoutingTableIpv6StaticRoutes.NextHop.Tunnel - } - } - if oRoutingTableIpv6StaticRoutes.AdminDist != nil { - nestedRoutingTableIpv6StaticRoutes.AdminDist = oRoutingTableIpv6StaticRoutes.AdminDist - } - if oRoutingTableIpv6StaticRoutes.Metric != nil { - nestedRoutingTableIpv6StaticRoutes.Metric = oRoutingTableIpv6StaticRoutes.Metric - } - if oRoutingTableIpv6StaticRoutes.RouteTable != nil { - nestedRoutingTableIpv6StaticRoutes.RouteTable = oRoutingTableIpv6StaticRoutes.RouteTable - } - if oRoutingTableIpv6StaticRoutes.Name != "" { - nestedRoutingTableIpv6StaticRoutes.Name = oRoutingTableIpv6StaticRoutes.Name - } - nestedRoutingTable.Ipv6.StaticRoutes = append(nestedRoutingTable.Ipv6.StaticRoutes, nestedRoutingTableIpv6StaticRoutes) - } - } + if !matchProtocolOspfv3AreaTypeNssaNssaExtRangeSuppress(a.Suppress, b.Suppress) { + return false } } - entry.RoutingTable = nestedRoutingTable - - entry.Misc["Entry"] = o.Misc - - entryList = append(entryList, entry) } - - return entryList, nil + return true } - -func SpecMatches(a, b *Entry) bool { +func matchProtocolOspfv3AreaTypeNssaDefaultRouteDisable(a *ProtocolOspfv3AreaTypeNssaDefaultRouteDisable, b *ProtocolOspfv3AreaTypeNssaDefaultRouteDisable) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - - // Don't compare Name. - if !matchAdministrativeDistances(a.AdministrativeDistances, b.AdministrativeDistances) { + return true +} +func matchProtocolOspfv3AreaTypeNssaDefaultRouteAdvertise(a *ProtocolOspfv3AreaTypeNssaDefaultRouteAdvertise, b *ProtocolOspfv3AreaTypeNssaDefaultRouteAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !matchEcmp(a.Ecmp, b.Ecmp) { + if !util.Ints64Match(a.Metric, b.Metric) { return false } - if !util.OrderedListsMatch(a.Interfaces, b.Interfaces) { + if !util.StringsMatch(a.Type, b.Type) { return false } - if !matchProtocol(a.Protocol, b.Protocol) { + return true +} +func matchProtocolOspfv3AreaTypeNssaDefaultRoute(a *ProtocolOspfv3AreaTypeNssaDefaultRoute, b *ProtocolOspfv3AreaTypeNssaDefaultRoute) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolOspfv3AreaTypeNssaDefaultRouteDisable(a.Disable, b.Disable) { + return false + } + if !matchProtocolOspfv3AreaTypeNssaDefaultRouteAdvertise(a.Advertise, b.Advertise) { + return false + } + return true +} +func matchProtocolOspfv3AreaTypeNssa(a *ProtocolOspfv3AreaTypeNssa, b *ProtocolOspfv3AreaTypeNssa) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.AcceptSummary, b.AcceptSummary) { + return false + } + if !matchProtocolOspfv3AreaTypeNssaDefaultRoute(a.DefaultRoute, b.DefaultRoute) { + return false + } + if !matchProtocolOspfv3AreaTypeNssaNssaExtRange(a.NssaExtRange, b.NssaExtRange) { + return false + } + return true +} +func matchProtocolOspfv3AreaType(a *ProtocolOspfv3AreaType, b *ProtocolOspfv3AreaType) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolOspfv3AreaTypeNormal(a.Normal, b.Normal) { + return false + } + if !matchProtocolOspfv3AreaTypeStub(a.Stub, b.Stub) { + return false + } + if !matchProtocolOspfv3AreaTypeNssa(a.Nssa, b.Nssa) { + return false + } + return true +} +func matchProtocolOspfv3AreaRangeAdvertise(a *ProtocolOspfv3AreaRangeAdvertise, b *ProtocolOspfv3AreaRangeAdvertise) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfv3AreaRangeSuppress(a *ProtocolOspfv3AreaRangeSuppress, b *ProtocolOspfv3AreaRangeSuppress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchProtocolOspfv3AreaRange(a []ProtocolOspfv3AreaRange, b []ProtocolOspfv3AreaRange) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !matchProtocolOspfv3AreaRangeAdvertise(a.Advertise, b.Advertise) { + return false + } + if !matchProtocolOspfv3AreaRangeSuppress(a.Suppress, b.Suppress) { + return false + } + } + } + return true +} +func matchProtocolOspfv3AreaInterfaceBfd(a *ProtocolOspfv3AreaInterfaceBfd, b *ProtocolOspfv3AreaInterfaceBfd) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } + return true +} +func matchProtocolOspfv3AreaInterfaceLinkTypeP2p(a *ProtocolOspfv3AreaInterfaceLinkTypeP2p, b *ProtocolOspfv3AreaInterfaceLinkTypeP2p) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !matchRoutingTable(a.RoutingTable, b.RoutingTable) { + return true +} +func matchProtocolOspfv3AreaInterfaceLinkTypeP2mp(a *ProtocolOspfv3AreaInterfaceLinkTypeP2mp, b *ProtocolOspfv3AreaInterfaceLinkTypeP2mp) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - return true } - -func matchRoutingTableIpStaticRoutesNextHop(a *RoutingTableIpStaticRoutesNextHop, b *RoutingTableIpStaticRoutesNextHop) bool { +func matchProtocolOspfv3AreaInterfaceLinkTypeBroadcast(a *ProtocolOspfv3AreaInterfaceLinkTypeBroadcast, b *ProtocolOspfv3AreaInterfaceLinkTypeBroadcast) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.StringsMatch(a.IpAddress, b.IpAddress) { + return true +} +func matchProtocolOspfv3AreaInterfaceLinkType(a *ProtocolOspfv3AreaInterfaceLinkType, b *ProtocolOspfv3AreaInterfaceLinkType) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !util.StringsMatch(a.Fqdn, b.Fqdn) { + if !matchProtocolOspfv3AreaInterfaceLinkTypeP2mp(a.P2mp, b.P2mp) { return false } - if !util.StringsMatch(a.NextVr, b.NextVr) { + if !matchProtocolOspfv3AreaInterfaceLinkTypeBroadcast(a.Broadcast, b.Broadcast) { return false } - if !util.StringsMatch(a.Tunnel, b.Tunnel) { + if !matchProtocolOspfv3AreaInterfaceLinkTypeP2p(a.P2p, b.P2p) { return false } return true } -func matchRoutingTableIpStaticRoutes(a []RoutingTableIpStaticRoutes, b []RoutingTableIpStaticRoutes) bool { +func matchProtocolOspfv3AreaInterfaceNeighbor(a []ProtocolOspfv3AreaInterfaceNeighbor, b []ProtocolOspfv3AreaInterfaceNeighbor) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { @@ -937,60 +13210,124 @@ func matchRoutingTableIpStaticRoutes(a []RoutingTableIpStaticRoutes, b []Routing if !util.StringsEqual(a.Name, b.Name) { return false } - if !util.StringsMatch(a.Destination, b.Destination) { + } + } + return true +} +func matchProtocolOspfv3AreaInterface(a []ProtocolOspfv3AreaInterface, b []ProtocolOspfv3AreaInterface) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !matchProtocolOspfv3AreaInterfaceLinkType(a.LinkType, b.LinkType) { return false } - if !util.StringsMatch(a.Interface, b.Interface) { + if !matchProtocolOspfv3AreaInterfaceNeighbor(a.Neighbor, b.Neighbor) { return false } - if !matchRoutingTableIpStaticRoutesNextHop(a.NextHop, b.NextHop) { + if !util.BoolsMatch(a.Passive, b.Passive) { return false } - if !util.Ints64Match(a.AdminDist, b.AdminDist) { + if !util.Ints64Match(a.Priority, b.Priority) { + return false + } + if !util.Ints64Match(a.DeadCounts, b.DeadCounts) { + return false + } + if !util.Ints64Match(a.GrDelay, b.GrDelay) { + return false + } + if !matchProtocolOspfv3AreaInterfaceBfd(a.Bfd, b.Bfd) { + return false + } + if !util.Ints64Match(a.InstanceId, b.InstanceId) { return false } if !util.Ints64Match(a.Metric, b.Metric) { return false } - if !util.StringsMatch(a.RouteTable, b.RouteTable) { + if !util.Ints64Match(a.HelloInterval, b.HelloInterval) { + return false + } + if !util.StringsMatch(a.Authentication, b.Authentication) { + return false + } + if !util.Ints64Match(a.TransitDelay, b.TransitDelay) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.RetransmitInterval, b.RetransmitInterval) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { return false } } } return true } -func matchRoutingTableIp(a *RoutingTableIp, b *RoutingTableIp) bool { +func matchProtocolOspfv3AreaVirtualLinkBfd(a *ProtocolOspfv3AreaVirtualLinkBfd, b *ProtocolOspfv3AreaVirtualLinkBfd) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !matchRoutingTableIpStaticRoutes(a.StaticRoutes, b.StaticRoutes) { + if !util.StringsMatch(a.Profile, b.Profile) { return false } return true } -func matchRoutingTableIpv6StaticRoutesNextHop(a *RoutingTableIpv6StaticRoutesNextHop, b *RoutingTableIpv6StaticRoutesNextHop) bool { +func matchProtocolOspfv3AreaVirtualLink(a []ProtocolOspfv3AreaVirtualLink, b []ProtocolOspfv3AreaVirtualLink) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.StringsMatch(a.Ipv6Address, b.Ipv6Address) { - return false - } - if !util.StringsMatch(a.Fqdn, b.Fqdn) { - return false - } - if !util.StringsMatch(a.NextVr, b.NextVr) { - return false - } - if !util.StringsMatch(a.Tunnel, b.Tunnel) { - return false + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.NeighborId, b.NeighborId) { + return false + } + if !util.Ints64Match(a.InstanceId, b.InstanceId) { + return false + } + if !util.Ints64Match(a.HelloInterval, b.HelloInterval) { + return false + } + if !util.Ints64Match(a.DeadCounts, b.DeadCounts) { + return false + } + if !util.Ints64Match(a.RetransmitInterval, b.RetransmitInterval) { + return false + } + if !util.StringsMatch(a.Authentication, b.Authentication) { + return false + } + if !matchProtocolOspfv3AreaVirtualLinkBfd(a.Bfd, b.Bfd) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.TransitAreaId, b.TransitAreaId) { + return false + } + if !util.BoolsMatch(a.Enable, b.Enable) { + return false + } + if !util.Ints64Match(a.TransitDelay, b.TransitDelay) { + return false + } + } } return true } -func matchRoutingTableIpv6StaticRoutes(a []RoutingTableIpv6StaticRoutes, b []RoutingTableIpv6StaticRoutes) bool { +func matchProtocolOspfv3Area(a []ProtocolOspfv3Area, b []ProtocolOspfv3Area) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { @@ -998,256 +13335,368 @@ func matchRoutingTableIpv6StaticRoutes(a []RoutingTableIpv6StaticRoutes, b []Rou } for _, a := range a { for _, b := range b { - if !util.StringsMatch(a.RouteTable, b.RouteTable) { + if !matchProtocolOspfv3AreaType(a.Type, b.Type) { return false } - if !util.StringsEqual(a.Name, b.Name) { - return false - } - if !util.StringsMatch(a.Destination, b.Destination) { + if !matchProtocolOspfv3AreaRange(a.Range, b.Range) { return false } - if !util.StringsMatch(a.Interface, b.Interface) { + if !matchProtocolOspfv3AreaInterface(a.Interface, b.Interface) { return false } - if !matchRoutingTableIpv6StaticRoutesNextHop(a.NextHop, b.NextHop) { + if !matchProtocolOspfv3AreaVirtualLink(a.VirtualLink, b.VirtualLink) { return false } - if !util.Ints64Match(a.AdminDist, b.AdminDist) { + if !util.StringsEqual(a.Name, b.Name) { return false } - if !util.Ints64Match(a.Metric, b.Metric) { + if !util.StringsMatch(a.Authentication, b.Authentication) { return false } } } return true } -func matchRoutingTableIpv6(a *RoutingTableIpv6, b *RoutingTableIpv6) bool { +func matchProtocolOspfv3AuthProfileEspAuthenticationSha256(a *ProtocolOspfv3AuthProfileEspAuthenticationSha256, b *ProtocolOspfv3AuthProfileEspAuthenticationSha256) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !matchRoutingTableIpv6StaticRoutes(a.StaticRoutes, b.StaticRoutes) { + if !util.StringsMatch(a.Key, b.Key) { return false } return true } -func matchRoutingTable(a *RoutingTable, b *RoutingTable) bool { +func matchProtocolOspfv3AuthProfileEspAuthenticationSha384(a *ProtocolOspfv3AuthProfileEspAuthenticationSha384, b *ProtocolOspfv3AuthProfileEspAuthenticationSha384) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !matchRoutingTableIp(a.Ip, b.Ip) { + if !util.StringsMatch(a.Key, b.Key) { return false } - if !matchRoutingTableIpv6(a.Ipv6, b.Ipv6) { + return true +} +func matchProtocolOspfv3AuthProfileEspAuthenticationSha512(a *ProtocolOspfv3AuthProfileEspAuthenticationSha512, b *ProtocolOspfv3AuthProfileEspAuthenticationSha512) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Key, b.Key) { return false } return true } -func matchProtocolBgp(a *ProtocolBgp, b *ProtocolBgp) bool { +func matchProtocolOspfv3AuthProfileEspAuthenticationNone(a *ProtocolOspfv3AuthProfileEspAuthenticationNone, b *ProtocolOspfv3AuthProfileEspAuthenticationNone) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.BoolsMatch(a.Enable, b.Enable) { + return true +} +func matchProtocolOspfv3AuthProfileEspAuthenticationMd5(a *ProtocolOspfv3AuthProfileEspAuthenticationMd5, b *ProtocolOspfv3AuthProfileEspAuthenticationMd5) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Key, b.Key) { return false } return true } -func matchProtocolRip(a *ProtocolRip, b *ProtocolRip) bool { +func matchProtocolOspfv3AuthProfileEspAuthenticationSha1(a *ProtocolOspfv3AuthProfileEspAuthenticationSha1, b *ProtocolOspfv3AuthProfileEspAuthenticationSha1) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.BoolsMatch(a.Enable, b.Enable) { + if !util.StringsMatch(a.Key, b.Key) { return false } return true } -func matchProtocolOspf(a *ProtocolOspf, b *ProtocolOspf) bool { +func matchProtocolOspfv3AuthProfileEspAuthentication(a *ProtocolOspfv3AuthProfileEspAuthentication, b *ProtocolOspfv3AuthProfileEspAuthentication) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.BoolsMatch(a.Enable, b.Enable) { + if !matchProtocolOspfv3AuthProfileEspAuthenticationNone(a.None, b.None) { + return false + } + if !matchProtocolOspfv3AuthProfileEspAuthenticationMd5(a.Md5, b.Md5) { + return false + } + if !matchProtocolOspfv3AuthProfileEspAuthenticationSha1(a.Sha1, b.Sha1) { + return false + } + if !matchProtocolOspfv3AuthProfileEspAuthenticationSha256(a.Sha256, b.Sha256) { + return false + } + if !matchProtocolOspfv3AuthProfileEspAuthenticationSha384(a.Sha384, b.Sha384) { + return false + } + if !matchProtocolOspfv3AuthProfileEspAuthenticationSha512(a.Sha512, b.Sha512) { return false } return true } -func matchProtocolOspfv3(a *ProtocolOspfv3, b *ProtocolOspfv3) bool { +func matchProtocolOspfv3AuthProfileEspEncryption(a *ProtocolOspfv3AuthProfileEspEncryption, b *ProtocolOspfv3AuthProfileEspEncryption) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.BoolsMatch(a.Enable, b.Enable) { + if !util.StringsMatch(a.Algorithm, b.Algorithm) { + return false + } + if !util.StringsMatch(a.Key, b.Key) { return false } return true } -func matchProtocol(a *Protocol, b *Protocol) bool { +func matchProtocolOspfv3AuthProfileEsp(a *ProtocolOspfv3AuthProfileEsp, b *ProtocolOspfv3AuthProfileEsp) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !matchProtocolBgp(a.Bgp, b.Bgp) { + if !matchProtocolOspfv3AuthProfileEspAuthentication(a.Authentication, b.Authentication) { return false } - if !matchProtocolRip(a.Rip, b.Rip) { + if !matchProtocolOspfv3AuthProfileEspEncryption(a.Encryption, b.Encryption) { return false } - if !matchProtocolOspf(a.Ospf, b.Ospf) { + return true +} +func matchProtocolOspfv3AuthProfileAhMd5(a *ProtocolOspfv3AuthProfileAhMd5, b *ProtocolOspfv3AuthProfileAhMd5) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !matchProtocolOspfv3(a.Ospfv3, b.Ospfv3) { + if !util.StringsMatch(a.Key, b.Key) { return false } return true } -func matchEcmpAlgorithmWeightedRoundRobinInterfaces(a []EcmpAlgorithmWeightedRoundRobinInterfaces, b []EcmpAlgorithmWeightedRoundRobinInterfaces) bool { +func matchProtocolOspfv3AuthProfileAhSha1(a *ProtocolOspfv3AuthProfileAhSha1, b *ProtocolOspfv3AuthProfileAhSha1) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - for _, a := range a { - for _, b := range b { - if !util.Ints64Match(a.Weight, b.Weight) { - return false - } - if !util.StringsEqual(a.Name, b.Name) { - return false - } - } + if !util.StringsMatch(a.Key, b.Key) { + return false } return true } -func matchEcmpAlgorithmWeightedRoundRobin(a *EcmpAlgorithmWeightedRoundRobin, b *EcmpAlgorithmWeightedRoundRobin) bool { +func matchProtocolOspfv3AuthProfileAhSha256(a *ProtocolOspfv3AuthProfileAhSha256, b *ProtocolOspfv3AuthProfileAhSha256) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !matchEcmpAlgorithmWeightedRoundRobinInterfaces(a.Interfaces, b.Interfaces) { + if !util.StringsMatch(a.Key, b.Key) { return false } return true } -func matchEcmpAlgorithmBalancedRoundRobin(a *EcmpAlgorithmBalancedRoundRobin, b *EcmpAlgorithmBalancedRoundRobin) bool { +func matchProtocolOspfv3AuthProfileAhSha384(a *ProtocolOspfv3AuthProfileAhSha384, b *ProtocolOspfv3AuthProfileAhSha384) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } + if !util.StringsMatch(a.Key, b.Key) { + return false + } return true } -func matchEcmpAlgorithmIpModulo(a *EcmpAlgorithmIpModulo, b *EcmpAlgorithmIpModulo) bool { +func matchProtocolOspfv3AuthProfileAhSha512(a *ProtocolOspfv3AuthProfileAhSha512, b *ProtocolOspfv3AuthProfileAhSha512) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } + if !util.StringsMatch(a.Key, b.Key) { + return false + } return true } -func matchEcmpAlgorithmIpHash(a *EcmpAlgorithmIpHash, b *EcmpAlgorithmIpHash) bool { +func matchProtocolOspfv3AuthProfileAh(a *ProtocolOspfv3AuthProfileAh, b *ProtocolOspfv3AuthProfileAh) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.BoolsMatch(a.SrcOnly, b.SrcOnly) { + if !matchProtocolOspfv3AuthProfileAhMd5(a.Md5, b.Md5) { return false } - if !util.BoolsMatch(a.UsePort, b.UsePort) { + if !matchProtocolOspfv3AuthProfileAhSha1(a.Sha1, b.Sha1) { return false } - if !util.Ints64Match(a.HashSeed, b.HashSeed) { + if !matchProtocolOspfv3AuthProfileAhSha256(a.Sha256, b.Sha256) { + return false + } + if !matchProtocolOspfv3AuthProfileAhSha384(a.Sha384, b.Sha384) { + return false + } + if !matchProtocolOspfv3AuthProfileAhSha512(a.Sha512, b.Sha512) { return false } return true } -func matchEcmpAlgorithm(a *EcmpAlgorithm, b *EcmpAlgorithm) bool { +func matchProtocolOspfv3AuthProfile(a []ProtocolOspfv3AuthProfile, b []ProtocolOspfv3AuthProfile) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !matchEcmpAlgorithmIpModulo(a.IpModulo, b.IpModulo) { - return false + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.Spi, b.Spi) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !matchProtocolOspfv3AuthProfileEsp(a.Esp, b.Esp) { + return false + } + if !matchProtocolOspfv3AuthProfileAh(a.Ah, b.Ah) { + return false + } + } } - if !matchEcmpAlgorithmIpHash(a.IpHash, b.IpHash) { + return true +} +func matchProtocolOspfv3ExportRules(a []ProtocolOspfv3ExportRules, b []ProtocolOspfv3ExportRules) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !matchEcmpAlgorithmWeightedRoundRobin(a.WeightedRoundRobin, b.WeightedRoundRobin) { + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.NewPathType, b.NewPathType) { + return false + } + if !util.StringsMatch(a.NewTag, b.NewTag) { + return false + } + if !util.Ints64Match(a.Metric, b.Metric) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchProtocolOspfv3GlobalBfd(a *ProtocolOspfv3GlobalBfd, b *ProtocolOspfv3GlobalBfd) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !matchEcmpAlgorithmBalancedRoundRobin(a.BalancedRoundRobin, b.BalancedRoundRobin) { + if !util.StringsMatch(a.Profile, b.Profile) { return false } return true } -func matchEcmp(a *Ecmp, b *Ecmp) bool { +func matchProtocolOspfv3GracefulRestart(a *ProtocolOspfv3GracefulRestart, b *ProtocolOspfv3GracefulRestart) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.BoolsMatch(a.StrictSourcePath, b.StrictSourcePath) { + if !util.BoolsMatch(a.Enable, b.Enable) { return false } - if !util.Ints64Match(a.MaxPaths, b.MaxPaths) { + if !util.Ints64Match(a.GracePeriod, b.GracePeriod) { return false } - if !matchEcmpAlgorithm(a.Algorithm, b.Algorithm) { + if !util.BoolsMatch(a.HelperEnable, b.HelperEnable) { return false } - if !util.BoolsMatch(a.Enable, b.Enable) { + if !util.Ints64Match(a.MaxNeighborRestartTime, b.MaxNeighborRestartTime) { return false } - if !util.BoolsMatch(a.SymmetricReturn, b.SymmetricReturn) { + if !util.BoolsMatch(a.StrictLSAChecking, b.StrictLSAChecking) { return false } return true } -func matchAdministrativeDistances(a *AdministrativeDistances, b *AdministrativeDistances) bool { +func matchProtocolOspfv3(a *ProtocolOspfv3, b *ProtocolOspfv3) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.Ints64Match(a.OspfExt, b.OspfExt) { + if !util.StringsMatch(a.RouterId, b.RouterId) { return false } - if !util.Ints64Match(a.Ospfv3Int, b.Ospfv3Int) { + if !matchProtocolOspfv3Timers(a.Timers, b.Timers) { return false } - if !util.Ints64Match(a.Ospfv3Ext, b.Ospfv3Ext) { + if !util.BoolsMatch(a.AllowRedistDefaultRoute, b.AllowRedistDefaultRoute) { return false } - if !util.Ints64Match(a.Ibgp, b.Ibgp) { + if !util.BoolsMatch(a.Enable, b.Enable) { return false } - if !util.Ints64Match(a.Ebgp, b.Ebgp) { + if !util.BoolsMatch(a.DisableTransitTraffic, b.DisableTransitTraffic) { return false } - if !util.Ints64Match(a.Rip, b.Rip) { + if !matchProtocolOspfv3ExportRules(a.ExportRules, b.ExportRules) { return false } - if !util.Ints64Match(a.StaticIpv6, b.StaticIpv6) { + if !matchProtocolOspfv3GlobalBfd(a.GlobalBfd, b.GlobalBfd) { return false } - if !util.Ints64Match(a.OspfInt, b.OspfInt) { + if !matchProtocolOspfv3GracefulRestart(a.GracefulRestart, b.GracefulRestart) { return false } - if !util.Ints64Match(a.Static, b.Static) { + if !util.BoolsMatch(a.RejectDefaultRoute, b.RejectDefaultRoute) { + return false + } + if !matchProtocolOspfv3Area(a.Area, b.Area) { + return false + } + if !matchProtocolOspfv3AuthProfile(a.AuthProfile, b.AuthProfile) { + return false + } + return true +} +func matchProtocol(a *Protocol, b *Protocol) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchProtocolOspf(a.Ospf, b.Ospf) { + return false + } + if !matchProtocolOspfv3(a.Ospfv3, b.Ospfv3) { + return false + } + if !matchProtocolRedistProfile(a.RedistProfile, b.RedistProfile) { + return false + } + if !matchProtocolRedistProfileIpv6(a.RedistProfileIpv6, b.RedistProfileIpv6) { + return false + } + if !matchProtocolRip(a.Rip, b.Rip) { + return false + } + if !matchProtocolBgp(a.Bgp, b.Bgp) { return false } return true diff --git a/network/zone/entry.go b/network/zone/entry.go index bf9f8e5c..4de6655e 100644 --- a/network/zone/entry.go +++ b/network/zone/entry.go @@ -35,13 +35,18 @@ type DeviceAcl struct { } type Network struct { EnablePacketBufferProtection *bool - LogSetting []string - ZoneProtectionProfile []string + LogSetting *string + NetInspection *bool + ZoneProtectionProfile *string + External []string Layer2 []string Layer3 []string Tap []string + Tunnel *NetworkTunnel VirtualWire []string } +type NetworkTunnel struct { +} type UserAcl struct { ExcludeList []string IncludeList []string @@ -51,6 +56,9 @@ type entryXmlContainer struct { Answer []entryXml `xml:"entry"` } +type entryXmlContainer_11_0_2 struct { + Answer []entryXml_11_0_2 `xml:"entry"` +} type entryXml struct { XMLName xml.Name `xml:"entry"` Name string `xml:"name,attr"` @@ -62,7 +70,17 @@ type entryXml struct { Misc []generic.Xml `xml:",any"` } +type entryXml_11_0_2 struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + DeviceAcl *DeviceAclXml_11_0_2 `xml:"device-acl,omitempty"` + EnableDeviceIdentification *string `xml:"enable-device-identification,omitempty"` + EnableUserIdentification *string `xml:"enable-user-identification,omitempty"` + Network *NetworkXml_11_0_2 `xml:"network,omitempty"` + UserAcl *UserAclXml_11_0_2 `xml:"user-acl,omitempty"` + Misc []generic.Xml `xml:",any"` +} type DeviceAclXml struct { ExcludeList *util.MemberType `xml:"exclude-list,omitempty"` IncludeList *util.MemberType `xml:"include-list,omitempty"` @@ -70,22 +88,57 @@ type DeviceAclXml struct { Misc []generic.Xml `xml:",any"` } type NetworkXml struct { - EnablePacketBufferProtection *string `xml:"enable-packet-buffer-protection,omitempty"` - LogSetting *util.MemberType `xml:"log-setting,omitempty"` - ZoneProtectionProfile *util.MemberType `xml:"zone-protection-profile,omitempty"` - Layer2 *util.MemberType `xml:"layer2,omitempty"` - Layer3 *util.MemberType `xml:"layer3,omitempty"` - Tap *util.MemberType `xml:"tap,omitempty"` - VirtualWire *util.MemberType `xml:"virtual-wire,omitempty"` + EnablePacketBufferProtection *string `xml:"enable-packet-buffer-protection,omitempty"` + LogSetting *string `xml:"log-setting,omitempty"` + NetInspection *string `xml:"net-inspection,omitempty"` + ZoneProtectionProfile *string `xml:"zone-protection-profile,omitempty"` + External *util.MemberType `xml:"external,omitempty"` + Layer2 *util.MemberType `xml:"layer2,omitempty"` + Layer3 *util.MemberType `xml:"layer3,omitempty"` + Tap *util.MemberType `xml:"tap,omitempty"` + Tunnel *NetworkTunnelXml `xml:"tunnel,omitempty"` + VirtualWire *util.MemberType `xml:"virtual-wire,omitempty"` Misc []generic.Xml `xml:",any"` } +type NetworkTunnelXml struct { + Misc []generic.Xml `xml:",any"` +} type UserAclXml struct { ExcludeList *util.MemberType `xml:"exclude-list,omitempty"` IncludeList *util.MemberType `xml:"include-list,omitempty"` Misc []generic.Xml `xml:",any"` } +type DeviceAclXml_11_0_2 struct { + ExcludeList *util.MemberType `xml:"exclude-list,omitempty"` + IncludeList *util.MemberType `xml:"include-list,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type NetworkXml_11_0_2 struct { + EnablePacketBufferProtection *string `xml:"enable-packet-buffer-protection,omitempty"` + LogSetting *string `xml:"log-setting,omitempty"` + NetInspection *string `xml:"net-inspection,omitempty"` + ZoneProtectionProfile *string `xml:"zone-protection-profile,omitempty"` + External *util.MemberType `xml:"external,omitempty"` + Layer2 *util.MemberType `xml:"layer2,omitempty"` + Layer3 *util.MemberType `xml:"layer3,omitempty"` + Tap *util.MemberType `xml:"tap,omitempty"` + Tunnel *NetworkTunnelXml_11_0_2 `xml:"tunnel,omitempty"` + VirtualWire *util.MemberType `xml:"virtual-wire,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type NetworkTunnelXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type UserAclXml_11_0_2 struct { + ExcludeList *util.MemberType `xml:"exclude-list,omitempty"` + IncludeList *util.MemberType `xml:"include-list,omitempty"` + + Misc []generic.Xml `xml:",any"` +} func (e *Entry) Field(v string) (any, error) { if v == "name" || v == "Name" { @@ -111,12 +164,16 @@ func (e *Entry) Field(v string) (any, error) { } func Versioning(vn version.Number) (Specifier, Normalizer, error) { + version_11_0_2, _ := version.New("11.0.2") + version_11_1_0, _ := version.New("11.1.0") + if vn.Gte(version_11_0_2) && vn.Lt(version_11_1_0) { + return specifyEntry_11_0_2, &entryXmlContainer_11_0_2{}, nil + } + return specifyEntry, &entryXmlContainer{}, nil } - func specifyEntry(o *Entry) (any, error) { entry := entryXml{} - entry.Name = o.Name var nestedDeviceAcl *DeviceAclXml if o.DeviceAcl != nil { @@ -124,12 +181,12 @@ func specifyEntry(o *Entry) (any, error) { if _, ok := o.Misc["DeviceAcl"]; ok { nestedDeviceAcl.Misc = o.Misc["DeviceAcl"] } - if o.DeviceAcl.IncludeList != nil { - nestedDeviceAcl.IncludeList = util.StrToMem(o.DeviceAcl.IncludeList) - } if o.DeviceAcl.ExcludeList != nil { nestedDeviceAcl.ExcludeList = util.StrToMem(o.DeviceAcl.ExcludeList) } + if o.DeviceAcl.IncludeList != nil { + nestedDeviceAcl.IncludeList = util.StrToMem(o.DeviceAcl.IncludeList) + } } entry.DeviceAcl = nestedDeviceAcl @@ -144,23 +201,35 @@ func specifyEntry(o *Entry) (any, error) { if o.Network.EnablePacketBufferProtection != nil { nestedNetwork.EnablePacketBufferProtection = util.YesNo(o.Network.EnablePacketBufferProtection, nil) } + if o.Network.LogSetting != nil { + nestedNetwork.LogSetting = o.Network.LogSetting + } if o.Network.ZoneProtectionProfile != nil { - nestedNetwork.ZoneProtectionProfile = util.StrToMem(o.Network.ZoneProtectionProfile) + nestedNetwork.ZoneProtectionProfile = o.Network.ZoneProtectionProfile } - if o.Network.LogSetting != nil { - nestedNetwork.LogSetting = util.StrToMem(o.Network.LogSetting) + if o.Network.NetInspection != nil { + nestedNetwork.NetInspection = util.YesNo(o.Network.NetInspection, nil) + } + if o.Network.Layer2 != nil { + nestedNetwork.Layer2 = util.StrToMem(o.Network.Layer2) } if o.Network.Layer3 != nil { nestedNetwork.Layer3 = util.StrToMem(o.Network.Layer3) } - if o.Network.Layer2 != nil { - nestedNetwork.Layer2 = util.StrToMem(o.Network.Layer2) + if o.Network.Tap != nil { + nestedNetwork.Tap = util.StrToMem(o.Network.Tap) + } + if o.Network.Tunnel != nil { + nestedNetwork.Tunnel = &NetworkTunnelXml{} + if _, ok := o.Misc["NetworkTunnel"]; ok { + nestedNetwork.Tunnel.Misc = o.Misc["NetworkTunnel"] + } } if o.Network.VirtualWire != nil { nestedNetwork.VirtualWire = util.StrToMem(o.Network.VirtualWire) } - if o.Network.Tap != nil { - nestedNetwork.Tap = util.StrToMem(o.Network.Tap) + if o.Network.External != nil { + nestedNetwork.External = util.StrToMem(o.Network.External) } } entry.Network = nestedNetwork @@ -171,12 +240,94 @@ func specifyEntry(o *Entry) (any, error) { if _, ok := o.Misc["UserAcl"]; ok { nestedUserAcl.Misc = o.Misc["UserAcl"] } + if o.UserAcl.ExcludeList != nil { + nestedUserAcl.ExcludeList = util.StrToMem(o.UserAcl.ExcludeList) + } if o.UserAcl.IncludeList != nil { nestedUserAcl.IncludeList = util.StrToMem(o.UserAcl.IncludeList) } + } + entry.UserAcl = nestedUserAcl + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func specifyEntry_11_0_2(o *Entry) (any, error) { + entry := entryXml_11_0_2{} + entry.Name = o.Name + var nestedDeviceAcl *DeviceAclXml_11_0_2 + if o.DeviceAcl != nil { + nestedDeviceAcl = &DeviceAclXml_11_0_2{} + if _, ok := o.Misc["DeviceAcl"]; ok { + nestedDeviceAcl.Misc = o.Misc["DeviceAcl"] + } + if o.DeviceAcl.ExcludeList != nil { + nestedDeviceAcl.ExcludeList = util.StrToMem(o.DeviceAcl.ExcludeList) + } + if o.DeviceAcl.IncludeList != nil { + nestedDeviceAcl.IncludeList = util.StrToMem(o.DeviceAcl.IncludeList) + } + } + entry.DeviceAcl = nestedDeviceAcl + + entry.EnableDeviceIdentification = util.YesNo(o.EnableDeviceIdentification, nil) + entry.EnableUserIdentification = util.YesNo(o.EnableUserIdentification, nil) + var nestedNetwork *NetworkXml_11_0_2 + if o.Network != nil { + nestedNetwork = &NetworkXml_11_0_2{} + if _, ok := o.Misc["Network"]; ok { + nestedNetwork.Misc = o.Misc["Network"] + } + if o.Network.ZoneProtectionProfile != nil { + nestedNetwork.ZoneProtectionProfile = o.Network.ZoneProtectionProfile + } + if o.Network.NetInspection != nil { + nestedNetwork.NetInspection = util.YesNo(o.Network.NetInspection, nil) + } + if o.Network.EnablePacketBufferProtection != nil { + nestedNetwork.EnablePacketBufferProtection = util.YesNo(o.Network.EnablePacketBufferProtection, nil) + } + if o.Network.LogSetting != nil { + nestedNetwork.LogSetting = o.Network.LogSetting + } + if o.Network.VirtualWire != nil { + nestedNetwork.VirtualWire = util.StrToMem(o.Network.VirtualWire) + } + if o.Network.External != nil { + nestedNetwork.External = util.StrToMem(o.Network.External) + } + if o.Network.Layer2 != nil { + nestedNetwork.Layer2 = util.StrToMem(o.Network.Layer2) + } + if o.Network.Layer3 != nil { + nestedNetwork.Layer3 = util.StrToMem(o.Network.Layer3) + } + if o.Network.Tap != nil { + nestedNetwork.Tap = util.StrToMem(o.Network.Tap) + } + if o.Network.Tunnel != nil { + nestedNetwork.Tunnel = &NetworkTunnelXml_11_0_2{} + if _, ok := o.Misc["NetworkTunnel"]; ok { + nestedNetwork.Tunnel.Misc = o.Misc["NetworkTunnel"] + } + } + } + entry.Network = nestedNetwork + + var nestedUserAcl *UserAclXml_11_0_2 + if o.UserAcl != nil { + nestedUserAcl = &UserAclXml_11_0_2{} + if _, ok := o.Misc["UserAcl"]; ok { + nestedUserAcl.Misc = o.Misc["UserAcl"] + } if o.UserAcl.ExcludeList != nil { nestedUserAcl.ExcludeList = util.StrToMem(o.UserAcl.ExcludeList) } + if o.UserAcl.IncludeList != nil { + nestedUserAcl.IncludeList = util.StrToMem(o.UserAcl.IncludeList) + } } entry.UserAcl = nestedUserAcl @@ -197,12 +348,12 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { if o.DeviceAcl.Misc != nil { entry.Misc["DeviceAcl"] = o.DeviceAcl.Misc } - if o.DeviceAcl.IncludeList != nil { - nestedDeviceAcl.IncludeList = util.MemToStr(o.DeviceAcl.IncludeList) - } if o.DeviceAcl.ExcludeList != nil { nestedDeviceAcl.ExcludeList = util.MemToStr(o.DeviceAcl.ExcludeList) } + if o.DeviceAcl.IncludeList != nil { + nestedDeviceAcl.IncludeList = util.MemToStr(o.DeviceAcl.IncludeList) + } } entry.DeviceAcl = nestedDeviceAcl @@ -217,24 +368,36 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { if o.Network.EnablePacketBufferProtection != nil { nestedNetwork.EnablePacketBufferProtection = util.AsBool(o.Network.EnablePacketBufferProtection, nil) } + if o.Network.LogSetting != nil { + nestedNetwork.LogSetting = o.Network.LogSetting + } if o.Network.ZoneProtectionProfile != nil { - nestedNetwork.ZoneProtectionProfile = util.MemToStr(o.Network.ZoneProtectionProfile) + nestedNetwork.ZoneProtectionProfile = o.Network.ZoneProtectionProfile } - if o.Network.LogSetting != nil { - nestedNetwork.LogSetting = util.MemToStr(o.Network.LogSetting) + if o.Network.NetInspection != nil { + nestedNetwork.NetInspection = util.AsBool(o.Network.NetInspection, nil) } - if o.Network.Layer3 != nil { - nestedNetwork.Layer3 = util.MemToStr(o.Network.Layer3) + if o.Network.External != nil { + nestedNetwork.External = util.MemToStr(o.Network.External) } if o.Network.Layer2 != nil { nestedNetwork.Layer2 = util.MemToStr(o.Network.Layer2) } - if o.Network.VirtualWire != nil { - nestedNetwork.VirtualWire = util.MemToStr(o.Network.VirtualWire) + if o.Network.Layer3 != nil { + nestedNetwork.Layer3 = util.MemToStr(o.Network.Layer3) } if o.Network.Tap != nil { nestedNetwork.Tap = util.MemToStr(o.Network.Tap) } + if o.Network.Tunnel != nil { + nestedNetwork.Tunnel = &NetworkTunnel{} + if o.Network.Tunnel.Misc != nil { + entry.Misc["NetworkTunnel"] = o.Network.Tunnel.Misc + } + } + if o.Network.VirtualWire != nil { + nestedNetwork.VirtualWire = util.MemToStr(o.Network.VirtualWire) + } } entry.Network = nestedNetwork @@ -244,12 +407,100 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { if o.UserAcl.Misc != nil { entry.Misc["UserAcl"] = o.UserAcl.Misc } + if o.UserAcl.ExcludeList != nil { + nestedUserAcl.ExcludeList = util.MemToStr(o.UserAcl.ExcludeList) + } if o.UserAcl.IncludeList != nil { nestedUserAcl.IncludeList = util.MemToStr(o.UserAcl.IncludeList) } + } + entry.UserAcl = nestedUserAcl + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} +func (c *entryXmlContainer_11_0_2) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + var nestedDeviceAcl *DeviceAcl + if o.DeviceAcl != nil { + nestedDeviceAcl = &DeviceAcl{} + if o.DeviceAcl.Misc != nil { + entry.Misc["DeviceAcl"] = o.DeviceAcl.Misc + } + if o.DeviceAcl.ExcludeList != nil { + nestedDeviceAcl.ExcludeList = util.MemToStr(o.DeviceAcl.ExcludeList) + } + if o.DeviceAcl.IncludeList != nil { + nestedDeviceAcl.IncludeList = util.MemToStr(o.DeviceAcl.IncludeList) + } + } + entry.DeviceAcl = nestedDeviceAcl + + entry.EnableDeviceIdentification = util.AsBool(o.EnableDeviceIdentification, nil) + entry.EnableUserIdentification = util.AsBool(o.EnableUserIdentification, nil) + var nestedNetwork *Network + if o.Network != nil { + nestedNetwork = &Network{} + if o.Network.Misc != nil { + entry.Misc["Network"] = o.Network.Misc + } + if o.Network.LogSetting != nil { + nestedNetwork.LogSetting = o.Network.LogSetting + } + if o.Network.ZoneProtectionProfile != nil { + nestedNetwork.ZoneProtectionProfile = o.Network.ZoneProtectionProfile + } + if o.Network.NetInspection != nil { + nestedNetwork.NetInspection = util.AsBool(o.Network.NetInspection, nil) + } + if o.Network.EnablePacketBufferProtection != nil { + nestedNetwork.EnablePacketBufferProtection = util.AsBool(o.Network.EnablePacketBufferProtection, nil) + } + if o.Network.External != nil { + nestedNetwork.External = util.MemToStr(o.Network.External) + } + if o.Network.Layer2 != nil { + nestedNetwork.Layer2 = util.MemToStr(o.Network.Layer2) + } + if o.Network.Layer3 != nil { + nestedNetwork.Layer3 = util.MemToStr(o.Network.Layer3) + } + if o.Network.Tap != nil { + nestedNetwork.Tap = util.MemToStr(o.Network.Tap) + } + if o.Network.Tunnel != nil { + nestedNetwork.Tunnel = &NetworkTunnel{} + if o.Network.Tunnel.Misc != nil { + entry.Misc["NetworkTunnel"] = o.Network.Tunnel.Misc + } + } + if o.Network.VirtualWire != nil { + nestedNetwork.VirtualWire = util.MemToStr(o.Network.VirtualWire) + } + } + entry.Network = nestedNetwork + + var nestedUserAcl *UserAcl + if o.UserAcl != nil { + nestedUserAcl = &UserAcl{} + if o.UserAcl.Misc != nil { + entry.Misc["UserAcl"] = o.UserAcl.Misc + } if o.UserAcl.ExcludeList != nil { nestedUserAcl.ExcludeList = util.MemToStr(o.UserAcl.ExcludeList) } + if o.UserAcl.IncludeList != nil { + nestedUserAcl.IncludeList = util.MemToStr(o.UserAcl.IncludeList) + } } entry.UserAcl = nestedUserAcl @@ -294,11 +545,19 @@ func matchDeviceAcl(a *DeviceAcl, b *DeviceAcl) bool { } else if a == nil && b == nil { return true } + if !util.OrderedListsMatch(a.ExcludeList, b.ExcludeList) { + return false + } if !util.OrderedListsMatch(a.IncludeList, b.IncludeList) { return false } - if !util.OrderedListsMatch(a.ExcludeList, b.ExcludeList) { + return true +} +func matchNetworkTunnel(a *NetworkTunnel, b *NetworkTunnel) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } return true } @@ -308,27 +567,36 @@ func matchNetwork(a *Network, b *Network) bool { } else if a == nil && b == nil { return true } - if !util.BoolsMatch(a.EnablePacketBufferProtection, b.EnablePacketBufferProtection) { + if !util.StringsMatch(a.LogSetting, b.LogSetting) { return false } - if !util.OrderedListsMatch(a.ZoneProtectionProfile, b.ZoneProtectionProfile) { + if !util.StringsMatch(a.ZoneProtectionProfile, b.ZoneProtectionProfile) { return false } - if !util.OrderedListsMatch(a.LogSetting, b.LogSetting) { + if !util.BoolsMatch(a.NetInspection, b.NetInspection) { return false } - if !util.OrderedListsMatch(a.Layer3, b.Layer3) { + if !util.BoolsMatch(a.EnablePacketBufferProtection, b.EnablePacketBufferProtection) { + return false + } + if !util.OrderedListsMatch(a.VirtualWire, b.VirtualWire) { + return false + } + if !util.OrderedListsMatch(a.External, b.External) { return false } if !util.OrderedListsMatch(a.Layer2, b.Layer2) { return false } - if !util.OrderedListsMatch(a.VirtualWire, b.VirtualWire) { + if !util.OrderedListsMatch(a.Layer3, b.Layer3) { return false } if !util.OrderedListsMatch(a.Tap, b.Tap) { return false } + if !matchNetworkTunnel(a.Tunnel, b.Tunnel) { + return false + } return true } func matchUserAcl(a *UserAcl, b *UserAcl) bool { @@ -337,10 +605,10 @@ func matchUserAcl(a *UserAcl, b *UserAcl) bool { } else if a == nil && b == nil { return true } - if !util.OrderedListsMatch(a.IncludeList, b.IncludeList) { + if !util.OrderedListsMatch(a.ExcludeList, b.ExcludeList) { return false } - if !util.OrderedListsMatch(a.ExcludeList, b.ExcludeList) { + if !util.OrderedListsMatch(a.IncludeList, b.IncludeList) { return false } return true diff --git a/network/zone/location.go b/network/zone/location.go index 3d1ca60b..f3a75572 100644 --- a/network/zone/location.go +++ b/network/zone/location.go @@ -15,14 +15,9 @@ type ImportLocation interface { } type Location struct { - FromPanoramaVsys *FromPanoramaVsysLocation `json:"from_panorama_vsys,omitempty"` - Template *TemplateLocation `json:"template,omitempty"` - TemplateStack *TemplateStackLocation `json:"template_stack,omitempty"` - Vsys *VsysLocation `json:"vsys,omitempty"` -} - -type FromPanoramaVsysLocation struct { - Vsys string `json:"vsys"` + Template *TemplateLocation `json:"template,omitempty"` + TemplateStack *TemplateStackLocation `json:"template_stack,omitempty"` + Vsys *VsysLocation `json:"vsys,omitempty"` } type TemplateLocation struct { @@ -36,7 +31,6 @@ type TemplateStackLocation struct { NgfwDevice string `json:"ngfw_device"` PanoramaDevice string `json:"panorama_device"` TemplateStack string `json:"template_stack"` - Vsys string `json:"vsys"` } type VsysLocation struct { @@ -44,12 +38,6 @@ type VsysLocation struct { Vsys string `json:"vsys"` } -func NewFromPanoramaVsysLocation() *Location { - return &Location{FromPanoramaVsys: &FromPanoramaVsysLocation{ - Vsys: "vsys1", - }, - } -} func NewTemplateLocation() *Location { return &Location{Template: &TemplateLocation{ NgfwDevice: "localhost.localdomain", @@ -64,7 +52,6 @@ func NewTemplateStackLocation() *Location { NgfwDevice: "localhost.localdomain", PanoramaDevice: "localhost.localdomain", TemplateStack: "", - Vsys: "vsys1", }, } } @@ -80,11 +67,6 @@ func (o Location) IsValid() error { count := 0 switch { - case o.FromPanoramaVsys != nil: - if o.FromPanoramaVsys.Vsys == "" { - return fmt.Errorf("Vsys is unspecified") - } - count++ case o.Template != nil: if o.Template.NgfwDevice == "" { return fmt.Errorf("NgfwDevice is unspecified") @@ -109,9 +91,6 @@ func (o Location) IsValid() error { if o.TemplateStack.TemplateStack == "" { return fmt.Errorf("TemplateStack is unspecified") } - if o.TemplateStack.Vsys == "" { - return fmt.Errorf("Vsys is unspecified") - } count++ case o.Vsys != nil: if o.Vsys.NgfwDevice == "" { @@ -139,16 +118,6 @@ func (o Location) XpathPrefix(vn version.Number) ([]string, error) { var ans []string switch { - case o.FromPanoramaVsys != nil: - if o.FromPanoramaVsys.Vsys == "" { - return nil, fmt.Errorf("Vsys is unspecified") - } - ans = []string{ - "config", - "panorama", - "vsys", - util.AsEntryXpath([]string{o.FromPanoramaVsys.Vsys}), - } case o.Template != nil: if o.Template.NgfwDevice == "" { return nil, fmt.Errorf("NgfwDevice is unspecified") @@ -184,9 +153,6 @@ func (o Location) XpathPrefix(vn version.Number) ([]string, error) { if o.TemplateStack.TemplateStack == "" { return nil, fmt.Errorf("TemplateStack is unspecified") } - if o.TemplateStack.Vsys == "" { - return nil, fmt.Errorf("Vsys is unspecified") - } ans = []string{ "config", "devices", @@ -196,8 +162,6 @@ func (o Location) XpathPrefix(vn version.Number) ([]string, error) { "config", "devices", util.AsEntryXpath([]string{o.TemplateStack.NgfwDevice}), - "vsys", - util.AsEntryXpath([]string{o.TemplateStack.Vsys}), } case o.Vsys != nil: if o.Vsys.NgfwDevice == "" { diff --git a/objects/address/entry.go b/objects/address/entry.go index 9ac30dae..a9f2978f 100644 --- a/objects/address/entry.go +++ b/objects/address/entry.go @@ -19,13 +19,14 @@ var ( ) type Entry struct { - Name string - Description *string - Tags []string - Fqdn *string - IpNetmask *string - IpRange *string - IpWildcard *string + Name string + Description *string + DisableOverride *string + Tag []string + Fqdn *string + IpNetmask *string + IpRange *string + IpWildcard *string Misc map[string][]generic.Xml } @@ -35,14 +36,15 @@ type entryXmlContainer struct { } type entryXml struct { - XMLName xml.Name `xml:"entry"` - Name string `xml:"name,attr"` - Description *string `xml:"description,omitempty"` - Tags *util.MemberType `xml:"tag,omitempty"` - Fqdn *string `xml:"fqdn,omitempty"` - IpNetmask *string `xml:"ip-netmask,omitempty"` - IpRange *string `xml:"ip-range,omitempty"` - IpWildcard *string `xml:"ip-wildcard,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Description *string `xml:"description,omitempty"` + DisableOverride *string `xml:"disable-override,omitempty"` + Tag *util.MemberType `xml:"tag,omitempty"` + Fqdn *string `xml:"fqdn,omitempty"` + IpNetmask *string `xml:"ip-netmask,omitempty"` + IpRange *string `xml:"ip-range,omitempty"` + IpWildcard *string `xml:"ip-wildcard,omitempty"` Misc []generic.Xml `xml:",any"` } @@ -54,11 +56,14 @@ func (e *Entry) Field(v string) (any, error) { if v == "description" || v == "Description" { return e.Description, nil } - if v == "tags" || v == "Tags" { - return e.Tags, nil + if v == "disable_override" || v == "DisableOverride" { + return e.DisableOverride, nil } - if v == "tags|LENGTH" || v == "Tags|LENGTH" { - return int64(len(e.Tags)), nil + if v == "tag" || v == "Tag" { + return e.Tag, nil + } + if v == "tag|LENGTH" || v == "Tag|LENGTH" { + return int64(len(e.Tag)), nil } if v == "fqdn" || v == "Fqdn" { return e.Fqdn, nil @@ -77,15 +82,15 @@ func (e *Entry) Field(v string) (any, error) { } func Versioning(vn version.Number) (Specifier, Normalizer, error) { + return specifyEntry, &entryXmlContainer{}, nil } - func specifyEntry(o *Entry) (any, error) { entry := entryXml{} - entry.Name = o.Name entry.Description = o.Description - entry.Tags = util.StrToMem(o.Tags) + entry.DisableOverride = o.DisableOverride + entry.Tag = util.StrToMem(o.Tag) entry.Fqdn = o.Fqdn entry.IpNetmask = o.IpNetmask entry.IpRange = o.IpRange @@ -95,6 +100,7 @@ func specifyEntry(o *Entry) (any, error) { return entry, nil } + func (c *entryXmlContainer) Normalize() ([]*Entry, error) { entryList := make([]*Entry, 0, len(c.Answer)) for _, o := range c.Answer { @@ -103,7 +109,8 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { } entry.Name = o.Name entry.Description = o.Description - entry.Tags = util.MemToStr(o.Tags) + entry.DisableOverride = o.DisableOverride + entry.Tag = util.MemToStr(o.Tag) entry.Fqdn = o.Fqdn entry.IpNetmask = o.IpNetmask entry.IpRange = o.IpRange @@ -128,7 +135,10 @@ func SpecMatches(a, b *Entry) bool { if !util.StringsMatch(a.Description, b.Description) { return false } - if !util.OrderedListsMatch(a.Tags, b.Tags) { + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { + return false + } + if !util.OrderedListsMatch(a.Tag, b.Tag) { return false } if !util.StringsMatch(a.Fqdn, b.Fqdn) { diff --git a/objects/address/group/entry.go b/objects/address/group/entry.go index 813f1df4..d63b7685 100644 --- a/objects/address/group/entry.go +++ b/objects/address/group/entry.go @@ -19,26 +19,37 @@ var ( ) type Entry struct { - Name string - Description *string - Tags []string - Dynamic *string - Static []string + Name string + Description *string + DisableOverride *string + Tag []string + Dynamic *Dynamic + Static []string Misc map[string][]generic.Xml } +type Dynamic struct { + Filter *string +} + type entryXmlContainer struct { Answer []entryXml `xml:"entry"` } type entryXml struct { - XMLName xml.Name `xml:"entry"` - Name string `xml:"name,attr"` - Description *string `xml:"description,omitempty"` - Tags *util.MemberType `xml:"tag,omitempty"` - Dynamic *string `xml:"dynamic>filter,omitempty"` - Static *util.MemberType `xml:"static,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Description *string `xml:"description,omitempty"` + DisableOverride *string `xml:"disable-override,omitempty"` + Tag *util.MemberType `xml:"tag,omitempty"` + Dynamic *DynamicXml `xml:"dynamic,omitempty"` + Static *util.MemberType `xml:"static,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type DynamicXml struct { + Filter *string `xml:"filter,omitempty"` Misc []generic.Xml `xml:",any"` } @@ -50,11 +61,14 @@ func (e *Entry) Field(v string) (any, error) { if v == "description" || v == "Description" { return e.Description, nil } - if v == "tags" || v == "Tags" { - return e.Tags, nil + if v == "disable_override" || v == "DisableOverride" { + return e.DisableOverride, nil + } + if v == "tag" || v == "Tag" { + return e.Tag, nil } - if v == "tags|LENGTH" || v == "Tags|LENGTH" { - return int64(len(e.Tags)), nil + if v == "tag|LENGTH" || v == "Tag|LENGTH" { + return int64(len(e.Tag)), nil } if v == "dynamic" || v == "Dynamic" { return e.Dynamic, nil @@ -67,22 +81,34 @@ func (e *Entry) Field(v string) (any, error) { } func Versioning(vn version.Number) (Specifier, Normalizer, error) { + return specifyEntry, &entryXmlContainer{}, nil } - func specifyEntry(o *Entry) (any, error) { entry := entryXml{} - entry.Name = o.Name entry.Description = o.Description - entry.Tags = util.StrToMem(o.Tags) - entry.Dynamic = o.Dynamic + entry.DisableOverride = o.DisableOverride + entry.Tag = util.StrToMem(o.Tag) + var nestedDynamic *DynamicXml + if o.Dynamic != nil { + nestedDynamic = &DynamicXml{} + if _, ok := o.Misc["Dynamic"]; ok { + nestedDynamic.Misc = o.Misc["Dynamic"] + } + if o.Dynamic.Filter != nil { + nestedDynamic.Filter = o.Dynamic.Filter + } + } + entry.Dynamic = nestedDynamic + entry.Static = util.StrToMem(o.Static) entry.Misc = o.Misc["Entry"] return entry, nil } + func (c *entryXmlContainer) Normalize() ([]*Entry, error) { entryList := make([]*Entry, 0, len(c.Answer)) for _, o := range c.Answer { @@ -91,8 +117,20 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { } entry.Name = o.Name entry.Description = o.Description - entry.Tags = util.MemToStr(o.Tags) - entry.Dynamic = o.Dynamic + entry.DisableOverride = o.DisableOverride + entry.Tag = util.MemToStr(o.Tag) + var nestedDynamic *Dynamic + if o.Dynamic != nil { + nestedDynamic = &Dynamic{} + if o.Dynamic.Misc != nil { + entry.Misc["Dynamic"] = o.Dynamic.Misc + } + if o.Dynamic.Filter != nil { + nestedDynamic.Filter = o.Dynamic.Filter + } + } + entry.Dynamic = nestedDynamic + entry.Static = util.MemToStr(o.Static) entry.Misc["Entry"] = o.Misc @@ -114,10 +152,13 @@ func SpecMatches(a, b *Entry) bool { if !util.StringsMatch(a.Description, b.Description) { return false } - if !util.OrderedListsMatch(a.Tags, b.Tags) { + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { + return false + } + if !util.OrderedListsMatch(a.Tag, b.Tag) { return false } - if !util.StringsMatch(a.Dynamic, b.Dynamic) { + if !matchDynamic(a.Dynamic, b.Dynamic) { return false } if !util.OrderedListsMatch(a.Static, b.Static) { @@ -127,6 +168,18 @@ func SpecMatches(a, b *Entry) bool { return true } +func matchDynamic(a *Dynamic, b *Dynamic) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Filter, b.Filter) { + return false + } + return true +} + func (o *Entry) EntryName() string { return o.Name } diff --git a/objects/address/group/location.go b/objects/address/group/location.go index 204884e9..f61f6381 100644 --- a/objects/address/group/location.go +++ b/objects/address/group/location.go @@ -15,11 +15,9 @@ type ImportLocation interface { } type Location struct { - DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` - FromPanoramaShared bool `json:"from_panorama_shared"` - FromPanoramaVsys *FromPanoramaVsysLocation `json:"from_panorama_vsys,omitempty"` - Shared bool `json:"shared"` - Vsys *VsysLocation `json:"vsys,omitempty"` + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared bool `json:"shared"` + Vsys *VsysLocation `json:"vsys,omitempty"` } type DeviceGroupLocation struct { @@ -27,10 +25,6 @@ type DeviceGroupLocation struct { PanoramaDevice string `json:"panorama_device"` } -type FromPanoramaVsysLocation struct { - Vsys string `json:"vsys"` -} - type VsysLocation struct { NgfwDevice string `json:"ngfw_device"` Vsys string `json:"vsys"` @@ -43,12 +37,6 @@ func NewDeviceGroupLocation() *Location { }, } } -func NewFromPanoramaVsysLocation() *Location { - return &Location{FromPanoramaVsys: &FromPanoramaVsysLocation{ - Vsys: "vsys1", - }, - } -} func NewSharedLocation() *Location { return &Location{ Shared: true, @@ -74,13 +62,6 @@ func (o Location) IsValid() error { return fmt.Errorf("PanoramaDevice is unspecified") } count++ - case o.FromPanoramaShared: - count++ - case o.FromPanoramaVsys != nil: - if o.FromPanoramaVsys.Vsys == "" { - return fmt.Errorf("Vsys is unspecified") - } - count++ case o.Shared: count++ case o.Vsys != nil: @@ -123,22 +104,6 @@ func (o Location) XpathPrefix(vn version.Number) ([]string, error) { "device-group", util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), } - case o.FromPanoramaShared: - ans = []string{ - "config", - "panorama", - "shared", - } - case o.FromPanoramaVsys != nil: - if o.FromPanoramaVsys.Vsys == "" { - return nil, fmt.Errorf("Vsys is unspecified") - } - ans = []string{ - "config", - "panorama", - "vsys", - util.AsEntryXpath([]string{o.FromPanoramaVsys.Vsys}), - } case o.Shared: ans = []string{ "config", diff --git a/objects/address/location.go b/objects/address/location.go index 4c95d355..43adca2c 100644 --- a/objects/address/location.go +++ b/objects/address/location.go @@ -15,11 +15,9 @@ type ImportLocation interface { } type Location struct { - DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` - FromPanoramaShared bool `json:"from_panorama_shared"` - FromPanoramaVsys *FromPanoramaVsysLocation `json:"from_panorama_vsys,omitempty"` - Shared bool `json:"shared"` - Vsys *VsysLocation `json:"vsys,omitempty"` + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared bool `json:"shared"` + Vsys *VsysLocation `json:"vsys,omitempty"` } type DeviceGroupLocation struct { @@ -27,10 +25,6 @@ type DeviceGroupLocation struct { PanoramaDevice string `json:"panorama_device"` } -type FromPanoramaVsysLocation struct { - Vsys string `json:"vsys"` -} - type VsysLocation struct { NgfwDevice string `json:"ngfw_device"` Vsys string `json:"vsys"` @@ -43,12 +37,6 @@ func NewDeviceGroupLocation() *Location { }, } } -func NewFromPanoramaVsysLocation() *Location { - return &Location{FromPanoramaVsys: &FromPanoramaVsysLocation{ - Vsys: "vsys1", - }, - } -} func NewSharedLocation() *Location { return &Location{ Shared: true, @@ -74,13 +62,6 @@ func (o Location) IsValid() error { return fmt.Errorf("PanoramaDevice is unspecified") } count++ - case o.FromPanoramaShared: - count++ - case o.FromPanoramaVsys != nil: - if o.FromPanoramaVsys.Vsys == "" { - return fmt.Errorf("Vsys is unspecified") - } - count++ case o.Shared: count++ case o.Vsys != nil: @@ -123,22 +104,6 @@ func (o Location) XpathPrefix(vn version.Number) ([]string, error) { "device-group", util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), } - case o.FromPanoramaShared: - ans = []string{ - "config", - "panorama", - "shared", - } - case o.FromPanoramaVsys != nil: - if o.FromPanoramaVsys.Vsys == "" { - return nil, fmt.Errorf("Vsys is unspecified") - } - ans = []string{ - "config", - "panorama", - "vsys", - util.AsEntryXpath([]string{o.FromPanoramaVsys.Vsys}), - } case o.Shared: ans = []string{ "config", diff --git a/objects/admintag/entry.go b/objects/admintag/entry.go new file mode 100644 index 00000000..c2005971 --- /dev/null +++ b/objects/admintag/entry.go @@ -0,0 +1,166 @@ +package admintag + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"tag"} +) + +type Entry struct { + Name string + Color *string + Comments *string + DisableOverride *string + + Misc map[string][]generic.Xml +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Color *string `xml:"color,omitempty"` + Comments *string `xml:"comments,omitempty"` + DisableOverride *string `xml:"disable-override,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +const ( + ColorAzureBlue = "color24" + ColorBlack = "color14" + ColorBlueGray = "color12" + ColorBlueViolet = "color30" + ColorBrown = "color16" + ColorBurntSienna = "color41" + ColorCeruleanBlue = "color25" + ColorChestnut = "color42" + ColorCobaltBlue = "color28" + ColorCopper = "color4" + ColorCyan = "color9" + ColorForestGreen = "color22" + ColorGold = "color15" + ColorGray = "color7" + ColorGreen = "color2" + ColorLavender = "color33" + ColorLightGray = "color10" + ColorLightGreen = "color8" + ColorLime = "color13" + ColorMagenta = "color38" + ColorMahogany = "color40" + ColorMaroon = "color19" + ColorMediumBlue = "color27" + ColorMediumRose = "color32" + ColorMediumViolet = "color31" + ColorMidnightBlue = "color26" + ColorOlive = "color17" + ColorOrange = "color5" + ColorOrchid = "color34" + ColorPeach = "color36" + ColorPurple = "color6" + ColorRed = "color1" + ColorRedViolet = "color39" + ColorRedOrange = "color20" + ColorSalmon = "color37" + ColorThistle = "color35" + ColorTurquoiseBlue = "color23" + ColorVioletBlue = "color29" + ColorYellow = "color3" + ColorYellowOrange = "color21" +) + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "color" || v == "Color" { + return e.Color, nil + } + if v == "comments" || v == "Comments" { + return e.Comments, nil + } + if v == "disable_override" || v == "DisableOverride" { + return e.DisableOverride, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.Color = o.Color + entry.Comments = o.Comments + entry.DisableOverride = o.DisableOverride + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.Color = o.Color + entry.Comments = o.Comments + entry.DisableOverride = o.DisableOverride + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.StringsMatch(a.Color, b.Color) { + return false + } + if !util.StringsMatch(a.Comments, b.Comments) { + return false + } + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { + return false + } + + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/objects/admintag/interfaces.go b/objects/admintag/interfaces.go new file mode 100644 index 00000000..7b6de7b0 --- /dev/null +++ b/objects/admintag/interfaces.go @@ -0,0 +1,7 @@ +package admintag + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/objects/admintag/location.go b/objects/admintag/location.go new file mode 100644 index 00000000..753266bb --- /dev/null +++ b/objects/admintag/location.go @@ -0,0 +1,153 @@ +package admintag + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared bool `json:"shared"` + Vsys *VsysLocation `json:"vsys,omitempty"` +} + +type DeviceGroupLocation struct { + DeviceGroup string `json:"device_group"` + PanoramaDevice string `json:"panorama_device"` +} + +type VsysLocation struct { + NgfwDevice string `json:"ngfw_device"` + Vsys string `json:"vsys"` +} + +func NewDeviceGroupLocation() *Location { + return &Location{DeviceGroup: &DeviceGroupLocation{ + DeviceGroup: "", + PanoramaDevice: "localhost.localdomain", + }, + } +} +func NewSharedLocation() *Location { + return &Location{ + Shared: true, + } +} +func NewVsysLocation() *Location { + return &Location{Vsys: &VsysLocation{ + NgfwDevice: "localhost.localdomain", + Vsys: "vsys1", + }, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + count++ + case o.Shared: + count++ + case o.Vsys != nil: + if o.Vsys.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.Vsys.Vsys == "" { + return fmt.Errorf("Vsys is unspecified") + } + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return nil, fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.DeviceGroup.PanoramaDevice}), + "device-group", + util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), + } + case o.Shared: + ans = []string{ + "config", + "shared", + } + case o.Vsys != nil: + if o.Vsys.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.Vsys.Vsys == "" { + return nil, fmt.Errorf("Vsys is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Vsys.NgfwDevice}), + "vsys", + util.AsEntryXpath([]string{o.Vsys.Vsys}), + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/objects/admintag/service.go b/objects/admintag/service.go new file mode 100644 index 00000000..38c6ab91 --- /dev/null +++ b/objects/admintag/service.go @@ -0,0 +1,281 @@ +package admintag + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/objects/extdynlist/entry.go b/objects/extdynlist/entry.go new file mode 100644 index 00000000..f02de8b3 --- /dev/null +++ b/objects/extdynlist/entry.go @@ -0,0 +1,2117 @@ +package extdynlist + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"address"} +) + +type Entry struct { + Name string + DisableOverride *string + Type *Type + + Misc map[string][]generic.Xml +} + +type Type struct { + Domain *TypeDomain + Imei *TypeImei + Imsi *TypeImsi + Ip *TypeIp + PredefinedIp *TypePredefinedIp + PredefinedUrl *TypePredefinedUrl + Url *TypeUrl +} +type TypeDomain struct { + Auth *TypeDomainAuth + CertificateProfile *string + Description *string + ExceptionList []string + ExpandDomain *bool + Recurring *TypeDomainRecurring + Url *string +} +type TypeDomainAuth struct { + Password *string + Username *string +} +type TypeDomainRecurring struct { + Daily *TypeDomainRecurringDaily + FiveMinute *TypeDomainRecurringFiveMinute + Hourly *TypeDomainRecurringHourly + Monthly *TypeDomainRecurringMonthly + Weekly *TypeDomainRecurringWeekly +} +type TypeDomainRecurringDaily struct { + At *string +} +type TypeDomainRecurringFiveMinute struct { +} +type TypeDomainRecurringHourly struct { +} +type TypeDomainRecurringMonthly struct { + At *string + DayOfMonth *int64 +} +type TypeDomainRecurringWeekly struct { + At *string + DayOfWeek *string +} +type TypeImei struct { + Auth *TypeImeiAuth + CertificateProfile *string + Description *string + ExceptionList []string + Recurring *TypeImeiRecurring + Url *string +} +type TypeImeiAuth struct { + Password *string + Username *string +} +type TypeImeiRecurring struct { + Daily *TypeImeiRecurringDaily + FiveMinute *TypeImeiRecurringFiveMinute + Hourly *TypeImeiRecurringHourly + Monthly *TypeImeiRecurringMonthly + Weekly *TypeImeiRecurringWeekly +} +type TypeImeiRecurringDaily struct { + At *string +} +type TypeImeiRecurringFiveMinute struct { +} +type TypeImeiRecurringHourly struct { +} +type TypeImeiRecurringMonthly struct { + At *string + DayOfMonth *int64 +} +type TypeImeiRecurringWeekly struct { + At *string + DayOfWeek *string +} +type TypeImsi struct { + Auth *TypeImsiAuth + CertificateProfile *string + Description *string + ExceptionList []string + Recurring *TypeImsiRecurring + Url *string +} +type TypeImsiAuth struct { + Password *string + Username *string +} +type TypeImsiRecurring struct { + Daily *TypeImsiRecurringDaily + FiveMinute *TypeImsiRecurringFiveMinute + Hourly *TypeImsiRecurringHourly + Monthly *TypeImsiRecurringMonthly + Weekly *TypeImsiRecurringWeekly +} +type TypeImsiRecurringDaily struct { + At *string +} +type TypeImsiRecurringFiveMinute struct { +} +type TypeImsiRecurringHourly struct { +} +type TypeImsiRecurringMonthly struct { + At *string + DayOfMonth *int64 +} +type TypeImsiRecurringWeekly struct { + At *string + DayOfWeek *string +} +type TypeIp struct { + Auth *TypeIpAuth + CertificateProfile *string + Description *string + ExceptionList []string + Recurring *TypeIpRecurring + Url *string +} +type TypeIpAuth struct { + Password *string + Username *string +} +type TypeIpRecurring struct { + Daily *TypeIpRecurringDaily + FiveMinute *TypeIpRecurringFiveMinute + Hourly *TypeIpRecurringHourly + Monthly *TypeIpRecurringMonthly + Weekly *TypeIpRecurringWeekly +} +type TypeIpRecurringDaily struct { + At *string +} +type TypeIpRecurringFiveMinute struct { +} +type TypeIpRecurringHourly struct { +} +type TypeIpRecurringMonthly struct { + At *string + DayOfMonth *int64 +} +type TypeIpRecurringWeekly struct { + At *string + DayOfWeek *string +} +type TypePredefinedIp struct { + Description *string + ExceptionList []string + Url *string +} +type TypePredefinedUrl struct { + Description *string + ExceptionList []string + Url *string +} +type TypeUrl struct { + Auth *TypeUrlAuth + CertificateProfile *string + Description *string + ExceptionList []string + Recurring *TypeUrlRecurring + Url *string +} +type TypeUrlAuth struct { + Password *string + Username *string +} +type TypeUrlRecurring struct { + Daily *TypeUrlRecurringDaily + FiveMinute *TypeUrlRecurringFiveMinute + Hourly *TypeUrlRecurringHourly + Monthly *TypeUrlRecurringMonthly + Weekly *TypeUrlRecurringWeekly +} +type TypeUrlRecurringDaily struct { + At *string +} +type TypeUrlRecurringFiveMinute struct { +} +type TypeUrlRecurringHourly struct { +} +type TypeUrlRecurringMonthly struct { + At *string + DayOfMonth *int64 +} +type TypeUrlRecurringWeekly struct { + At *string + DayOfWeek *string +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + DisableOverride *string `xml:"disable-override,omitempty"` + Type *TypeXml `xml:"type,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeXml struct { + Domain *TypeDomainXml `xml:"domain,omitempty"` + Imei *TypeImeiXml `xml:"imei,omitempty"` + Imsi *TypeImsiXml `xml:"imsi,omitempty"` + Ip *TypeIpXml `xml:"ip,omitempty"` + PredefinedIp *TypePredefinedIpXml `xml:"predefined-ip,omitempty"` + PredefinedUrl *TypePredefinedUrlXml `xml:"predefined-url,omitempty"` + Url *TypeUrlXml `xml:"url,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeDomainXml struct { + Auth *TypeDomainAuthXml `xml:"auth,omitempty"` + CertificateProfile *string `xml:"certificate-profile,omitempty"` + Description *string `xml:"description,omitempty"` + ExceptionList *util.MemberType `xml:"exception-list,omitempty"` + ExpandDomain *string `xml:"expand-domain,omitempty"` + Recurring *TypeDomainRecurringXml `xml:"recurring,omitempty"` + Url *string `xml:"url,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeDomainAuthXml struct { + Password *string `xml:"password,omitempty"` + Username *string `xml:"username,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeDomainRecurringXml struct { + Daily *TypeDomainRecurringDailyXml `xml:"daily,omitempty"` + FiveMinute *TypeDomainRecurringFiveMinuteXml `xml:"five-minute,omitempty"` + Hourly *TypeDomainRecurringHourlyXml `xml:"hourly,omitempty"` + Monthly *TypeDomainRecurringMonthlyXml `xml:"monthly,omitempty"` + Weekly *TypeDomainRecurringWeeklyXml `xml:"weekly,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeDomainRecurringDailyXml struct { + At *string `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeDomainRecurringFiveMinuteXml struct { + Misc []generic.Xml `xml:",any"` +} +type TypeDomainRecurringHourlyXml struct { + Misc []generic.Xml `xml:",any"` +} +type TypeDomainRecurringMonthlyXml struct { + At *string `xml:"at,omitempty"` + DayOfMonth *int64 `xml:"day-of-month,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeDomainRecurringWeeklyXml struct { + At *string `xml:"at,omitempty"` + DayOfWeek *string `xml:"day-of-week,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeImeiXml struct { + Auth *TypeImeiAuthXml `xml:"auth,omitempty"` + CertificateProfile *string `xml:"certificate-profile,omitempty"` + Description *string `xml:"description,omitempty"` + ExceptionList *util.MemberType `xml:"exception-list,omitempty"` + Recurring *TypeImeiRecurringXml `xml:"recurring,omitempty"` + Url *string `xml:"url,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeImeiAuthXml struct { + Password *string `xml:"password,omitempty"` + Username *string `xml:"username,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeImeiRecurringXml struct { + Daily *TypeImeiRecurringDailyXml `xml:"daily,omitempty"` + FiveMinute *TypeImeiRecurringFiveMinuteXml `xml:"five-minute,omitempty"` + Hourly *TypeImeiRecurringHourlyXml `xml:"hourly,omitempty"` + Monthly *TypeImeiRecurringMonthlyXml `xml:"monthly,omitempty"` + Weekly *TypeImeiRecurringWeeklyXml `xml:"weekly,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeImeiRecurringDailyXml struct { + At *string `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeImeiRecurringFiveMinuteXml struct { + Misc []generic.Xml `xml:",any"` +} +type TypeImeiRecurringHourlyXml struct { + Misc []generic.Xml `xml:",any"` +} +type TypeImeiRecurringMonthlyXml struct { + At *string `xml:"at,omitempty"` + DayOfMonth *int64 `xml:"day-of-month,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeImeiRecurringWeeklyXml struct { + At *string `xml:"at,omitempty"` + DayOfWeek *string `xml:"day-of-week,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeImsiXml struct { + Auth *TypeImsiAuthXml `xml:"auth,omitempty"` + CertificateProfile *string `xml:"certificate-profile,omitempty"` + Description *string `xml:"description,omitempty"` + ExceptionList *util.MemberType `xml:"exception-list,omitempty"` + Recurring *TypeImsiRecurringXml `xml:"recurring,omitempty"` + Url *string `xml:"url,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeImsiAuthXml struct { + Password *string `xml:"password,omitempty"` + Username *string `xml:"username,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeImsiRecurringXml struct { + Daily *TypeImsiRecurringDailyXml `xml:"daily,omitempty"` + FiveMinute *TypeImsiRecurringFiveMinuteXml `xml:"five-minute,omitempty"` + Hourly *TypeImsiRecurringHourlyXml `xml:"hourly,omitempty"` + Monthly *TypeImsiRecurringMonthlyXml `xml:"monthly,omitempty"` + Weekly *TypeImsiRecurringWeeklyXml `xml:"weekly,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeImsiRecurringDailyXml struct { + At *string `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeImsiRecurringFiveMinuteXml struct { + Misc []generic.Xml `xml:",any"` +} +type TypeImsiRecurringHourlyXml struct { + Misc []generic.Xml `xml:",any"` +} +type TypeImsiRecurringMonthlyXml struct { + At *string `xml:"at,omitempty"` + DayOfMonth *int64 `xml:"day-of-month,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeImsiRecurringWeeklyXml struct { + At *string `xml:"at,omitempty"` + DayOfWeek *string `xml:"day-of-week,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeIpXml struct { + Auth *TypeIpAuthXml `xml:"auth,omitempty"` + CertificateProfile *string `xml:"certificate-profile,omitempty"` + Description *string `xml:"description,omitempty"` + ExceptionList *util.MemberType `xml:"exception-list,omitempty"` + Recurring *TypeIpRecurringXml `xml:"recurring,omitempty"` + Url *string `xml:"url,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeIpAuthXml struct { + Password *string `xml:"password,omitempty"` + Username *string `xml:"username,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeIpRecurringXml struct { + Daily *TypeIpRecurringDailyXml `xml:"daily,omitempty"` + FiveMinute *TypeIpRecurringFiveMinuteXml `xml:"five-minute,omitempty"` + Hourly *TypeIpRecurringHourlyXml `xml:"hourly,omitempty"` + Monthly *TypeIpRecurringMonthlyXml `xml:"monthly,omitempty"` + Weekly *TypeIpRecurringWeeklyXml `xml:"weekly,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeIpRecurringDailyXml struct { + At *string `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeIpRecurringFiveMinuteXml struct { + Misc []generic.Xml `xml:",any"` +} +type TypeIpRecurringHourlyXml struct { + Misc []generic.Xml `xml:",any"` +} +type TypeIpRecurringMonthlyXml struct { + At *string `xml:"at,omitempty"` + DayOfMonth *int64 `xml:"day-of-month,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeIpRecurringWeeklyXml struct { + At *string `xml:"at,omitempty"` + DayOfWeek *string `xml:"day-of-week,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypePredefinedIpXml struct { + Description *string `xml:"description,omitempty"` + ExceptionList *util.MemberType `xml:"exception-list,omitempty"` + Url *string `xml:"url,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypePredefinedUrlXml struct { + Description *string `xml:"description,omitempty"` + ExceptionList *util.MemberType `xml:"exception-list,omitempty"` + Url *string `xml:"url,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeUrlXml struct { + Auth *TypeUrlAuthXml `xml:"auth,omitempty"` + CertificateProfile *string `xml:"certificate-profile,omitempty"` + Description *string `xml:"description,omitempty"` + ExceptionList *util.MemberType `xml:"exception-list,omitempty"` + Recurring *TypeUrlRecurringXml `xml:"recurring,omitempty"` + Url *string `xml:"url,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeUrlAuthXml struct { + Password *string `xml:"password,omitempty"` + Username *string `xml:"username,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeUrlRecurringXml struct { + Daily *TypeUrlRecurringDailyXml `xml:"daily,omitempty"` + FiveMinute *TypeUrlRecurringFiveMinuteXml `xml:"five-minute,omitempty"` + Hourly *TypeUrlRecurringHourlyXml `xml:"hourly,omitempty"` + Monthly *TypeUrlRecurringMonthlyXml `xml:"monthly,omitempty"` + Weekly *TypeUrlRecurringWeeklyXml `xml:"weekly,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeUrlRecurringDailyXml struct { + At *string `xml:"at,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeUrlRecurringFiveMinuteXml struct { + Misc []generic.Xml `xml:",any"` +} +type TypeUrlRecurringHourlyXml struct { + Misc []generic.Xml `xml:",any"` +} +type TypeUrlRecurringMonthlyXml struct { + At *string `xml:"at,omitempty"` + DayOfMonth *int64 `xml:"day-of-month,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeUrlRecurringWeeklyXml struct { + At *string `xml:"at,omitempty"` + DayOfWeek *string `xml:"day-of-week,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "disable_override" || v == "DisableOverride" { + return e.DisableOverride, nil + } + if v == "type" || v == "Type" { + return e.Type, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.DisableOverride = o.DisableOverride + var nestedType *TypeXml + if o.Type != nil { + nestedType = &TypeXml{} + if _, ok := o.Misc["Type"]; ok { + nestedType.Misc = o.Misc["Type"] + } + if o.Type.Domain != nil { + nestedType.Domain = &TypeDomainXml{} + if _, ok := o.Misc["TypeDomain"]; ok { + nestedType.Domain.Misc = o.Misc["TypeDomain"] + } + if o.Type.Domain.Auth != nil { + nestedType.Domain.Auth = &TypeDomainAuthXml{} + if _, ok := o.Misc["TypeDomainAuth"]; ok { + nestedType.Domain.Auth.Misc = o.Misc["TypeDomainAuth"] + } + if o.Type.Domain.Auth.Password != nil { + nestedType.Domain.Auth.Password = o.Type.Domain.Auth.Password + } + if o.Type.Domain.Auth.Username != nil { + nestedType.Domain.Auth.Username = o.Type.Domain.Auth.Username + } + } + if o.Type.Domain.CertificateProfile != nil { + nestedType.Domain.CertificateProfile = o.Type.Domain.CertificateProfile + } + if o.Type.Domain.Description != nil { + nestedType.Domain.Description = o.Type.Domain.Description + } + if o.Type.Domain.ExceptionList != nil { + nestedType.Domain.ExceptionList = util.StrToMem(o.Type.Domain.ExceptionList) + } + if o.Type.Domain.ExpandDomain != nil { + nestedType.Domain.ExpandDomain = util.YesNo(o.Type.Domain.ExpandDomain, nil) + } + if o.Type.Domain.Recurring != nil { + nestedType.Domain.Recurring = &TypeDomainRecurringXml{} + if _, ok := o.Misc["TypeDomainRecurring"]; ok { + nestedType.Domain.Recurring.Misc = o.Misc["TypeDomainRecurring"] + } + if o.Type.Domain.Recurring.Daily != nil { + nestedType.Domain.Recurring.Daily = &TypeDomainRecurringDailyXml{} + if _, ok := o.Misc["TypeDomainRecurringDaily"]; ok { + nestedType.Domain.Recurring.Daily.Misc = o.Misc["TypeDomainRecurringDaily"] + } + if o.Type.Domain.Recurring.Daily.At != nil { + nestedType.Domain.Recurring.Daily.At = o.Type.Domain.Recurring.Daily.At + } + } + if o.Type.Domain.Recurring.FiveMinute != nil { + nestedType.Domain.Recurring.FiveMinute = &TypeDomainRecurringFiveMinuteXml{} + if _, ok := o.Misc["TypeDomainRecurringFiveMinute"]; ok { + nestedType.Domain.Recurring.FiveMinute.Misc = o.Misc["TypeDomainRecurringFiveMinute"] + } + } + if o.Type.Domain.Recurring.Hourly != nil { + nestedType.Domain.Recurring.Hourly = &TypeDomainRecurringHourlyXml{} + if _, ok := o.Misc["TypeDomainRecurringHourly"]; ok { + nestedType.Domain.Recurring.Hourly.Misc = o.Misc["TypeDomainRecurringHourly"] + } + } + if o.Type.Domain.Recurring.Monthly != nil { + nestedType.Domain.Recurring.Monthly = &TypeDomainRecurringMonthlyXml{} + if _, ok := o.Misc["TypeDomainRecurringMonthly"]; ok { + nestedType.Domain.Recurring.Monthly.Misc = o.Misc["TypeDomainRecurringMonthly"] + } + if o.Type.Domain.Recurring.Monthly.At != nil { + nestedType.Domain.Recurring.Monthly.At = o.Type.Domain.Recurring.Monthly.At + } + if o.Type.Domain.Recurring.Monthly.DayOfMonth != nil { + nestedType.Domain.Recurring.Monthly.DayOfMonth = o.Type.Domain.Recurring.Monthly.DayOfMonth + } + } + if o.Type.Domain.Recurring.Weekly != nil { + nestedType.Domain.Recurring.Weekly = &TypeDomainRecurringWeeklyXml{} + if _, ok := o.Misc["TypeDomainRecurringWeekly"]; ok { + nestedType.Domain.Recurring.Weekly.Misc = o.Misc["TypeDomainRecurringWeekly"] + } + if o.Type.Domain.Recurring.Weekly.At != nil { + nestedType.Domain.Recurring.Weekly.At = o.Type.Domain.Recurring.Weekly.At + } + if o.Type.Domain.Recurring.Weekly.DayOfWeek != nil { + nestedType.Domain.Recurring.Weekly.DayOfWeek = o.Type.Domain.Recurring.Weekly.DayOfWeek + } + } + } + if o.Type.Domain.Url != nil { + nestedType.Domain.Url = o.Type.Domain.Url + } + } + if o.Type.Imei != nil { + nestedType.Imei = &TypeImeiXml{} + if _, ok := o.Misc["TypeImei"]; ok { + nestedType.Imei.Misc = o.Misc["TypeImei"] + } + if o.Type.Imei.Auth != nil { + nestedType.Imei.Auth = &TypeImeiAuthXml{} + if _, ok := o.Misc["TypeImeiAuth"]; ok { + nestedType.Imei.Auth.Misc = o.Misc["TypeImeiAuth"] + } + if o.Type.Imei.Auth.Password != nil { + nestedType.Imei.Auth.Password = o.Type.Imei.Auth.Password + } + if o.Type.Imei.Auth.Username != nil { + nestedType.Imei.Auth.Username = o.Type.Imei.Auth.Username + } + } + if o.Type.Imei.CertificateProfile != nil { + nestedType.Imei.CertificateProfile = o.Type.Imei.CertificateProfile + } + if o.Type.Imei.Description != nil { + nestedType.Imei.Description = o.Type.Imei.Description + } + if o.Type.Imei.ExceptionList != nil { + nestedType.Imei.ExceptionList = util.StrToMem(o.Type.Imei.ExceptionList) + } + if o.Type.Imei.Recurring != nil { + nestedType.Imei.Recurring = &TypeImeiRecurringXml{} + if _, ok := o.Misc["TypeImeiRecurring"]; ok { + nestedType.Imei.Recurring.Misc = o.Misc["TypeImeiRecurring"] + } + if o.Type.Imei.Recurring.Daily != nil { + nestedType.Imei.Recurring.Daily = &TypeImeiRecurringDailyXml{} + if _, ok := o.Misc["TypeImeiRecurringDaily"]; ok { + nestedType.Imei.Recurring.Daily.Misc = o.Misc["TypeImeiRecurringDaily"] + } + if o.Type.Imei.Recurring.Daily.At != nil { + nestedType.Imei.Recurring.Daily.At = o.Type.Imei.Recurring.Daily.At + } + } + if o.Type.Imei.Recurring.FiveMinute != nil { + nestedType.Imei.Recurring.FiveMinute = &TypeImeiRecurringFiveMinuteXml{} + if _, ok := o.Misc["TypeImeiRecurringFiveMinute"]; ok { + nestedType.Imei.Recurring.FiveMinute.Misc = o.Misc["TypeImeiRecurringFiveMinute"] + } + } + if o.Type.Imei.Recurring.Hourly != nil { + nestedType.Imei.Recurring.Hourly = &TypeImeiRecurringHourlyXml{} + if _, ok := o.Misc["TypeImeiRecurringHourly"]; ok { + nestedType.Imei.Recurring.Hourly.Misc = o.Misc["TypeImeiRecurringHourly"] + } + } + if o.Type.Imei.Recurring.Monthly != nil { + nestedType.Imei.Recurring.Monthly = &TypeImeiRecurringMonthlyXml{} + if _, ok := o.Misc["TypeImeiRecurringMonthly"]; ok { + nestedType.Imei.Recurring.Monthly.Misc = o.Misc["TypeImeiRecurringMonthly"] + } + if o.Type.Imei.Recurring.Monthly.At != nil { + nestedType.Imei.Recurring.Monthly.At = o.Type.Imei.Recurring.Monthly.At + } + if o.Type.Imei.Recurring.Monthly.DayOfMonth != nil { + nestedType.Imei.Recurring.Monthly.DayOfMonth = o.Type.Imei.Recurring.Monthly.DayOfMonth + } + } + if o.Type.Imei.Recurring.Weekly != nil { + nestedType.Imei.Recurring.Weekly = &TypeImeiRecurringWeeklyXml{} + if _, ok := o.Misc["TypeImeiRecurringWeekly"]; ok { + nestedType.Imei.Recurring.Weekly.Misc = o.Misc["TypeImeiRecurringWeekly"] + } + if o.Type.Imei.Recurring.Weekly.DayOfWeek != nil { + nestedType.Imei.Recurring.Weekly.DayOfWeek = o.Type.Imei.Recurring.Weekly.DayOfWeek + } + if o.Type.Imei.Recurring.Weekly.At != nil { + nestedType.Imei.Recurring.Weekly.At = o.Type.Imei.Recurring.Weekly.At + } + } + } + if o.Type.Imei.Url != nil { + nestedType.Imei.Url = o.Type.Imei.Url + } + } + if o.Type.Imsi != nil { + nestedType.Imsi = &TypeImsiXml{} + if _, ok := o.Misc["TypeImsi"]; ok { + nestedType.Imsi.Misc = o.Misc["TypeImsi"] + } + if o.Type.Imsi.Auth != nil { + nestedType.Imsi.Auth = &TypeImsiAuthXml{} + if _, ok := o.Misc["TypeImsiAuth"]; ok { + nestedType.Imsi.Auth.Misc = o.Misc["TypeImsiAuth"] + } + if o.Type.Imsi.Auth.Password != nil { + nestedType.Imsi.Auth.Password = o.Type.Imsi.Auth.Password + } + if o.Type.Imsi.Auth.Username != nil { + nestedType.Imsi.Auth.Username = o.Type.Imsi.Auth.Username + } + } + if o.Type.Imsi.CertificateProfile != nil { + nestedType.Imsi.CertificateProfile = o.Type.Imsi.CertificateProfile + } + if o.Type.Imsi.Description != nil { + nestedType.Imsi.Description = o.Type.Imsi.Description + } + if o.Type.Imsi.ExceptionList != nil { + nestedType.Imsi.ExceptionList = util.StrToMem(o.Type.Imsi.ExceptionList) + } + if o.Type.Imsi.Recurring != nil { + nestedType.Imsi.Recurring = &TypeImsiRecurringXml{} + if _, ok := o.Misc["TypeImsiRecurring"]; ok { + nestedType.Imsi.Recurring.Misc = o.Misc["TypeImsiRecurring"] + } + if o.Type.Imsi.Recurring.Daily != nil { + nestedType.Imsi.Recurring.Daily = &TypeImsiRecurringDailyXml{} + if _, ok := o.Misc["TypeImsiRecurringDaily"]; ok { + nestedType.Imsi.Recurring.Daily.Misc = o.Misc["TypeImsiRecurringDaily"] + } + if o.Type.Imsi.Recurring.Daily.At != nil { + nestedType.Imsi.Recurring.Daily.At = o.Type.Imsi.Recurring.Daily.At + } + } + if o.Type.Imsi.Recurring.FiveMinute != nil { + nestedType.Imsi.Recurring.FiveMinute = &TypeImsiRecurringFiveMinuteXml{} + if _, ok := o.Misc["TypeImsiRecurringFiveMinute"]; ok { + nestedType.Imsi.Recurring.FiveMinute.Misc = o.Misc["TypeImsiRecurringFiveMinute"] + } + } + if o.Type.Imsi.Recurring.Hourly != nil { + nestedType.Imsi.Recurring.Hourly = &TypeImsiRecurringHourlyXml{} + if _, ok := o.Misc["TypeImsiRecurringHourly"]; ok { + nestedType.Imsi.Recurring.Hourly.Misc = o.Misc["TypeImsiRecurringHourly"] + } + } + if o.Type.Imsi.Recurring.Monthly != nil { + nestedType.Imsi.Recurring.Monthly = &TypeImsiRecurringMonthlyXml{} + if _, ok := o.Misc["TypeImsiRecurringMonthly"]; ok { + nestedType.Imsi.Recurring.Monthly.Misc = o.Misc["TypeImsiRecurringMonthly"] + } + if o.Type.Imsi.Recurring.Monthly.At != nil { + nestedType.Imsi.Recurring.Monthly.At = o.Type.Imsi.Recurring.Monthly.At + } + if o.Type.Imsi.Recurring.Monthly.DayOfMonth != nil { + nestedType.Imsi.Recurring.Monthly.DayOfMonth = o.Type.Imsi.Recurring.Monthly.DayOfMonth + } + } + if o.Type.Imsi.Recurring.Weekly != nil { + nestedType.Imsi.Recurring.Weekly = &TypeImsiRecurringWeeklyXml{} + if _, ok := o.Misc["TypeImsiRecurringWeekly"]; ok { + nestedType.Imsi.Recurring.Weekly.Misc = o.Misc["TypeImsiRecurringWeekly"] + } + if o.Type.Imsi.Recurring.Weekly.At != nil { + nestedType.Imsi.Recurring.Weekly.At = o.Type.Imsi.Recurring.Weekly.At + } + if o.Type.Imsi.Recurring.Weekly.DayOfWeek != nil { + nestedType.Imsi.Recurring.Weekly.DayOfWeek = o.Type.Imsi.Recurring.Weekly.DayOfWeek + } + } + } + if o.Type.Imsi.Url != nil { + nestedType.Imsi.Url = o.Type.Imsi.Url + } + } + if o.Type.Ip != nil { + nestedType.Ip = &TypeIpXml{} + if _, ok := o.Misc["TypeIp"]; ok { + nestedType.Ip.Misc = o.Misc["TypeIp"] + } + if o.Type.Ip.CertificateProfile != nil { + nestedType.Ip.CertificateProfile = o.Type.Ip.CertificateProfile + } + if o.Type.Ip.Description != nil { + nestedType.Ip.Description = o.Type.Ip.Description + } + if o.Type.Ip.ExceptionList != nil { + nestedType.Ip.ExceptionList = util.StrToMem(o.Type.Ip.ExceptionList) + } + if o.Type.Ip.Recurring != nil { + nestedType.Ip.Recurring = &TypeIpRecurringXml{} + if _, ok := o.Misc["TypeIpRecurring"]; ok { + nestedType.Ip.Recurring.Misc = o.Misc["TypeIpRecurring"] + } + if o.Type.Ip.Recurring.Weekly != nil { + nestedType.Ip.Recurring.Weekly = &TypeIpRecurringWeeklyXml{} + if _, ok := o.Misc["TypeIpRecurringWeekly"]; ok { + nestedType.Ip.Recurring.Weekly.Misc = o.Misc["TypeIpRecurringWeekly"] + } + if o.Type.Ip.Recurring.Weekly.At != nil { + nestedType.Ip.Recurring.Weekly.At = o.Type.Ip.Recurring.Weekly.At + } + if o.Type.Ip.Recurring.Weekly.DayOfWeek != nil { + nestedType.Ip.Recurring.Weekly.DayOfWeek = o.Type.Ip.Recurring.Weekly.DayOfWeek + } + } + if o.Type.Ip.Recurring.Daily != nil { + nestedType.Ip.Recurring.Daily = &TypeIpRecurringDailyXml{} + if _, ok := o.Misc["TypeIpRecurringDaily"]; ok { + nestedType.Ip.Recurring.Daily.Misc = o.Misc["TypeIpRecurringDaily"] + } + if o.Type.Ip.Recurring.Daily.At != nil { + nestedType.Ip.Recurring.Daily.At = o.Type.Ip.Recurring.Daily.At + } + } + if o.Type.Ip.Recurring.FiveMinute != nil { + nestedType.Ip.Recurring.FiveMinute = &TypeIpRecurringFiveMinuteXml{} + if _, ok := o.Misc["TypeIpRecurringFiveMinute"]; ok { + nestedType.Ip.Recurring.FiveMinute.Misc = o.Misc["TypeIpRecurringFiveMinute"] + } + } + if o.Type.Ip.Recurring.Hourly != nil { + nestedType.Ip.Recurring.Hourly = &TypeIpRecurringHourlyXml{} + if _, ok := o.Misc["TypeIpRecurringHourly"]; ok { + nestedType.Ip.Recurring.Hourly.Misc = o.Misc["TypeIpRecurringHourly"] + } + } + if o.Type.Ip.Recurring.Monthly != nil { + nestedType.Ip.Recurring.Monthly = &TypeIpRecurringMonthlyXml{} + if _, ok := o.Misc["TypeIpRecurringMonthly"]; ok { + nestedType.Ip.Recurring.Monthly.Misc = o.Misc["TypeIpRecurringMonthly"] + } + if o.Type.Ip.Recurring.Monthly.At != nil { + nestedType.Ip.Recurring.Monthly.At = o.Type.Ip.Recurring.Monthly.At + } + if o.Type.Ip.Recurring.Monthly.DayOfMonth != nil { + nestedType.Ip.Recurring.Monthly.DayOfMonth = o.Type.Ip.Recurring.Monthly.DayOfMonth + } + } + } + if o.Type.Ip.Url != nil { + nestedType.Ip.Url = o.Type.Ip.Url + } + if o.Type.Ip.Auth != nil { + nestedType.Ip.Auth = &TypeIpAuthXml{} + if _, ok := o.Misc["TypeIpAuth"]; ok { + nestedType.Ip.Auth.Misc = o.Misc["TypeIpAuth"] + } + if o.Type.Ip.Auth.Password != nil { + nestedType.Ip.Auth.Password = o.Type.Ip.Auth.Password + } + if o.Type.Ip.Auth.Username != nil { + nestedType.Ip.Auth.Username = o.Type.Ip.Auth.Username + } + } + } + if o.Type.PredefinedIp != nil { + nestedType.PredefinedIp = &TypePredefinedIpXml{} + if _, ok := o.Misc["TypePredefinedIp"]; ok { + nestedType.PredefinedIp.Misc = o.Misc["TypePredefinedIp"] + } + if o.Type.PredefinedIp.Description != nil { + nestedType.PredefinedIp.Description = o.Type.PredefinedIp.Description + } + if o.Type.PredefinedIp.ExceptionList != nil { + nestedType.PredefinedIp.ExceptionList = util.StrToMem(o.Type.PredefinedIp.ExceptionList) + } + if o.Type.PredefinedIp.Url != nil { + nestedType.PredefinedIp.Url = o.Type.PredefinedIp.Url + } + } + if o.Type.PredefinedUrl != nil { + nestedType.PredefinedUrl = &TypePredefinedUrlXml{} + if _, ok := o.Misc["TypePredefinedUrl"]; ok { + nestedType.PredefinedUrl.Misc = o.Misc["TypePredefinedUrl"] + } + if o.Type.PredefinedUrl.Description != nil { + nestedType.PredefinedUrl.Description = o.Type.PredefinedUrl.Description + } + if o.Type.PredefinedUrl.ExceptionList != nil { + nestedType.PredefinedUrl.ExceptionList = util.StrToMem(o.Type.PredefinedUrl.ExceptionList) + } + if o.Type.PredefinedUrl.Url != nil { + nestedType.PredefinedUrl.Url = o.Type.PredefinedUrl.Url + } + } + if o.Type.Url != nil { + nestedType.Url = &TypeUrlXml{} + if _, ok := o.Misc["TypeUrl"]; ok { + nestedType.Url.Misc = o.Misc["TypeUrl"] + } + if o.Type.Url.Auth != nil { + nestedType.Url.Auth = &TypeUrlAuthXml{} + if _, ok := o.Misc["TypeUrlAuth"]; ok { + nestedType.Url.Auth.Misc = o.Misc["TypeUrlAuth"] + } + if o.Type.Url.Auth.Username != nil { + nestedType.Url.Auth.Username = o.Type.Url.Auth.Username + } + if o.Type.Url.Auth.Password != nil { + nestedType.Url.Auth.Password = o.Type.Url.Auth.Password + } + } + if o.Type.Url.CertificateProfile != nil { + nestedType.Url.CertificateProfile = o.Type.Url.CertificateProfile + } + if o.Type.Url.Description != nil { + nestedType.Url.Description = o.Type.Url.Description + } + if o.Type.Url.ExceptionList != nil { + nestedType.Url.ExceptionList = util.StrToMem(o.Type.Url.ExceptionList) + } + if o.Type.Url.Recurring != nil { + nestedType.Url.Recurring = &TypeUrlRecurringXml{} + if _, ok := o.Misc["TypeUrlRecurring"]; ok { + nestedType.Url.Recurring.Misc = o.Misc["TypeUrlRecurring"] + } + if o.Type.Url.Recurring.FiveMinute != nil { + nestedType.Url.Recurring.FiveMinute = &TypeUrlRecurringFiveMinuteXml{} + if _, ok := o.Misc["TypeUrlRecurringFiveMinute"]; ok { + nestedType.Url.Recurring.FiveMinute.Misc = o.Misc["TypeUrlRecurringFiveMinute"] + } + } + if o.Type.Url.Recurring.Hourly != nil { + nestedType.Url.Recurring.Hourly = &TypeUrlRecurringHourlyXml{} + if _, ok := o.Misc["TypeUrlRecurringHourly"]; ok { + nestedType.Url.Recurring.Hourly.Misc = o.Misc["TypeUrlRecurringHourly"] + } + } + if o.Type.Url.Recurring.Monthly != nil { + nestedType.Url.Recurring.Monthly = &TypeUrlRecurringMonthlyXml{} + if _, ok := o.Misc["TypeUrlRecurringMonthly"]; ok { + nestedType.Url.Recurring.Monthly.Misc = o.Misc["TypeUrlRecurringMonthly"] + } + if o.Type.Url.Recurring.Monthly.At != nil { + nestedType.Url.Recurring.Monthly.At = o.Type.Url.Recurring.Monthly.At + } + if o.Type.Url.Recurring.Monthly.DayOfMonth != nil { + nestedType.Url.Recurring.Monthly.DayOfMonth = o.Type.Url.Recurring.Monthly.DayOfMonth + } + } + if o.Type.Url.Recurring.Weekly != nil { + nestedType.Url.Recurring.Weekly = &TypeUrlRecurringWeeklyXml{} + if _, ok := o.Misc["TypeUrlRecurringWeekly"]; ok { + nestedType.Url.Recurring.Weekly.Misc = o.Misc["TypeUrlRecurringWeekly"] + } + if o.Type.Url.Recurring.Weekly.DayOfWeek != nil { + nestedType.Url.Recurring.Weekly.DayOfWeek = o.Type.Url.Recurring.Weekly.DayOfWeek + } + if o.Type.Url.Recurring.Weekly.At != nil { + nestedType.Url.Recurring.Weekly.At = o.Type.Url.Recurring.Weekly.At + } + } + if o.Type.Url.Recurring.Daily != nil { + nestedType.Url.Recurring.Daily = &TypeUrlRecurringDailyXml{} + if _, ok := o.Misc["TypeUrlRecurringDaily"]; ok { + nestedType.Url.Recurring.Daily.Misc = o.Misc["TypeUrlRecurringDaily"] + } + if o.Type.Url.Recurring.Daily.At != nil { + nestedType.Url.Recurring.Daily.At = o.Type.Url.Recurring.Daily.At + } + } + } + if o.Type.Url.Url != nil { + nestedType.Url.Url = o.Type.Url.Url + } + } + } + entry.Type = nestedType + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.DisableOverride = o.DisableOverride + var nestedType *Type + if o.Type != nil { + nestedType = &Type{} + if o.Type.Misc != nil { + entry.Misc["Type"] = o.Type.Misc + } + if o.Type.Domain != nil { + nestedType.Domain = &TypeDomain{} + if o.Type.Domain.Misc != nil { + entry.Misc["TypeDomain"] = o.Type.Domain.Misc + } + if o.Type.Domain.ExpandDomain != nil { + nestedType.Domain.ExpandDomain = util.AsBool(o.Type.Domain.ExpandDomain, nil) + } + if o.Type.Domain.Recurring != nil { + nestedType.Domain.Recurring = &TypeDomainRecurring{} + if o.Type.Domain.Recurring.Misc != nil { + entry.Misc["TypeDomainRecurring"] = o.Type.Domain.Recurring.Misc + } + if o.Type.Domain.Recurring.Daily != nil { + nestedType.Domain.Recurring.Daily = &TypeDomainRecurringDaily{} + if o.Type.Domain.Recurring.Daily.Misc != nil { + entry.Misc["TypeDomainRecurringDaily"] = o.Type.Domain.Recurring.Daily.Misc + } + if o.Type.Domain.Recurring.Daily.At != nil { + nestedType.Domain.Recurring.Daily.At = o.Type.Domain.Recurring.Daily.At + } + } + if o.Type.Domain.Recurring.FiveMinute != nil { + nestedType.Domain.Recurring.FiveMinute = &TypeDomainRecurringFiveMinute{} + if o.Type.Domain.Recurring.FiveMinute.Misc != nil { + entry.Misc["TypeDomainRecurringFiveMinute"] = o.Type.Domain.Recurring.FiveMinute.Misc + } + } + if o.Type.Domain.Recurring.Hourly != nil { + nestedType.Domain.Recurring.Hourly = &TypeDomainRecurringHourly{} + if o.Type.Domain.Recurring.Hourly.Misc != nil { + entry.Misc["TypeDomainRecurringHourly"] = o.Type.Domain.Recurring.Hourly.Misc + } + } + if o.Type.Domain.Recurring.Monthly != nil { + nestedType.Domain.Recurring.Monthly = &TypeDomainRecurringMonthly{} + if o.Type.Domain.Recurring.Monthly.Misc != nil { + entry.Misc["TypeDomainRecurringMonthly"] = o.Type.Domain.Recurring.Monthly.Misc + } + if o.Type.Domain.Recurring.Monthly.At != nil { + nestedType.Domain.Recurring.Monthly.At = o.Type.Domain.Recurring.Monthly.At + } + if o.Type.Domain.Recurring.Monthly.DayOfMonth != nil { + nestedType.Domain.Recurring.Monthly.DayOfMonth = o.Type.Domain.Recurring.Monthly.DayOfMonth + } + } + if o.Type.Domain.Recurring.Weekly != nil { + nestedType.Domain.Recurring.Weekly = &TypeDomainRecurringWeekly{} + if o.Type.Domain.Recurring.Weekly.Misc != nil { + entry.Misc["TypeDomainRecurringWeekly"] = o.Type.Domain.Recurring.Weekly.Misc + } + if o.Type.Domain.Recurring.Weekly.At != nil { + nestedType.Domain.Recurring.Weekly.At = o.Type.Domain.Recurring.Weekly.At + } + if o.Type.Domain.Recurring.Weekly.DayOfWeek != nil { + nestedType.Domain.Recurring.Weekly.DayOfWeek = o.Type.Domain.Recurring.Weekly.DayOfWeek + } + } + } + if o.Type.Domain.Url != nil { + nestedType.Domain.Url = o.Type.Domain.Url + } + if o.Type.Domain.Auth != nil { + nestedType.Domain.Auth = &TypeDomainAuth{} + if o.Type.Domain.Auth.Misc != nil { + entry.Misc["TypeDomainAuth"] = o.Type.Domain.Auth.Misc + } + if o.Type.Domain.Auth.Password != nil { + nestedType.Domain.Auth.Password = o.Type.Domain.Auth.Password + } + if o.Type.Domain.Auth.Username != nil { + nestedType.Domain.Auth.Username = o.Type.Domain.Auth.Username + } + } + if o.Type.Domain.CertificateProfile != nil { + nestedType.Domain.CertificateProfile = o.Type.Domain.CertificateProfile + } + if o.Type.Domain.Description != nil { + nestedType.Domain.Description = o.Type.Domain.Description + } + if o.Type.Domain.ExceptionList != nil { + nestedType.Domain.ExceptionList = util.MemToStr(o.Type.Domain.ExceptionList) + } + } + if o.Type.Imei != nil { + nestedType.Imei = &TypeImei{} + if o.Type.Imei.Misc != nil { + entry.Misc["TypeImei"] = o.Type.Imei.Misc + } + if o.Type.Imei.Description != nil { + nestedType.Imei.Description = o.Type.Imei.Description + } + if o.Type.Imei.ExceptionList != nil { + nestedType.Imei.ExceptionList = util.MemToStr(o.Type.Imei.ExceptionList) + } + if o.Type.Imei.Recurring != nil { + nestedType.Imei.Recurring = &TypeImeiRecurring{} + if o.Type.Imei.Recurring.Misc != nil { + entry.Misc["TypeImeiRecurring"] = o.Type.Imei.Recurring.Misc + } + if o.Type.Imei.Recurring.Daily != nil { + nestedType.Imei.Recurring.Daily = &TypeImeiRecurringDaily{} + if o.Type.Imei.Recurring.Daily.Misc != nil { + entry.Misc["TypeImeiRecurringDaily"] = o.Type.Imei.Recurring.Daily.Misc + } + if o.Type.Imei.Recurring.Daily.At != nil { + nestedType.Imei.Recurring.Daily.At = o.Type.Imei.Recurring.Daily.At + } + } + if o.Type.Imei.Recurring.FiveMinute != nil { + nestedType.Imei.Recurring.FiveMinute = &TypeImeiRecurringFiveMinute{} + if o.Type.Imei.Recurring.FiveMinute.Misc != nil { + entry.Misc["TypeImeiRecurringFiveMinute"] = o.Type.Imei.Recurring.FiveMinute.Misc + } + } + if o.Type.Imei.Recurring.Hourly != nil { + nestedType.Imei.Recurring.Hourly = &TypeImeiRecurringHourly{} + if o.Type.Imei.Recurring.Hourly.Misc != nil { + entry.Misc["TypeImeiRecurringHourly"] = o.Type.Imei.Recurring.Hourly.Misc + } + } + if o.Type.Imei.Recurring.Monthly != nil { + nestedType.Imei.Recurring.Monthly = &TypeImeiRecurringMonthly{} + if o.Type.Imei.Recurring.Monthly.Misc != nil { + entry.Misc["TypeImeiRecurringMonthly"] = o.Type.Imei.Recurring.Monthly.Misc + } + if o.Type.Imei.Recurring.Monthly.DayOfMonth != nil { + nestedType.Imei.Recurring.Monthly.DayOfMonth = o.Type.Imei.Recurring.Monthly.DayOfMonth + } + if o.Type.Imei.Recurring.Monthly.At != nil { + nestedType.Imei.Recurring.Monthly.At = o.Type.Imei.Recurring.Monthly.At + } + } + if o.Type.Imei.Recurring.Weekly != nil { + nestedType.Imei.Recurring.Weekly = &TypeImeiRecurringWeekly{} + if o.Type.Imei.Recurring.Weekly.Misc != nil { + entry.Misc["TypeImeiRecurringWeekly"] = o.Type.Imei.Recurring.Weekly.Misc + } + if o.Type.Imei.Recurring.Weekly.At != nil { + nestedType.Imei.Recurring.Weekly.At = o.Type.Imei.Recurring.Weekly.At + } + if o.Type.Imei.Recurring.Weekly.DayOfWeek != nil { + nestedType.Imei.Recurring.Weekly.DayOfWeek = o.Type.Imei.Recurring.Weekly.DayOfWeek + } + } + } + if o.Type.Imei.Url != nil { + nestedType.Imei.Url = o.Type.Imei.Url + } + if o.Type.Imei.Auth != nil { + nestedType.Imei.Auth = &TypeImeiAuth{} + if o.Type.Imei.Auth.Misc != nil { + entry.Misc["TypeImeiAuth"] = o.Type.Imei.Auth.Misc + } + if o.Type.Imei.Auth.Password != nil { + nestedType.Imei.Auth.Password = o.Type.Imei.Auth.Password + } + if o.Type.Imei.Auth.Username != nil { + nestedType.Imei.Auth.Username = o.Type.Imei.Auth.Username + } + } + if o.Type.Imei.CertificateProfile != nil { + nestedType.Imei.CertificateProfile = o.Type.Imei.CertificateProfile + } + } + if o.Type.Imsi != nil { + nestedType.Imsi = &TypeImsi{} + if o.Type.Imsi.Misc != nil { + entry.Misc["TypeImsi"] = o.Type.Imsi.Misc + } + if o.Type.Imsi.Recurring != nil { + nestedType.Imsi.Recurring = &TypeImsiRecurring{} + if o.Type.Imsi.Recurring.Misc != nil { + entry.Misc["TypeImsiRecurring"] = o.Type.Imsi.Recurring.Misc + } + if o.Type.Imsi.Recurring.Daily != nil { + nestedType.Imsi.Recurring.Daily = &TypeImsiRecurringDaily{} + if o.Type.Imsi.Recurring.Daily.Misc != nil { + entry.Misc["TypeImsiRecurringDaily"] = o.Type.Imsi.Recurring.Daily.Misc + } + if o.Type.Imsi.Recurring.Daily.At != nil { + nestedType.Imsi.Recurring.Daily.At = o.Type.Imsi.Recurring.Daily.At + } + } + if o.Type.Imsi.Recurring.FiveMinute != nil { + nestedType.Imsi.Recurring.FiveMinute = &TypeImsiRecurringFiveMinute{} + if o.Type.Imsi.Recurring.FiveMinute.Misc != nil { + entry.Misc["TypeImsiRecurringFiveMinute"] = o.Type.Imsi.Recurring.FiveMinute.Misc + } + } + if o.Type.Imsi.Recurring.Hourly != nil { + nestedType.Imsi.Recurring.Hourly = &TypeImsiRecurringHourly{} + if o.Type.Imsi.Recurring.Hourly.Misc != nil { + entry.Misc["TypeImsiRecurringHourly"] = o.Type.Imsi.Recurring.Hourly.Misc + } + } + if o.Type.Imsi.Recurring.Monthly != nil { + nestedType.Imsi.Recurring.Monthly = &TypeImsiRecurringMonthly{} + if o.Type.Imsi.Recurring.Monthly.Misc != nil { + entry.Misc["TypeImsiRecurringMonthly"] = o.Type.Imsi.Recurring.Monthly.Misc + } + if o.Type.Imsi.Recurring.Monthly.At != nil { + nestedType.Imsi.Recurring.Monthly.At = o.Type.Imsi.Recurring.Monthly.At + } + if o.Type.Imsi.Recurring.Monthly.DayOfMonth != nil { + nestedType.Imsi.Recurring.Monthly.DayOfMonth = o.Type.Imsi.Recurring.Monthly.DayOfMonth + } + } + if o.Type.Imsi.Recurring.Weekly != nil { + nestedType.Imsi.Recurring.Weekly = &TypeImsiRecurringWeekly{} + if o.Type.Imsi.Recurring.Weekly.Misc != nil { + entry.Misc["TypeImsiRecurringWeekly"] = o.Type.Imsi.Recurring.Weekly.Misc + } + if o.Type.Imsi.Recurring.Weekly.At != nil { + nestedType.Imsi.Recurring.Weekly.At = o.Type.Imsi.Recurring.Weekly.At + } + if o.Type.Imsi.Recurring.Weekly.DayOfWeek != nil { + nestedType.Imsi.Recurring.Weekly.DayOfWeek = o.Type.Imsi.Recurring.Weekly.DayOfWeek + } + } + } + if o.Type.Imsi.Url != nil { + nestedType.Imsi.Url = o.Type.Imsi.Url + } + if o.Type.Imsi.Auth != nil { + nestedType.Imsi.Auth = &TypeImsiAuth{} + if o.Type.Imsi.Auth.Misc != nil { + entry.Misc["TypeImsiAuth"] = o.Type.Imsi.Auth.Misc + } + if o.Type.Imsi.Auth.Password != nil { + nestedType.Imsi.Auth.Password = o.Type.Imsi.Auth.Password + } + if o.Type.Imsi.Auth.Username != nil { + nestedType.Imsi.Auth.Username = o.Type.Imsi.Auth.Username + } + } + if o.Type.Imsi.CertificateProfile != nil { + nestedType.Imsi.CertificateProfile = o.Type.Imsi.CertificateProfile + } + if o.Type.Imsi.Description != nil { + nestedType.Imsi.Description = o.Type.Imsi.Description + } + if o.Type.Imsi.ExceptionList != nil { + nestedType.Imsi.ExceptionList = util.MemToStr(o.Type.Imsi.ExceptionList) + } + } + if o.Type.Ip != nil { + nestedType.Ip = &TypeIp{} + if o.Type.Ip.Misc != nil { + entry.Misc["TypeIp"] = o.Type.Ip.Misc + } + if o.Type.Ip.Auth != nil { + nestedType.Ip.Auth = &TypeIpAuth{} + if o.Type.Ip.Auth.Misc != nil { + entry.Misc["TypeIpAuth"] = o.Type.Ip.Auth.Misc + } + if o.Type.Ip.Auth.Password != nil { + nestedType.Ip.Auth.Password = o.Type.Ip.Auth.Password + } + if o.Type.Ip.Auth.Username != nil { + nestedType.Ip.Auth.Username = o.Type.Ip.Auth.Username + } + } + if o.Type.Ip.CertificateProfile != nil { + nestedType.Ip.CertificateProfile = o.Type.Ip.CertificateProfile + } + if o.Type.Ip.Description != nil { + nestedType.Ip.Description = o.Type.Ip.Description + } + if o.Type.Ip.ExceptionList != nil { + nestedType.Ip.ExceptionList = util.MemToStr(o.Type.Ip.ExceptionList) + } + if o.Type.Ip.Recurring != nil { + nestedType.Ip.Recurring = &TypeIpRecurring{} + if o.Type.Ip.Recurring.Misc != nil { + entry.Misc["TypeIpRecurring"] = o.Type.Ip.Recurring.Misc + } + if o.Type.Ip.Recurring.Hourly != nil { + nestedType.Ip.Recurring.Hourly = &TypeIpRecurringHourly{} + if o.Type.Ip.Recurring.Hourly.Misc != nil { + entry.Misc["TypeIpRecurringHourly"] = o.Type.Ip.Recurring.Hourly.Misc + } + } + if o.Type.Ip.Recurring.Monthly != nil { + nestedType.Ip.Recurring.Monthly = &TypeIpRecurringMonthly{} + if o.Type.Ip.Recurring.Monthly.Misc != nil { + entry.Misc["TypeIpRecurringMonthly"] = o.Type.Ip.Recurring.Monthly.Misc + } + if o.Type.Ip.Recurring.Monthly.At != nil { + nestedType.Ip.Recurring.Monthly.At = o.Type.Ip.Recurring.Monthly.At + } + if o.Type.Ip.Recurring.Monthly.DayOfMonth != nil { + nestedType.Ip.Recurring.Monthly.DayOfMonth = o.Type.Ip.Recurring.Monthly.DayOfMonth + } + } + if o.Type.Ip.Recurring.Weekly != nil { + nestedType.Ip.Recurring.Weekly = &TypeIpRecurringWeekly{} + if o.Type.Ip.Recurring.Weekly.Misc != nil { + entry.Misc["TypeIpRecurringWeekly"] = o.Type.Ip.Recurring.Weekly.Misc + } + if o.Type.Ip.Recurring.Weekly.At != nil { + nestedType.Ip.Recurring.Weekly.At = o.Type.Ip.Recurring.Weekly.At + } + if o.Type.Ip.Recurring.Weekly.DayOfWeek != nil { + nestedType.Ip.Recurring.Weekly.DayOfWeek = o.Type.Ip.Recurring.Weekly.DayOfWeek + } + } + if o.Type.Ip.Recurring.Daily != nil { + nestedType.Ip.Recurring.Daily = &TypeIpRecurringDaily{} + if o.Type.Ip.Recurring.Daily.Misc != nil { + entry.Misc["TypeIpRecurringDaily"] = o.Type.Ip.Recurring.Daily.Misc + } + if o.Type.Ip.Recurring.Daily.At != nil { + nestedType.Ip.Recurring.Daily.At = o.Type.Ip.Recurring.Daily.At + } + } + if o.Type.Ip.Recurring.FiveMinute != nil { + nestedType.Ip.Recurring.FiveMinute = &TypeIpRecurringFiveMinute{} + if o.Type.Ip.Recurring.FiveMinute.Misc != nil { + entry.Misc["TypeIpRecurringFiveMinute"] = o.Type.Ip.Recurring.FiveMinute.Misc + } + } + } + if o.Type.Ip.Url != nil { + nestedType.Ip.Url = o.Type.Ip.Url + } + } + if o.Type.PredefinedIp != nil { + nestedType.PredefinedIp = &TypePredefinedIp{} + if o.Type.PredefinedIp.Misc != nil { + entry.Misc["TypePredefinedIp"] = o.Type.PredefinedIp.Misc + } + if o.Type.PredefinedIp.Url != nil { + nestedType.PredefinedIp.Url = o.Type.PredefinedIp.Url + } + if o.Type.PredefinedIp.Description != nil { + nestedType.PredefinedIp.Description = o.Type.PredefinedIp.Description + } + if o.Type.PredefinedIp.ExceptionList != nil { + nestedType.PredefinedIp.ExceptionList = util.MemToStr(o.Type.PredefinedIp.ExceptionList) + } + } + if o.Type.PredefinedUrl != nil { + nestedType.PredefinedUrl = &TypePredefinedUrl{} + if o.Type.PredefinedUrl.Misc != nil { + entry.Misc["TypePredefinedUrl"] = o.Type.PredefinedUrl.Misc + } + if o.Type.PredefinedUrl.ExceptionList != nil { + nestedType.PredefinedUrl.ExceptionList = util.MemToStr(o.Type.PredefinedUrl.ExceptionList) + } + if o.Type.PredefinedUrl.Url != nil { + nestedType.PredefinedUrl.Url = o.Type.PredefinedUrl.Url + } + if o.Type.PredefinedUrl.Description != nil { + nestedType.PredefinedUrl.Description = o.Type.PredefinedUrl.Description + } + } + if o.Type.Url != nil { + nestedType.Url = &TypeUrl{} + if o.Type.Url.Misc != nil { + entry.Misc["TypeUrl"] = o.Type.Url.Misc + } + if o.Type.Url.Recurring != nil { + nestedType.Url.Recurring = &TypeUrlRecurring{} + if o.Type.Url.Recurring.Misc != nil { + entry.Misc["TypeUrlRecurring"] = o.Type.Url.Recurring.Misc + } + if o.Type.Url.Recurring.Daily != nil { + nestedType.Url.Recurring.Daily = &TypeUrlRecurringDaily{} + if o.Type.Url.Recurring.Daily.Misc != nil { + entry.Misc["TypeUrlRecurringDaily"] = o.Type.Url.Recurring.Daily.Misc + } + if o.Type.Url.Recurring.Daily.At != nil { + nestedType.Url.Recurring.Daily.At = o.Type.Url.Recurring.Daily.At + } + } + if o.Type.Url.Recurring.FiveMinute != nil { + nestedType.Url.Recurring.FiveMinute = &TypeUrlRecurringFiveMinute{} + if o.Type.Url.Recurring.FiveMinute.Misc != nil { + entry.Misc["TypeUrlRecurringFiveMinute"] = o.Type.Url.Recurring.FiveMinute.Misc + } + } + if o.Type.Url.Recurring.Hourly != nil { + nestedType.Url.Recurring.Hourly = &TypeUrlRecurringHourly{} + if o.Type.Url.Recurring.Hourly.Misc != nil { + entry.Misc["TypeUrlRecurringHourly"] = o.Type.Url.Recurring.Hourly.Misc + } + } + if o.Type.Url.Recurring.Monthly != nil { + nestedType.Url.Recurring.Monthly = &TypeUrlRecurringMonthly{} + if o.Type.Url.Recurring.Monthly.Misc != nil { + entry.Misc["TypeUrlRecurringMonthly"] = o.Type.Url.Recurring.Monthly.Misc + } + if o.Type.Url.Recurring.Monthly.At != nil { + nestedType.Url.Recurring.Monthly.At = o.Type.Url.Recurring.Monthly.At + } + if o.Type.Url.Recurring.Monthly.DayOfMonth != nil { + nestedType.Url.Recurring.Monthly.DayOfMonth = o.Type.Url.Recurring.Monthly.DayOfMonth + } + } + if o.Type.Url.Recurring.Weekly != nil { + nestedType.Url.Recurring.Weekly = &TypeUrlRecurringWeekly{} + if o.Type.Url.Recurring.Weekly.Misc != nil { + entry.Misc["TypeUrlRecurringWeekly"] = o.Type.Url.Recurring.Weekly.Misc + } + if o.Type.Url.Recurring.Weekly.At != nil { + nestedType.Url.Recurring.Weekly.At = o.Type.Url.Recurring.Weekly.At + } + if o.Type.Url.Recurring.Weekly.DayOfWeek != nil { + nestedType.Url.Recurring.Weekly.DayOfWeek = o.Type.Url.Recurring.Weekly.DayOfWeek + } + } + } + if o.Type.Url.Url != nil { + nestedType.Url.Url = o.Type.Url.Url + } + if o.Type.Url.Auth != nil { + nestedType.Url.Auth = &TypeUrlAuth{} + if o.Type.Url.Auth.Misc != nil { + entry.Misc["TypeUrlAuth"] = o.Type.Url.Auth.Misc + } + if o.Type.Url.Auth.Password != nil { + nestedType.Url.Auth.Password = o.Type.Url.Auth.Password + } + if o.Type.Url.Auth.Username != nil { + nestedType.Url.Auth.Username = o.Type.Url.Auth.Username + } + } + if o.Type.Url.CertificateProfile != nil { + nestedType.Url.CertificateProfile = o.Type.Url.CertificateProfile + } + if o.Type.Url.Description != nil { + nestedType.Url.Description = o.Type.Url.Description + } + if o.Type.Url.ExceptionList != nil { + nestedType.Url.ExceptionList = util.MemToStr(o.Type.Url.ExceptionList) + } + } + } + entry.Type = nestedType + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { + return false + } + if !matchType(a.Type, b.Type) { + return false + } + + return true +} + +func matchTypePredefinedUrl(a *TypePredefinedUrl, b *TypePredefinedUrl) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.OrderedListsMatch(a.ExceptionList, b.ExceptionList) { + return false + } + if !util.StringsMatch(a.Url, b.Url) { + return false + } + return true +} +func matchTypeUrlAuth(a *TypeUrlAuth, b *TypeUrlAuth) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Password, b.Password) { + return false + } + if !util.StringsMatch(a.Username, b.Username) { + return false + } + return true +} +func matchTypeUrlRecurringDaily(a *TypeUrlRecurringDaily, b *TypeUrlRecurringDaily) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + return true +} +func matchTypeUrlRecurringFiveMinute(a *TypeUrlRecurringFiveMinute, b *TypeUrlRecurringFiveMinute) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchTypeUrlRecurringHourly(a *TypeUrlRecurringHourly, b *TypeUrlRecurringHourly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchTypeUrlRecurringMonthly(a *TypeUrlRecurringMonthly, b *TypeUrlRecurringMonthly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.Ints64Match(a.DayOfMonth, b.DayOfMonth) { + return false + } + return true +} +func matchTypeUrlRecurringWeekly(a *TypeUrlRecurringWeekly, b *TypeUrlRecurringWeekly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.StringsMatch(a.DayOfWeek, b.DayOfWeek) { + return false + } + return true +} +func matchTypeUrlRecurring(a *TypeUrlRecurring, b *TypeUrlRecurring) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchTypeUrlRecurringFiveMinute(a.FiveMinute, b.FiveMinute) { + return false + } + if !matchTypeUrlRecurringHourly(a.Hourly, b.Hourly) { + return false + } + if !matchTypeUrlRecurringMonthly(a.Monthly, b.Monthly) { + return false + } + if !matchTypeUrlRecurringWeekly(a.Weekly, b.Weekly) { + return false + } + if !matchTypeUrlRecurringDaily(a.Daily, b.Daily) { + return false + } + return true +} +func matchTypeUrl(a *TypeUrl, b *TypeUrl) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Url, b.Url) { + return false + } + if !matchTypeUrlAuth(a.Auth, b.Auth) { + return false + } + if !util.StringsMatch(a.CertificateProfile, b.CertificateProfile) { + return false + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.OrderedListsMatch(a.ExceptionList, b.ExceptionList) { + return false + } + if !matchTypeUrlRecurring(a.Recurring, b.Recurring) { + return false + } + return true +} +func matchTypeDomainRecurringMonthly(a *TypeDomainRecurringMonthly, b *TypeDomainRecurringMonthly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.Ints64Match(a.DayOfMonth, b.DayOfMonth) { + return false + } + return true +} +func matchTypeDomainRecurringWeekly(a *TypeDomainRecurringWeekly, b *TypeDomainRecurringWeekly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.DayOfWeek, b.DayOfWeek) { + return false + } + if !util.StringsMatch(a.At, b.At) { + return false + } + return true +} +func matchTypeDomainRecurringDaily(a *TypeDomainRecurringDaily, b *TypeDomainRecurringDaily) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + return true +} +func matchTypeDomainRecurringFiveMinute(a *TypeDomainRecurringFiveMinute, b *TypeDomainRecurringFiveMinute) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchTypeDomainRecurringHourly(a *TypeDomainRecurringHourly, b *TypeDomainRecurringHourly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchTypeDomainRecurring(a *TypeDomainRecurring, b *TypeDomainRecurring) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchTypeDomainRecurringMonthly(a.Monthly, b.Monthly) { + return false + } + if !matchTypeDomainRecurringWeekly(a.Weekly, b.Weekly) { + return false + } + if !matchTypeDomainRecurringDaily(a.Daily, b.Daily) { + return false + } + if !matchTypeDomainRecurringFiveMinute(a.FiveMinute, b.FiveMinute) { + return false + } + if !matchTypeDomainRecurringHourly(a.Hourly, b.Hourly) { + return false + } + return true +} +func matchTypeDomainAuth(a *TypeDomainAuth, b *TypeDomainAuth) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Password, b.Password) { + return false + } + if !util.StringsMatch(a.Username, b.Username) { + return false + } + return true +} +func matchTypeDomain(a *TypeDomain, b *TypeDomain) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.BoolsMatch(a.ExpandDomain, b.ExpandDomain) { + return false + } + if !matchTypeDomainRecurring(a.Recurring, b.Recurring) { + return false + } + if !util.StringsMatch(a.Url, b.Url) { + return false + } + if !matchTypeDomainAuth(a.Auth, b.Auth) { + return false + } + if !util.StringsMatch(a.CertificateProfile, b.CertificateProfile) { + return false + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.OrderedListsMatch(a.ExceptionList, b.ExceptionList) { + return false + } + return true +} +func matchTypeImeiAuth(a *TypeImeiAuth, b *TypeImeiAuth) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Username, b.Username) { + return false + } + if !util.StringsMatch(a.Password, b.Password) { + return false + } + return true +} +func matchTypeImeiRecurringDaily(a *TypeImeiRecurringDaily, b *TypeImeiRecurringDaily) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + return true +} +func matchTypeImeiRecurringFiveMinute(a *TypeImeiRecurringFiveMinute, b *TypeImeiRecurringFiveMinute) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchTypeImeiRecurringHourly(a *TypeImeiRecurringHourly, b *TypeImeiRecurringHourly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchTypeImeiRecurringMonthly(a *TypeImeiRecurringMonthly, b *TypeImeiRecurringMonthly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.Ints64Match(a.DayOfMonth, b.DayOfMonth) { + return false + } + return true +} +func matchTypeImeiRecurringWeekly(a *TypeImeiRecurringWeekly, b *TypeImeiRecurringWeekly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.StringsMatch(a.DayOfWeek, b.DayOfWeek) { + return false + } + return true +} +func matchTypeImeiRecurring(a *TypeImeiRecurring, b *TypeImeiRecurring) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchTypeImeiRecurringHourly(a.Hourly, b.Hourly) { + return false + } + if !matchTypeImeiRecurringMonthly(a.Monthly, b.Monthly) { + return false + } + if !matchTypeImeiRecurringWeekly(a.Weekly, b.Weekly) { + return false + } + if !matchTypeImeiRecurringDaily(a.Daily, b.Daily) { + return false + } + if !matchTypeImeiRecurringFiveMinute(a.FiveMinute, b.FiveMinute) { + return false + } + return true +} +func matchTypeImei(a *TypeImei, b *TypeImei) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchTypeImeiAuth(a.Auth, b.Auth) { + return false + } + if !util.StringsMatch(a.CertificateProfile, b.CertificateProfile) { + return false + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.OrderedListsMatch(a.ExceptionList, b.ExceptionList) { + return false + } + if !matchTypeImeiRecurring(a.Recurring, b.Recurring) { + return false + } + if !util.StringsMatch(a.Url, b.Url) { + return false + } + return true +} +func matchTypeImsiAuth(a *TypeImsiAuth, b *TypeImsiAuth) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Password, b.Password) { + return false + } + if !util.StringsMatch(a.Username, b.Username) { + return false + } + return true +} +func matchTypeImsiRecurringDaily(a *TypeImsiRecurringDaily, b *TypeImsiRecurringDaily) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + return true +} +func matchTypeImsiRecurringFiveMinute(a *TypeImsiRecurringFiveMinute, b *TypeImsiRecurringFiveMinute) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchTypeImsiRecurringHourly(a *TypeImsiRecurringHourly, b *TypeImsiRecurringHourly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchTypeImsiRecurringMonthly(a *TypeImsiRecurringMonthly, b *TypeImsiRecurringMonthly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.Ints64Match(a.DayOfMonth, b.DayOfMonth) { + return false + } + return true +} +func matchTypeImsiRecurringWeekly(a *TypeImsiRecurringWeekly, b *TypeImsiRecurringWeekly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.StringsMatch(a.DayOfWeek, b.DayOfWeek) { + return false + } + return true +} +func matchTypeImsiRecurring(a *TypeImsiRecurring, b *TypeImsiRecurring) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchTypeImsiRecurringDaily(a.Daily, b.Daily) { + return false + } + if !matchTypeImsiRecurringFiveMinute(a.FiveMinute, b.FiveMinute) { + return false + } + if !matchTypeImsiRecurringHourly(a.Hourly, b.Hourly) { + return false + } + if !matchTypeImsiRecurringMonthly(a.Monthly, b.Monthly) { + return false + } + if !matchTypeImsiRecurringWeekly(a.Weekly, b.Weekly) { + return false + } + return true +} +func matchTypeImsi(a *TypeImsi, b *TypeImsi) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchTypeImsiAuth(a.Auth, b.Auth) { + return false + } + if !util.StringsMatch(a.CertificateProfile, b.CertificateProfile) { + return false + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.OrderedListsMatch(a.ExceptionList, b.ExceptionList) { + return false + } + if !matchTypeImsiRecurring(a.Recurring, b.Recurring) { + return false + } + if !util.StringsMatch(a.Url, b.Url) { + return false + } + return true +} +func matchTypeIpAuth(a *TypeIpAuth, b *TypeIpAuth) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Username, b.Username) { + return false + } + if !util.StringsMatch(a.Password, b.Password) { + return false + } + return true +} +func matchTypeIpRecurringHourly(a *TypeIpRecurringHourly, b *TypeIpRecurringHourly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchTypeIpRecurringMonthly(a *TypeIpRecurringMonthly, b *TypeIpRecurringMonthly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.Ints64Match(a.DayOfMonth, b.DayOfMonth) { + return false + } + return true +} +func matchTypeIpRecurringWeekly(a *TypeIpRecurringWeekly, b *TypeIpRecurringWeekly) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + if !util.StringsMatch(a.DayOfWeek, b.DayOfWeek) { + return false + } + return true +} +func matchTypeIpRecurringDaily(a *TypeIpRecurringDaily, b *TypeIpRecurringDaily) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.At, b.At) { + return false + } + return true +} +func matchTypeIpRecurringFiveMinute(a *TypeIpRecurringFiveMinute, b *TypeIpRecurringFiveMinute) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchTypeIpRecurring(a *TypeIpRecurring, b *TypeIpRecurring) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchTypeIpRecurringWeekly(a.Weekly, b.Weekly) { + return false + } + if !matchTypeIpRecurringDaily(a.Daily, b.Daily) { + return false + } + if !matchTypeIpRecurringFiveMinute(a.FiveMinute, b.FiveMinute) { + return false + } + if !matchTypeIpRecurringHourly(a.Hourly, b.Hourly) { + return false + } + if !matchTypeIpRecurringMonthly(a.Monthly, b.Monthly) { + return false + } + return true +} +func matchTypeIp(a *TypeIp, b *TypeIp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchTypeIpAuth(a.Auth, b.Auth) { + return false + } + if !util.StringsMatch(a.CertificateProfile, b.CertificateProfile) { + return false + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.OrderedListsMatch(a.ExceptionList, b.ExceptionList) { + return false + } + if !matchTypeIpRecurring(a.Recurring, b.Recurring) { + return false + } + if !util.StringsMatch(a.Url, b.Url) { + return false + } + return true +} +func matchTypePredefinedIp(a *TypePredefinedIp, b *TypePredefinedIp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.OrderedListsMatch(a.ExceptionList, b.ExceptionList) { + return false + } + if !util.StringsMatch(a.Url, b.Url) { + return false + } + return true +} +func matchType(a *Type, b *Type) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchTypeDomain(a.Domain, b.Domain) { + return false + } + if !matchTypeImei(a.Imei, b.Imei) { + return false + } + if !matchTypeImsi(a.Imsi, b.Imsi) { + return false + } + if !matchTypeIp(a.Ip, b.Ip) { + return false + } + if !matchTypePredefinedIp(a.PredefinedIp, b.PredefinedIp) { + return false + } + if !matchTypePredefinedUrl(a.PredefinedUrl, b.PredefinedUrl) { + return false + } + if !matchTypeUrl(a.Url, b.Url) { + return false + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/objects/extdynlist/interfaces.go b/objects/extdynlist/interfaces.go new file mode 100644 index 00000000..1ca3be93 --- /dev/null +++ b/objects/extdynlist/interfaces.go @@ -0,0 +1,7 @@ +package extdynlist + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/objects/extdynlist/location.go b/objects/extdynlist/location.go new file mode 100644 index 00000000..093e7a80 --- /dev/null +++ b/objects/extdynlist/location.go @@ -0,0 +1,118 @@ +package extdynlist + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared bool `json:"shared"` +} + +type DeviceGroupLocation struct { + DeviceGroup string `json:"device_group"` + PanoramaDevice string `json:"panorama_device"` +} + +func NewDeviceGroupLocation() *Location { + return &Location{DeviceGroup: &DeviceGroupLocation{ + DeviceGroup: "", + PanoramaDevice: "localhost.localdomain", + }, + } +} +func NewSharedLocation() *Location { + return &Location{ + Shared: true, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + count++ + case o.Shared: + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return nil, fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.DeviceGroup.PanoramaDevice}), + "device-group", + util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), + } + case o.Shared: + ans = []string{ + "config", + "shared", + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/objects/extdynlist/service.go b/objects/extdynlist/service.go new file mode 100644 index 00000000..8b9397b3 --- /dev/null +++ b/objects/extdynlist/service.go @@ -0,0 +1,281 @@ +package extdynlist + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/objects/profiles/antivirus/entry.go b/objects/profiles/antivirus/entry.go new file mode 100644 index 00000000..004b30fc --- /dev/null +++ b/objects/profiles/antivirus/entry.go @@ -0,0 +1,547 @@ +package antivirus + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"virus"} +) + +type Entry struct { + Name string + Application []Application + Decoder []Decoder + Description *string + DisableOverride *string + MlavEngineFilebasedEnabled []MlavEngineFilebasedEnabled + MlavException []MlavException + PacketCapture *bool + ThreatException []ThreatException + WfrtHoldMode *bool + + Misc map[string][]generic.Xml +} + +type Application struct { + Action *string + Name string +} +type Decoder struct { + Action *string + MlavAction *string + Name string + WildfireAction *string +} +type MlavEngineFilebasedEnabled struct { + MlavPolicyAction *string + Name string +} +type MlavException struct { + Description *string + Filename *string + Name string +} +type ThreatException struct { + Name string +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Application []ApplicationXml `xml:"application>entry,omitempty"` + Decoder []DecoderXml `xml:"decoder>entry,omitempty"` + Description *string `xml:"description,omitempty"` + DisableOverride *string `xml:"disable-override,omitempty"` + MlavEngineFilebasedEnabled []MlavEngineFilebasedEnabledXml `xml:"mlav-engine-filebased-enabled>entry,omitempty"` + MlavException []MlavExceptionXml `xml:"mlav-exception>entry,omitempty"` + PacketCapture *string `xml:"packet-capture,omitempty"` + ThreatException []ThreatExceptionXml `xml:"threat-exception>entry,omitempty"` + WfrtHoldMode *string `xml:"wfrt-hold-mode,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ApplicationXml struct { + Action *string `xml:"action,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type DecoderXml struct { + Action *string `xml:"action,omitempty"` + MlavAction *string `xml:"mlav-action,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + WildfireAction *string `xml:"wildfire-action,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MlavEngineFilebasedEnabledXml struct { + MlavPolicyAction *string `xml:"mlav-policy-action,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type MlavExceptionXml struct { + Description *string `xml:"description,omitempty"` + Filename *string `xml:"filename,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "application" || v == "Application" { + return e.Application, nil + } + if v == "application|LENGTH" || v == "Application|LENGTH" { + return int64(len(e.Application)), nil + } + if v == "decoder" || v == "Decoder" { + return e.Decoder, nil + } + if v == "decoder|LENGTH" || v == "Decoder|LENGTH" { + return int64(len(e.Decoder)), nil + } + if v == "description" || v == "Description" { + return e.Description, nil + } + if v == "disable_override" || v == "DisableOverride" { + return e.DisableOverride, nil + } + if v == "mlav_engine_filebased_enabled" || v == "MlavEngineFilebasedEnabled" { + return e.MlavEngineFilebasedEnabled, nil + } + if v == "mlav_engine_filebased_enabled|LENGTH" || v == "MlavEngineFilebasedEnabled|LENGTH" { + return int64(len(e.MlavEngineFilebasedEnabled)), nil + } + if v == "mlav_exception" || v == "MlavException" { + return e.MlavException, nil + } + if v == "mlav_exception|LENGTH" || v == "MlavException|LENGTH" { + return int64(len(e.MlavException)), nil + } + if v == "packet_capture" || v == "PacketCapture" { + return e.PacketCapture, nil + } + if v == "threat_exception" || v == "ThreatException" { + return e.ThreatException, nil + } + if v == "threat_exception|LENGTH" || v == "ThreatException|LENGTH" { + return int64(len(e.ThreatException)), nil + } + if v == "wfrt_hold_mode" || v == "WfrtHoldMode" { + return e.WfrtHoldMode, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + var nestedApplicationCol []ApplicationXml + if o.Application != nil { + nestedApplicationCol = []ApplicationXml{} + for _, oApplication := range o.Application { + nestedApplication := ApplicationXml{} + if _, ok := o.Misc["Application"]; ok { + nestedApplication.Misc = o.Misc["Application"] + } + if oApplication.Action != nil { + nestedApplication.Action = oApplication.Action + } + if oApplication.Name != "" { + nestedApplication.Name = oApplication.Name + } + nestedApplicationCol = append(nestedApplicationCol, nestedApplication) + } + entry.Application = nestedApplicationCol + } + + var nestedDecoderCol []DecoderXml + if o.Decoder != nil { + nestedDecoderCol = []DecoderXml{} + for _, oDecoder := range o.Decoder { + nestedDecoder := DecoderXml{} + if _, ok := o.Misc["Decoder"]; ok { + nestedDecoder.Misc = o.Misc["Decoder"] + } + if oDecoder.Action != nil { + nestedDecoder.Action = oDecoder.Action + } + if oDecoder.WildfireAction != nil { + nestedDecoder.WildfireAction = oDecoder.WildfireAction + } + if oDecoder.MlavAction != nil { + nestedDecoder.MlavAction = oDecoder.MlavAction + } + if oDecoder.Name != "" { + nestedDecoder.Name = oDecoder.Name + } + nestedDecoderCol = append(nestedDecoderCol, nestedDecoder) + } + entry.Decoder = nestedDecoderCol + } + + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + var nestedMlavEngineFilebasedEnabledCol []MlavEngineFilebasedEnabledXml + if o.MlavEngineFilebasedEnabled != nil { + nestedMlavEngineFilebasedEnabledCol = []MlavEngineFilebasedEnabledXml{} + for _, oMlavEngineFilebasedEnabled := range o.MlavEngineFilebasedEnabled { + nestedMlavEngineFilebasedEnabled := MlavEngineFilebasedEnabledXml{} + if _, ok := o.Misc["MlavEngineFilebasedEnabled"]; ok { + nestedMlavEngineFilebasedEnabled.Misc = o.Misc["MlavEngineFilebasedEnabled"] + } + if oMlavEngineFilebasedEnabled.MlavPolicyAction != nil { + nestedMlavEngineFilebasedEnabled.MlavPolicyAction = oMlavEngineFilebasedEnabled.MlavPolicyAction + } + if oMlavEngineFilebasedEnabled.Name != "" { + nestedMlavEngineFilebasedEnabled.Name = oMlavEngineFilebasedEnabled.Name + } + nestedMlavEngineFilebasedEnabledCol = append(nestedMlavEngineFilebasedEnabledCol, nestedMlavEngineFilebasedEnabled) + } + entry.MlavEngineFilebasedEnabled = nestedMlavEngineFilebasedEnabledCol + } + + var nestedMlavExceptionCol []MlavExceptionXml + if o.MlavException != nil { + nestedMlavExceptionCol = []MlavExceptionXml{} + for _, oMlavException := range o.MlavException { + nestedMlavException := MlavExceptionXml{} + if _, ok := o.Misc["MlavException"]; ok { + nestedMlavException.Misc = o.Misc["MlavException"] + } + if oMlavException.Filename != nil { + nestedMlavException.Filename = oMlavException.Filename + } + if oMlavException.Description != nil { + nestedMlavException.Description = oMlavException.Description + } + if oMlavException.Name != "" { + nestedMlavException.Name = oMlavException.Name + } + nestedMlavExceptionCol = append(nestedMlavExceptionCol, nestedMlavException) + } + entry.MlavException = nestedMlavExceptionCol + } + + entry.PacketCapture = util.YesNo(o.PacketCapture, nil) + var nestedThreatExceptionCol []ThreatExceptionXml + if o.ThreatException != nil { + nestedThreatExceptionCol = []ThreatExceptionXml{} + for _, oThreatException := range o.ThreatException { + nestedThreatException := ThreatExceptionXml{} + if _, ok := o.Misc["ThreatException"]; ok { + nestedThreatException.Misc = o.Misc["ThreatException"] + } + if oThreatException.Name != "" { + nestedThreatException.Name = oThreatException.Name + } + nestedThreatExceptionCol = append(nestedThreatExceptionCol, nestedThreatException) + } + entry.ThreatException = nestedThreatExceptionCol + } + + entry.WfrtHoldMode = util.YesNo(o.WfrtHoldMode, nil) + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + var nestedApplicationCol []Application + if o.Application != nil { + nestedApplicationCol = []Application{} + for _, oApplication := range o.Application { + nestedApplication := Application{} + if oApplication.Misc != nil { + entry.Misc["Application"] = oApplication.Misc + } + if oApplication.Action != nil { + nestedApplication.Action = oApplication.Action + } + if oApplication.Name != "" { + nestedApplication.Name = oApplication.Name + } + nestedApplicationCol = append(nestedApplicationCol, nestedApplication) + } + entry.Application = nestedApplicationCol + } + + var nestedDecoderCol []Decoder + if o.Decoder != nil { + nestedDecoderCol = []Decoder{} + for _, oDecoder := range o.Decoder { + nestedDecoder := Decoder{} + if oDecoder.Misc != nil { + entry.Misc["Decoder"] = oDecoder.Misc + } + if oDecoder.Action != nil { + nestedDecoder.Action = oDecoder.Action + } + if oDecoder.WildfireAction != nil { + nestedDecoder.WildfireAction = oDecoder.WildfireAction + } + if oDecoder.MlavAction != nil { + nestedDecoder.MlavAction = oDecoder.MlavAction + } + if oDecoder.Name != "" { + nestedDecoder.Name = oDecoder.Name + } + nestedDecoderCol = append(nestedDecoderCol, nestedDecoder) + } + entry.Decoder = nestedDecoderCol + } + + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + var nestedMlavEngineFilebasedEnabledCol []MlavEngineFilebasedEnabled + if o.MlavEngineFilebasedEnabled != nil { + nestedMlavEngineFilebasedEnabledCol = []MlavEngineFilebasedEnabled{} + for _, oMlavEngineFilebasedEnabled := range o.MlavEngineFilebasedEnabled { + nestedMlavEngineFilebasedEnabled := MlavEngineFilebasedEnabled{} + if oMlavEngineFilebasedEnabled.Misc != nil { + entry.Misc["MlavEngineFilebasedEnabled"] = oMlavEngineFilebasedEnabled.Misc + } + if oMlavEngineFilebasedEnabled.MlavPolicyAction != nil { + nestedMlavEngineFilebasedEnabled.MlavPolicyAction = oMlavEngineFilebasedEnabled.MlavPolicyAction + } + if oMlavEngineFilebasedEnabled.Name != "" { + nestedMlavEngineFilebasedEnabled.Name = oMlavEngineFilebasedEnabled.Name + } + nestedMlavEngineFilebasedEnabledCol = append(nestedMlavEngineFilebasedEnabledCol, nestedMlavEngineFilebasedEnabled) + } + entry.MlavEngineFilebasedEnabled = nestedMlavEngineFilebasedEnabledCol + } + + var nestedMlavExceptionCol []MlavException + if o.MlavException != nil { + nestedMlavExceptionCol = []MlavException{} + for _, oMlavException := range o.MlavException { + nestedMlavException := MlavException{} + if oMlavException.Misc != nil { + entry.Misc["MlavException"] = oMlavException.Misc + } + if oMlavException.Filename != nil { + nestedMlavException.Filename = oMlavException.Filename + } + if oMlavException.Description != nil { + nestedMlavException.Description = oMlavException.Description + } + if oMlavException.Name != "" { + nestedMlavException.Name = oMlavException.Name + } + nestedMlavExceptionCol = append(nestedMlavExceptionCol, nestedMlavException) + } + entry.MlavException = nestedMlavExceptionCol + } + + entry.PacketCapture = util.AsBool(o.PacketCapture, nil) + var nestedThreatExceptionCol []ThreatException + if o.ThreatException != nil { + nestedThreatExceptionCol = []ThreatException{} + for _, oThreatException := range o.ThreatException { + nestedThreatException := ThreatException{} + if oThreatException.Misc != nil { + entry.Misc["ThreatException"] = oThreatException.Misc + } + if oThreatException.Name != "" { + nestedThreatException.Name = oThreatException.Name + } + nestedThreatExceptionCol = append(nestedThreatExceptionCol, nestedThreatException) + } + entry.ThreatException = nestedThreatExceptionCol + } + + entry.WfrtHoldMode = util.AsBool(o.WfrtHoldMode, nil) + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !matchApplication(a.Application, b.Application) { + return false + } + if !matchDecoder(a.Decoder, b.Decoder) { + return false + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { + return false + } + if !matchMlavEngineFilebasedEnabled(a.MlavEngineFilebasedEnabled, b.MlavEngineFilebasedEnabled) { + return false + } + if !matchMlavException(a.MlavException, b.MlavException) { + return false + } + if !util.BoolsMatch(a.PacketCapture, b.PacketCapture) { + return false + } + if !matchThreatException(a.ThreatException, b.ThreatException) { + return false + } + if !util.BoolsMatch(a.WfrtHoldMode, b.WfrtHoldMode) { + return false + } + + return true +} + +func matchApplication(a []Application, b []Application) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + } + } + return true +} +func matchMlavEngineFilebasedEnabled(a []MlavEngineFilebasedEnabled, b []MlavEngineFilebasedEnabled) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.MlavPolicyAction, b.MlavPolicyAction) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchDecoder(a []Decoder, b []Decoder) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.WildfireAction, b.WildfireAction) { + return false + } + if !util.StringsMatch(a.MlavAction, b.MlavAction) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + } + } + return true +} +func matchMlavException(a []MlavException, b []MlavException) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.Filename, b.Filename) { + return false + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchThreatException(a []ThreatException, b []ThreatException) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/objects/profiles/antivirus/interfaces.go b/objects/profiles/antivirus/interfaces.go new file mode 100644 index 00000000..3eb7540e --- /dev/null +++ b/objects/profiles/antivirus/interfaces.go @@ -0,0 +1,7 @@ +package antivirus + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/objects/profiles/antivirus/location.go b/objects/profiles/antivirus/location.go new file mode 100644 index 00000000..4544b1cd --- /dev/null +++ b/objects/profiles/antivirus/location.go @@ -0,0 +1,153 @@ +package antivirus + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared bool `json:"shared"` + Vsys *VsysLocation `json:"vsys,omitempty"` +} + +type DeviceGroupLocation struct { + DeviceGroup string `json:"device_group"` + PanoramaDevice string `json:"panorama_device"` +} + +type VsysLocation struct { + NgfwDevice string `json:"ngfw_device"` + Vsys string `json:"vsys"` +} + +func NewDeviceGroupLocation() *Location { + return &Location{DeviceGroup: &DeviceGroupLocation{ + DeviceGroup: "", + PanoramaDevice: "localhost.localdomain", + }, + } +} +func NewSharedLocation() *Location { + return &Location{ + Shared: true, + } +} +func NewVsysLocation() *Location { + return &Location{Vsys: &VsysLocation{ + NgfwDevice: "localhost.localdomain", + Vsys: "vsys1", + }, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + count++ + case o.Shared: + count++ + case o.Vsys != nil: + if o.Vsys.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.Vsys.Vsys == "" { + return fmt.Errorf("Vsys is unspecified") + } + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return nil, fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.DeviceGroup.PanoramaDevice}), + "device-group", + util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), + } + case o.Shared: + ans = []string{ + "config", + "shared", + } + case o.Vsys != nil: + if o.Vsys.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.Vsys.Vsys == "" { + return nil, fmt.Errorf("Vsys is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Vsys.NgfwDevice}), + "vsys", + util.AsEntryXpath([]string{o.Vsys.Vsys}), + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/objects/profiles/antivirus/service.go b/objects/profiles/antivirus/service.go new file mode 100644 index 00000000..583649f7 --- /dev/null +++ b/objects/profiles/antivirus/service.go @@ -0,0 +1,281 @@ +package antivirus + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/objects/profiles/customurlcategory/entry.go b/objects/profiles/customurlcategory/entry.go new file mode 100644 index 00000000..718b54cb --- /dev/null +++ b/objects/profiles/customurlcategory/entry.go @@ -0,0 +1,136 @@ +package customurlcategory + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"profiles", "custom-url-category"} +) + +type Entry struct { + Name string + Description *string + DisableOverride *string + List []string + Type *string + + Misc map[string][]generic.Xml +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Description *string `xml:"description,omitempty"` + DisableOverride *string `xml:"disable-override,omitempty"` + List *util.MemberType `xml:"list,omitempty"` + Type *string `xml:"type,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "description" || v == "Description" { + return e.Description, nil + } + if v == "disable_override" || v == "DisableOverride" { + return e.DisableOverride, nil + } + if v == "list" || v == "List" { + return e.List, nil + } + if v == "list|LENGTH" || v == "List|LENGTH" { + return int64(len(e.List)), nil + } + if v == "type" || v == "Type" { + return e.Type, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + entry.List = util.StrToMem(o.List) + entry.Type = o.Type + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + entry.List = util.MemToStr(o.List) + entry.Type = o.Type + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { + return false + } + if !util.OrderedListsMatch(a.List, b.List) { + return false + } + if !util.StringsMatch(a.Type, b.Type) { + return false + } + + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/objects/profiles/customurlcategory/interfaces.go b/objects/profiles/customurlcategory/interfaces.go new file mode 100644 index 00000000..35f73f07 --- /dev/null +++ b/objects/profiles/customurlcategory/interfaces.go @@ -0,0 +1,7 @@ +package customurlcategory + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/objects/profiles/customurlcategory/location.go b/objects/profiles/customurlcategory/location.go new file mode 100644 index 00000000..187f176c --- /dev/null +++ b/objects/profiles/customurlcategory/location.go @@ -0,0 +1,153 @@ +package customurlcategory + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared bool `json:"shared"` + Vsys *VsysLocation `json:"vsys,omitempty"` +} + +type DeviceGroupLocation struct { + DeviceGroup string `json:"device_group"` + PanoramaDevice string `json:"panorama_device"` +} + +type VsysLocation struct { + NgfwDevice string `json:"ngfw_device"` + Vsys string `json:"vsys"` +} + +func NewDeviceGroupLocation() *Location { + return &Location{DeviceGroup: &DeviceGroupLocation{ + DeviceGroup: "", + PanoramaDevice: "localhost.localdomain", + }, + } +} +func NewSharedLocation() *Location { + return &Location{ + Shared: true, + } +} +func NewVsysLocation() *Location { + return &Location{Vsys: &VsysLocation{ + NgfwDevice: "localhost.localdomain", + Vsys: "vsys1", + }, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + count++ + case o.Shared: + count++ + case o.Vsys != nil: + if o.Vsys.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.Vsys.Vsys == "" { + return fmt.Errorf("Vsys is unspecified") + } + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return nil, fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.DeviceGroup.PanoramaDevice}), + "device-group", + util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), + } + case o.Shared: + ans = []string{ + "config", + "shared", + } + case o.Vsys != nil: + if o.Vsys.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.Vsys.Vsys == "" { + return nil, fmt.Errorf("Vsys is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Vsys.NgfwDevice}), + "vsys", + util.AsEntryXpath([]string{o.Vsys.Vsys}), + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/objects/profiles/customurlcategory/service.go b/objects/profiles/customurlcategory/service.go new file mode 100644 index 00000000..57a0eb33 --- /dev/null +++ b/objects/profiles/customurlcategory/service.go @@ -0,0 +1,281 @@ +package customurlcategory + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/objects/profiles/fileblocking/entry.go b/objects/profiles/fileblocking/entry.go new file mode 100644 index 00000000..53985e69 --- /dev/null +++ b/objects/profiles/fileblocking/entry.go @@ -0,0 +1,224 @@ +package fileblocking + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"profiles", "file-blocking"} +) + +type Entry struct { + Name string + Description *string + DisableOverride *string + Rules []Rules + + Misc map[string][]generic.Xml +} + +type Rules struct { + Action *string + Application []string + Direction *string + FileType []string + Name string +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Description *string `xml:"description,omitempty"` + DisableOverride *string `xml:"disable-override,omitempty"` + Rules []RulesXml `xml:"rules>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RulesXml struct { + Action *string `xml:"action,omitempty"` + Application *util.MemberType `xml:"application,omitempty"` + Direction *string `xml:"direction,omitempty"` + FileType *util.MemberType `xml:"file-type,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "description" || v == "Description" { + return e.Description, nil + } + if v == "disable_override" || v == "DisableOverride" { + return e.DisableOverride, nil + } + if v == "rules" || v == "Rules" { + return e.Rules, nil + } + if v == "rules|LENGTH" || v == "Rules|LENGTH" { + return int64(len(e.Rules)), nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + var nestedRulesCol []RulesXml + if o.Rules != nil { + nestedRulesCol = []RulesXml{} + for _, oRules := range o.Rules { + nestedRules := RulesXml{} + if _, ok := o.Misc["Rules"]; ok { + nestedRules.Misc = o.Misc["Rules"] + } + if oRules.Application != nil { + nestedRules.Application = util.StrToMem(oRules.Application) + } + if oRules.FileType != nil { + nestedRules.FileType = util.StrToMem(oRules.FileType) + } + if oRules.Direction != nil { + nestedRules.Direction = oRules.Direction + } + if oRules.Action != nil { + nestedRules.Action = oRules.Action + } + if oRules.Name != "" { + nestedRules.Name = oRules.Name + } + nestedRulesCol = append(nestedRulesCol, nestedRules) + } + entry.Rules = nestedRulesCol + } + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + var nestedRulesCol []Rules + if o.Rules != nil { + nestedRulesCol = []Rules{} + for _, oRules := range o.Rules { + nestedRules := Rules{} + if oRules.Misc != nil { + entry.Misc["Rules"] = oRules.Misc + } + if oRules.Name != "" { + nestedRules.Name = oRules.Name + } + if oRules.Application != nil { + nestedRules.Application = util.MemToStr(oRules.Application) + } + if oRules.FileType != nil { + nestedRules.FileType = util.MemToStr(oRules.FileType) + } + if oRules.Direction != nil { + nestedRules.Direction = oRules.Direction + } + if oRules.Action != nil { + nestedRules.Action = oRules.Action + } + nestedRulesCol = append(nestedRulesCol, nestedRules) + } + entry.Rules = nestedRulesCol + } + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { + return false + } + if !matchRules(a.Rules, b.Rules) { + return false + } + + return true +} + +func matchRules(a []Rules, b []Rules) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.OrderedListsMatch(a.Application, b.Application) { + return false + } + if !util.OrderedListsMatch(a.FileType, b.FileType) { + return false + } + if !util.StringsMatch(a.Direction, b.Direction) { + return false + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/objects/profiles/fileblocking/interfaces.go b/objects/profiles/fileblocking/interfaces.go new file mode 100644 index 00000000..5f8d8411 --- /dev/null +++ b/objects/profiles/fileblocking/interfaces.go @@ -0,0 +1,7 @@ +package fileblocking + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/objects/profiles/fileblocking/location.go b/objects/profiles/fileblocking/location.go new file mode 100644 index 00000000..117104ce --- /dev/null +++ b/objects/profiles/fileblocking/location.go @@ -0,0 +1,118 @@ +package fileblocking + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared bool `json:"shared"` +} + +type DeviceGroupLocation struct { + DeviceGroup string `json:"device_group"` + PanoramaDevice string `json:"panorama_device"` +} + +func NewDeviceGroupLocation() *Location { + return &Location{DeviceGroup: &DeviceGroupLocation{ + DeviceGroup: "", + PanoramaDevice: "localhost.localdomain", + }, + } +} +func NewSharedLocation() *Location { + return &Location{ + Shared: true, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + count++ + case o.Shared: + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return nil, fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.DeviceGroup.PanoramaDevice}), + "device-group", + util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), + } + case o.Shared: + ans = []string{ + "config", + "shared", + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/objects/profiles/fileblocking/service.go b/objects/profiles/fileblocking/service.go new file mode 100644 index 00000000..ee194aca --- /dev/null +++ b/objects/profiles/fileblocking/service.go @@ -0,0 +1,281 @@ +package fileblocking + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/objects/profiles/ikecrypto/entry.go b/objects/profiles/ikecrypto/entry.go new file mode 100644 index 00000000..47415b25 --- /dev/null +++ b/objects/profiles/ikecrypto/entry.go @@ -0,0 +1,226 @@ +package ikecrypto + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"network", "ike", "crypto-profiles", "ike-crypto-profiles"} +) + +type Entry struct { + Name string + AuthenticationMultiple *int64 + DhGroup []string + Encryption []string + Hash []string + Lifetime *Lifetime + + Misc map[string][]generic.Xml +} + +type Lifetime struct { + Days *int64 + Hours *int64 + Minutes *int64 + Seconds *int64 +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + AuthenticationMultiple *int64 `xml:"authentication-multiple,omitempty"` + DhGroup *util.MemberType `xml:"dh-group,omitempty"` + Encryption *util.MemberType `xml:"encryption,omitempty"` + Hash *util.MemberType `xml:"hash,omitempty"` + Lifetime *LifetimeXml `xml:"lifetime,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type LifetimeXml struct { + Days *int64 `xml:"days,omitempty"` + Hours *int64 `xml:"hours,omitempty"` + Minutes *int64 `xml:"minutes,omitempty"` + Seconds *int64 `xml:"seconds,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "authentication_multiple" || v == "AuthenticationMultiple" { + return e.AuthenticationMultiple, nil + } + if v == "dh_group" || v == "DhGroup" { + return e.DhGroup, nil + } + if v == "dh_group|LENGTH" || v == "DhGroup|LENGTH" { + return int64(len(e.DhGroup)), nil + } + if v == "encryption" || v == "Encryption" { + return e.Encryption, nil + } + if v == "encryption|LENGTH" || v == "Encryption|LENGTH" { + return int64(len(e.Encryption)), nil + } + if v == "hash" || v == "Hash" { + return e.Hash, nil + } + if v == "hash|LENGTH" || v == "Hash|LENGTH" { + return int64(len(e.Hash)), nil + } + if v == "lifetime" || v == "Lifetime" { + return e.Lifetime, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.AuthenticationMultiple = o.AuthenticationMultiple + entry.DhGroup = util.StrToMem(o.DhGroup) + entry.Encryption = util.StrToMem(o.Encryption) + entry.Hash = util.StrToMem(o.Hash) + var nestedLifetime *LifetimeXml + if o.Lifetime != nil { + nestedLifetime = &LifetimeXml{} + if _, ok := o.Misc["Lifetime"]; ok { + nestedLifetime.Misc = o.Misc["Lifetime"] + } + if o.Lifetime.Days != nil { + nestedLifetime.Days = o.Lifetime.Days + } + if o.Lifetime.Hours != nil { + nestedLifetime.Hours = o.Lifetime.Hours + } + if o.Lifetime.Minutes != nil { + nestedLifetime.Minutes = o.Lifetime.Minutes + } + if o.Lifetime.Seconds != nil { + nestedLifetime.Seconds = o.Lifetime.Seconds + } + } + entry.Lifetime = nestedLifetime + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.AuthenticationMultiple = o.AuthenticationMultiple + entry.DhGroup = util.MemToStr(o.DhGroup) + entry.Encryption = util.MemToStr(o.Encryption) + entry.Hash = util.MemToStr(o.Hash) + var nestedLifetime *Lifetime + if o.Lifetime != nil { + nestedLifetime = &Lifetime{} + if o.Lifetime.Misc != nil { + entry.Misc["Lifetime"] = o.Lifetime.Misc + } + if o.Lifetime.Days != nil { + nestedLifetime.Days = o.Lifetime.Days + } + if o.Lifetime.Hours != nil { + nestedLifetime.Hours = o.Lifetime.Hours + } + if o.Lifetime.Minutes != nil { + nestedLifetime.Minutes = o.Lifetime.Minutes + } + if o.Lifetime.Seconds != nil { + nestedLifetime.Seconds = o.Lifetime.Seconds + } + } + entry.Lifetime = nestedLifetime + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.Ints64Match(a.AuthenticationMultiple, b.AuthenticationMultiple) { + return false + } + if !util.OrderedListsMatch(a.DhGroup, b.DhGroup) { + return false + } + if !util.OrderedListsMatch(a.Encryption, b.Encryption) { + return false + } + if !util.OrderedListsMatch(a.Hash, b.Hash) { + return false + } + if !matchLifetime(a.Lifetime, b.Lifetime) { + return false + } + + return true +} + +func matchLifetime(a *Lifetime, b *Lifetime) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Days, b.Days) { + return false + } + if !util.Ints64Match(a.Hours, b.Hours) { + return false + } + if !util.Ints64Match(a.Minutes, b.Minutes) { + return false + } + if !util.Ints64Match(a.Seconds, b.Seconds) { + return false + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/objects/profiles/ikecrypto/interfaces.go b/objects/profiles/ikecrypto/interfaces.go new file mode 100644 index 00000000..cf8bbdbf --- /dev/null +++ b/objects/profiles/ikecrypto/interfaces.go @@ -0,0 +1,7 @@ +package ikecrypto + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/objects/profiles/ikecrypto/location.go b/objects/profiles/ikecrypto/location.go new file mode 100644 index 00000000..64463979 --- /dev/null +++ b/objects/profiles/ikecrypto/location.go @@ -0,0 +1,187 @@ +package ikecrypto + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + Ngfw *NgfwLocation `json:"ngfw,omitempty"` + Template *TemplateLocation `json:"template,omitempty"` + TemplateStack *TemplateStackLocation `json:"template_stack,omitempty"` +} + +type NgfwLocation struct { + NgfwDevice string `json:"ngfw_device"` +} + +type TemplateLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + Template string `json:"template"` +} + +type TemplateStackLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + TemplateStack string `json:"template_stack"` +} + +func NewNgfwLocation() *Location { + return &Location{Ngfw: &NgfwLocation{ + NgfwDevice: "localhost.localdomain", + }, + } +} +func NewTemplateLocation() *Location { + return &Location{Template: &TemplateLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + Template: "", + }, + } +} +func NewTemplateStackLocation() *Location { + return &Location{TemplateStack: &TemplateStackLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + TemplateStack: "", + }, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.Ngfw != nil: + if o.Ngfw.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + count++ + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return fmt.Errorf("Template is unspecified") + } + count++ + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return fmt.Errorf("TemplateStack is unspecified") + } + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.Ngfw != nil: + if o.Ngfw.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Ngfw.NgfwDevice}), + } + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return nil, fmt.Errorf("Template is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Template.PanoramaDevice}), + "template", + util.AsEntryXpath([]string{o.Template.Template}), + "config", + "devices", + util.AsEntryXpath([]string{o.Template.NgfwDevice}), + } + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return nil, fmt.Errorf("TemplateStack is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.PanoramaDevice}), + "template-stack", + util.AsEntryXpath([]string{o.TemplateStack.TemplateStack}), + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.NgfwDevice}), + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/objects/profiles/ikecrypto/service.go b/objects/profiles/ikecrypto/service.go new file mode 100644 index 00000000..b6975a77 --- /dev/null +++ b/objects/profiles/ikecrypto/service.go @@ -0,0 +1,281 @@ +package ikecrypto + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/objects/profiles/ipseccrypto/entry.go b/objects/profiles/ipseccrypto/entry.go new file mode 100644 index 00000000..af786f7d --- /dev/null +++ b/objects/profiles/ipseccrypto/entry.go @@ -0,0 +1,384 @@ +package ipseccrypto + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"network", "ike", "crypto-profiles", "ipsec-crypto-profiles"} +) + +type Entry struct { + Name string + DhGroup *string + Lifesize *Lifesize + Lifetime *Lifetime + Ah *Ah + Esp *Esp + + Misc map[string][]generic.Xml +} + +type Ah struct { + Authentication []string +} +type Esp struct { + Authentication []string + Encryption []string +} +type Lifesize struct { + Gb *int64 + Kb *int64 + Mb *int64 + Tb *int64 +} +type Lifetime struct { + Days *int64 + Hours *int64 + Minutes *int64 + Seconds *int64 +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + DhGroup *string `xml:"dh-group,omitempty"` + Lifesize *LifesizeXml `xml:"lifesize,omitempty"` + Lifetime *LifetimeXml `xml:"lifetime,omitempty"` + Ah *AhXml `xml:"ah,omitempty"` + Esp *EspXml `xml:"esp,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type AhXml struct { + Authentication *util.MemberType `xml:"authentication,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type EspXml struct { + Authentication *util.MemberType `xml:"authentication,omitempty"` + Encryption *util.MemberType `xml:"encryption,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type LifesizeXml struct { + Gb *int64 `xml:"gb,omitempty"` + Kb *int64 `xml:"kb,omitempty"` + Mb *int64 `xml:"mb,omitempty"` + Tb *int64 `xml:"tb,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type LifetimeXml struct { + Days *int64 `xml:"days,omitempty"` + Hours *int64 `xml:"hours,omitempty"` + Minutes *int64 `xml:"minutes,omitempty"` + Seconds *int64 `xml:"seconds,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "dh_group" || v == "DhGroup" { + return e.DhGroup, nil + } + if v == "lifesize" || v == "Lifesize" { + return e.Lifesize, nil + } + if v == "lifetime" || v == "Lifetime" { + return e.Lifetime, nil + } + if v == "ah" || v == "Ah" { + return e.Ah, nil + } + if v == "esp" || v == "Esp" { + return e.Esp, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.DhGroup = o.DhGroup + var nestedLifesize *LifesizeXml + if o.Lifesize != nil { + nestedLifesize = &LifesizeXml{} + if _, ok := o.Misc["Lifesize"]; ok { + nestedLifesize.Misc = o.Misc["Lifesize"] + } + if o.Lifesize.Mb != nil { + nestedLifesize.Mb = o.Lifesize.Mb + } + if o.Lifesize.Tb != nil { + nestedLifesize.Tb = o.Lifesize.Tb + } + if o.Lifesize.Gb != nil { + nestedLifesize.Gb = o.Lifesize.Gb + } + if o.Lifesize.Kb != nil { + nestedLifesize.Kb = o.Lifesize.Kb + } + } + entry.Lifesize = nestedLifesize + + var nestedLifetime *LifetimeXml + if o.Lifetime != nil { + nestedLifetime = &LifetimeXml{} + if _, ok := o.Misc["Lifetime"]; ok { + nestedLifetime.Misc = o.Misc["Lifetime"] + } + if o.Lifetime.Days != nil { + nestedLifetime.Days = o.Lifetime.Days + } + if o.Lifetime.Hours != nil { + nestedLifetime.Hours = o.Lifetime.Hours + } + if o.Lifetime.Minutes != nil { + nestedLifetime.Minutes = o.Lifetime.Minutes + } + if o.Lifetime.Seconds != nil { + nestedLifetime.Seconds = o.Lifetime.Seconds + } + } + entry.Lifetime = nestedLifetime + + var nestedAh *AhXml + if o.Ah != nil { + nestedAh = &AhXml{} + if _, ok := o.Misc["Ah"]; ok { + nestedAh.Misc = o.Misc["Ah"] + } + if o.Ah.Authentication != nil { + nestedAh.Authentication = util.StrToMem(o.Ah.Authentication) + } + } + entry.Ah = nestedAh + + var nestedEsp *EspXml + if o.Esp != nil { + nestedEsp = &EspXml{} + if _, ok := o.Misc["Esp"]; ok { + nestedEsp.Misc = o.Misc["Esp"] + } + if o.Esp.Authentication != nil { + nestedEsp.Authentication = util.StrToMem(o.Esp.Authentication) + } + if o.Esp.Encryption != nil { + nestedEsp.Encryption = util.StrToMem(o.Esp.Encryption) + } + } + entry.Esp = nestedEsp + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.DhGroup = o.DhGroup + var nestedLifesize *Lifesize + if o.Lifesize != nil { + nestedLifesize = &Lifesize{} + if o.Lifesize.Misc != nil { + entry.Misc["Lifesize"] = o.Lifesize.Misc + } + if o.Lifesize.Gb != nil { + nestedLifesize.Gb = o.Lifesize.Gb + } + if o.Lifesize.Kb != nil { + nestedLifesize.Kb = o.Lifesize.Kb + } + if o.Lifesize.Mb != nil { + nestedLifesize.Mb = o.Lifesize.Mb + } + if o.Lifesize.Tb != nil { + nestedLifesize.Tb = o.Lifesize.Tb + } + } + entry.Lifesize = nestedLifesize + + var nestedLifetime *Lifetime + if o.Lifetime != nil { + nestedLifetime = &Lifetime{} + if o.Lifetime.Misc != nil { + entry.Misc["Lifetime"] = o.Lifetime.Misc + } + if o.Lifetime.Days != nil { + nestedLifetime.Days = o.Lifetime.Days + } + if o.Lifetime.Hours != nil { + nestedLifetime.Hours = o.Lifetime.Hours + } + if o.Lifetime.Minutes != nil { + nestedLifetime.Minutes = o.Lifetime.Minutes + } + if o.Lifetime.Seconds != nil { + nestedLifetime.Seconds = o.Lifetime.Seconds + } + } + entry.Lifetime = nestedLifetime + + var nestedAh *Ah + if o.Ah != nil { + nestedAh = &Ah{} + if o.Ah.Misc != nil { + entry.Misc["Ah"] = o.Ah.Misc + } + if o.Ah.Authentication != nil { + nestedAh.Authentication = util.MemToStr(o.Ah.Authentication) + } + } + entry.Ah = nestedAh + + var nestedEsp *Esp + if o.Esp != nil { + nestedEsp = &Esp{} + if o.Esp.Misc != nil { + entry.Misc["Esp"] = o.Esp.Misc + } + if o.Esp.Authentication != nil { + nestedEsp.Authentication = util.MemToStr(o.Esp.Authentication) + } + if o.Esp.Encryption != nil { + nestedEsp.Encryption = util.MemToStr(o.Esp.Encryption) + } + } + entry.Esp = nestedEsp + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.StringsMatch(a.DhGroup, b.DhGroup) { + return false + } + if !matchLifesize(a.Lifesize, b.Lifesize) { + return false + } + if !matchLifetime(a.Lifetime, b.Lifetime) { + return false + } + if !matchAh(a.Ah, b.Ah) { + return false + } + if !matchEsp(a.Esp, b.Esp) { + return false + } + + return true +} + +func matchLifesize(a *Lifesize, b *Lifesize) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Mb, b.Mb) { + return false + } + if !util.Ints64Match(a.Tb, b.Tb) { + return false + } + if !util.Ints64Match(a.Gb, b.Gb) { + return false + } + if !util.Ints64Match(a.Kb, b.Kb) { + return false + } + return true +} +func matchLifetime(a *Lifetime, b *Lifetime) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Days, b.Days) { + return false + } + if !util.Ints64Match(a.Hours, b.Hours) { + return false + } + if !util.Ints64Match(a.Minutes, b.Minutes) { + return false + } + if !util.Ints64Match(a.Seconds, b.Seconds) { + return false + } + return true +} +func matchAh(a *Ah, b *Ah) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.OrderedListsMatch(a.Authentication, b.Authentication) { + return false + } + return true +} +func matchEsp(a *Esp, b *Esp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.OrderedListsMatch(a.Authentication, b.Authentication) { + return false + } + if !util.OrderedListsMatch(a.Encryption, b.Encryption) { + return false + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/objects/profiles/ipseccrypto/interfaces.go b/objects/profiles/ipseccrypto/interfaces.go new file mode 100644 index 00000000..dd19217b --- /dev/null +++ b/objects/profiles/ipseccrypto/interfaces.go @@ -0,0 +1,7 @@ +package ipseccrypto + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/objects/profiles/ipseccrypto/location.go b/objects/profiles/ipseccrypto/location.go new file mode 100644 index 00000000..1c1818ed --- /dev/null +++ b/objects/profiles/ipseccrypto/location.go @@ -0,0 +1,187 @@ +package ipseccrypto + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + Ngfw *NgfwLocation `json:"ngfw,omitempty"` + Template *TemplateLocation `json:"template,omitempty"` + TemplateStack *TemplateStackLocation `json:"template_stack,omitempty"` +} + +type NgfwLocation struct { + NgfwDevice string `json:"ngfw_device"` +} + +type TemplateLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + Template string `json:"template"` +} + +type TemplateStackLocation struct { + NgfwDevice string `json:"ngfw_device"` + PanoramaDevice string `json:"panorama_device"` + TemplateStack string `json:"template_stack"` +} + +func NewNgfwLocation() *Location { + return &Location{Ngfw: &NgfwLocation{ + NgfwDevice: "localhost.localdomain", + }, + } +} +func NewTemplateLocation() *Location { + return &Location{Template: &TemplateLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + Template: "", + }, + } +} +func NewTemplateStackLocation() *Location { + return &Location{TemplateStack: &TemplateStackLocation{ + NgfwDevice: "localhost.localdomain", + PanoramaDevice: "localhost.localdomain", + TemplateStack: "", + }, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.Ngfw != nil: + if o.Ngfw.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + count++ + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return fmt.Errorf("Template is unspecified") + } + count++ + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return fmt.Errorf("TemplateStack is unspecified") + } + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.Ngfw != nil: + if o.Ngfw.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Ngfw.NgfwDevice}), + } + case o.Template != nil: + if o.Template.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.Template.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.Template.Template == "" { + return nil, fmt.Errorf("Template is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Template.PanoramaDevice}), + "template", + util.AsEntryXpath([]string{o.Template.Template}), + "config", + "devices", + util.AsEntryXpath([]string{o.Template.NgfwDevice}), + } + case o.TemplateStack != nil: + if o.TemplateStack.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.TemplateStack.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.TemplateStack.TemplateStack == "" { + return nil, fmt.Errorf("TemplateStack is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.PanoramaDevice}), + "template-stack", + util.AsEntryXpath([]string{o.TemplateStack.TemplateStack}), + "config", + "devices", + util.AsEntryXpath([]string{o.TemplateStack.NgfwDevice}), + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/objects/profiles/ipseccrypto/service.go b/objects/profiles/ipseccrypto/service.go new file mode 100644 index 00000000..ef0b255a --- /dev/null +++ b/objects/profiles/ipseccrypto/service.go @@ -0,0 +1,281 @@ +package ipseccrypto + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/objects/profiles/logforwarding/entry.go b/objects/profiles/logforwarding/entry.go new file mode 100644 index 00000000..deaf6bcd --- /dev/null +++ b/objects/profiles/logforwarding/entry.go @@ -0,0 +1,625 @@ +package logforwarding + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"log-settings", "profiles"} +) + +type Entry struct { + Name string + Description *string + DisableOverride *string + EnhancedApplicationLogging *bool + MatchList []MatchList + + Misc map[string][]generic.Xml +} + +type MatchList struct { + ActionDesc *string + Actions []MatchListActions + Filter *string + LogType *string + Name string + Quarantine *bool + SendEmail []string + SendHttp []string + SendSnmptrap []string + SendSyslog []string + SendToPanorama *bool +} +type MatchListActions struct { + Name string + Type *MatchListActionsType +} +type MatchListActionsType struct { + Integration *MatchListActionsTypeIntegration + Tagging *MatchListActionsTypeTagging +} +type MatchListActionsTypeIntegration struct { + Action *string +} +type MatchListActionsTypeTagging struct { + Action *string + Registration *MatchListActionsTypeTaggingRegistration + Tags []string + Target *string + Timeout *int64 +} +type MatchListActionsTypeTaggingRegistration struct { + Localhost *MatchListActionsTypeTaggingRegistrationLocalhost + Panorama *MatchListActionsTypeTaggingRegistrationPanorama + Remote *MatchListActionsTypeTaggingRegistrationRemote +} +type MatchListActionsTypeTaggingRegistrationLocalhost struct { +} +type MatchListActionsTypeTaggingRegistrationPanorama struct { +} +type MatchListActionsTypeTaggingRegistrationRemote struct { + HttpProfile *string +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Description *string `xml:"description,omitempty"` + DisableOverride *string `xml:"disable-override,omitempty"` + EnhancedApplicationLogging *string `xml:"enhanced-application-logging,omitempty"` + MatchList []MatchListXml `xml:"match-list>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MatchListXml struct { + ActionDesc *string `xml:"action-desc,omitempty"` + Actions []MatchListActionsXml `xml:"actions>entry,omitempty"` + Filter *string `xml:"filter,omitempty"` + LogType *string `xml:"log-type,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Quarantine *string `xml:"quarantine,omitempty"` + SendEmail *util.MemberType `xml:"send-email,omitempty"` + SendHttp *util.MemberType `xml:"send-http,omitempty"` + SendSnmptrap *util.MemberType `xml:"send-snmptrap,omitempty"` + SendSyslog *util.MemberType `xml:"send-syslog,omitempty"` + SendToPanorama *string `xml:"send-to-panorama,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MatchListActionsXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Type *MatchListActionsTypeXml `xml:"type,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MatchListActionsTypeXml struct { + Integration *MatchListActionsTypeIntegrationXml `xml:"integration,omitempty"` + Tagging *MatchListActionsTypeTaggingXml `xml:"tagging,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MatchListActionsTypeIntegrationXml struct { + Action *string `xml:"action,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MatchListActionsTypeTaggingXml struct { + Action *string `xml:"action,omitempty"` + Registration *MatchListActionsTypeTaggingRegistrationXml `xml:"registration,omitempty"` + Tags *util.MemberType `xml:"tags,omitempty"` + Target *string `xml:"target,omitempty"` + Timeout *int64 `xml:"timeout,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MatchListActionsTypeTaggingRegistrationXml struct { + Localhost *MatchListActionsTypeTaggingRegistrationLocalhostXml `xml:"localhost,omitempty"` + Panorama *MatchListActionsTypeTaggingRegistrationPanoramaXml `xml:"panorama,omitempty"` + Remote *MatchListActionsTypeTaggingRegistrationRemoteXml `xml:"remote,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MatchListActionsTypeTaggingRegistrationLocalhostXml struct { + Misc []generic.Xml `xml:",any"` +} +type MatchListActionsTypeTaggingRegistrationPanoramaXml struct { + Misc []generic.Xml `xml:",any"` +} +type MatchListActionsTypeTaggingRegistrationRemoteXml struct { + HttpProfile *string `xml:"http-profile,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "description" || v == "Description" { + return e.Description, nil + } + if v == "disable_override" || v == "DisableOverride" { + return e.DisableOverride, nil + } + if v == "enhanced_application_logging" || v == "EnhancedApplicationLogging" { + return e.EnhancedApplicationLogging, nil + } + if v == "match_list" || v == "MatchList" { + return e.MatchList, nil + } + if v == "match_list|LENGTH" || v == "MatchList|LENGTH" { + return int64(len(e.MatchList)), nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + entry.EnhancedApplicationLogging = util.YesNo(o.EnhancedApplicationLogging, nil) + var nestedMatchListCol []MatchListXml + if o.MatchList != nil { + nestedMatchListCol = []MatchListXml{} + for _, oMatchList := range o.MatchList { + nestedMatchList := MatchListXml{} + if _, ok := o.Misc["MatchList"]; ok { + nestedMatchList.Misc = o.Misc["MatchList"] + } + if oMatchList.Actions != nil { + nestedMatchList.Actions = []MatchListActionsXml{} + for _, oMatchListActions := range oMatchList.Actions { + nestedMatchListActions := MatchListActionsXml{} + if _, ok := o.Misc["MatchListActions"]; ok { + nestedMatchListActions.Misc = o.Misc["MatchListActions"] + } + if oMatchListActions.Type != nil { + nestedMatchListActions.Type = &MatchListActionsTypeXml{} + if _, ok := o.Misc["MatchListActionsType"]; ok { + nestedMatchListActions.Type.Misc = o.Misc["MatchListActionsType"] + } + if oMatchListActions.Type.Integration != nil { + nestedMatchListActions.Type.Integration = &MatchListActionsTypeIntegrationXml{} + if _, ok := o.Misc["MatchListActionsTypeIntegration"]; ok { + nestedMatchListActions.Type.Integration.Misc = o.Misc["MatchListActionsTypeIntegration"] + } + if oMatchListActions.Type.Integration.Action != nil { + nestedMatchListActions.Type.Integration.Action = oMatchListActions.Type.Integration.Action + } + } + if oMatchListActions.Type.Tagging != nil { + nestedMatchListActions.Type.Tagging = &MatchListActionsTypeTaggingXml{} + if _, ok := o.Misc["MatchListActionsTypeTagging"]; ok { + nestedMatchListActions.Type.Tagging.Misc = o.Misc["MatchListActionsTypeTagging"] + } + if oMatchListActions.Type.Tagging.Target != nil { + nestedMatchListActions.Type.Tagging.Target = oMatchListActions.Type.Tagging.Target + } + if oMatchListActions.Type.Tagging.Action != nil { + nestedMatchListActions.Type.Tagging.Action = oMatchListActions.Type.Tagging.Action + } + if oMatchListActions.Type.Tagging.Timeout != nil { + nestedMatchListActions.Type.Tagging.Timeout = oMatchListActions.Type.Tagging.Timeout + } + if oMatchListActions.Type.Tagging.Registration != nil { + nestedMatchListActions.Type.Tagging.Registration = &MatchListActionsTypeTaggingRegistrationXml{} + if _, ok := o.Misc["MatchListActionsTypeTaggingRegistration"]; ok { + nestedMatchListActions.Type.Tagging.Registration.Misc = o.Misc["MatchListActionsTypeTaggingRegistration"] + } + if oMatchListActions.Type.Tagging.Registration.Panorama != nil { + nestedMatchListActions.Type.Tagging.Registration.Panorama = &MatchListActionsTypeTaggingRegistrationPanoramaXml{} + if _, ok := o.Misc["MatchListActionsTypeTaggingRegistrationPanorama"]; ok { + nestedMatchListActions.Type.Tagging.Registration.Panorama.Misc = o.Misc["MatchListActionsTypeTaggingRegistrationPanorama"] + } + } + if oMatchListActions.Type.Tagging.Registration.Remote != nil { + nestedMatchListActions.Type.Tagging.Registration.Remote = &MatchListActionsTypeTaggingRegistrationRemoteXml{} + if _, ok := o.Misc["MatchListActionsTypeTaggingRegistrationRemote"]; ok { + nestedMatchListActions.Type.Tagging.Registration.Remote.Misc = o.Misc["MatchListActionsTypeTaggingRegistrationRemote"] + } + if oMatchListActions.Type.Tagging.Registration.Remote.HttpProfile != nil { + nestedMatchListActions.Type.Tagging.Registration.Remote.HttpProfile = oMatchListActions.Type.Tagging.Registration.Remote.HttpProfile + } + } + if oMatchListActions.Type.Tagging.Registration.Localhost != nil { + nestedMatchListActions.Type.Tagging.Registration.Localhost = &MatchListActionsTypeTaggingRegistrationLocalhostXml{} + if _, ok := o.Misc["MatchListActionsTypeTaggingRegistrationLocalhost"]; ok { + nestedMatchListActions.Type.Tagging.Registration.Localhost.Misc = o.Misc["MatchListActionsTypeTaggingRegistrationLocalhost"] + } + } + } + if oMatchListActions.Type.Tagging.Tags != nil { + nestedMatchListActions.Type.Tagging.Tags = util.StrToMem(oMatchListActions.Type.Tagging.Tags) + } + } + } + if oMatchListActions.Name != "" { + nestedMatchListActions.Name = oMatchListActions.Name + } + nestedMatchList.Actions = append(nestedMatchList.Actions, nestedMatchListActions) + } + } + if oMatchList.Name != "" { + nestedMatchList.Name = oMatchList.Name + } + if oMatchList.LogType != nil { + nestedMatchList.LogType = oMatchList.LogType + } + if oMatchList.SendToPanorama != nil { + nestedMatchList.SendToPanorama = util.YesNo(oMatchList.SendToPanorama, nil) + } + if oMatchList.Quarantine != nil { + nestedMatchList.Quarantine = util.YesNo(oMatchList.Quarantine, nil) + } + if oMatchList.SendSnmptrap != nil { + nestedMatchList.SendSnmptrap = util.StrToMem(oMatchList.SendSnmptrap) + } + if oMatchList.SendEmail != nil { + nestedMatchList.SendEmail = util.StrToMem(oMatchList.SendEmail) + } + if oMatchList.SendSyslog != nil { + nestedMatchList.SendSyslog = util.StrToMem(oMatchList.SendSyslog) + } + if oMatchList.ActionDesc != nil { + nestedMatchList.ActionDesc = oMatchList.ActionDesc + } + if oMatchList.Filter != nil { + nestedMatchList.Filter = oMatchList.Filter + } + if oMatchList.SendHttp != nil { + nestedMatchList.SendHttp = util.StrToMem(oMatchList.SendHttp) + } + nestedMatchListCol = append(nestedMatchListCol, nestedMatchList) + } + entry.MatchList = nestedMatchListCol + } + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + entry.EnhancedApplicationLogging = util.AsBool(o.EnhancedApplicationLogging, nil) + var nestedMatchListCol []MatchList + if o.MatchList != nil { + nestedMatchListCol = []MatchList{} + for _, oMatchList := range o.MatchList { + nestedMatchList := MatchList{} + if oMatchList.Misc != nil { + entry.Misc["MatchList"] = oMatchList.Misc + } + if oMatchList.ActionDesc != nil { + nestedMatchList.ActionDesc = oMatchList.ActionDesc + } + if oMatchList.Filter != nil { + nestedMatchList.Filter = oMatchList.Filter + } + if oMatchList.SendHttp != nil { + nestedMatchList.SendHttp = util.MemToStr(oMatchList.SendHttp) + } + if oMatchList.LogType != nil { + nestedMatchList.LogType = oMatchList.LogType + } + if oMatchList.SendToPanorama != nil { + nestedMatchList.SendToPanorama = util.AsBool(oMatchList.SendToPanorama, nil) + } + if oMatchList.Quarantine != nil { + nestedMatchList.Quarantine = util.AsBool(oMatchList.Quarantine, nil) + } + if oMatchList.SendSnmptrap != nil { + nestedMatchList.SendSnmptrap = util.MemToStr(oMatchList.SendSnmptrap) + } + if oMatchList.SendEmail != nil { + nestedMatchList.SendEmail = util.MemToStr(oMatchList.SendEmail) + } + if oMatchList.SendSyslog != nil { + nestedMatchList.SendSyslog = util.MemToStr(oMatchList.SendSyslog) + } + if oMatchList.Actions != nil { + nestedMatchList.Actions = []MatchListActions{} + for _, oMatchListActions := range oMatchList.Actions { + nestedMatchListActions := MatchListActions{} + if oMatchListActions.Misc != nil { + entry.Misc["MatchListActions"] = oMatchListActions.Misc + } + if oMatchListActions.Type != nil { + nestedMatchListActions.Type = &MatchListActionsType{} + if oMatchListActions.Type.Misc != nil { + entry.Misc["MatchListActionsType"] = oMatchListActions.Type.Misc + } + if oMatchListActions.Type.Integration != nil { + nestedMatchListActions.Type.Integration = &MatchListActionsTypeIntegration{} + if oMatchListActions.Type.Integration.Misc != nil { + entry.Misc["MatchListActionsTypeIntegration"] = oMatchListActions.Type.Integration.Misc + } + if oMatchListActions.Type.Integration.Action != nil { + nestedMatchListActions.Type.Integration.Action = oMatchListActions.Type.Integration.Action + } + } + if oMatchListActions.Type.Tagging != nil { + nestedMatchListActions.Type.Tagging = &MatchListActionsTypeTagging{} + if oMatchListActions.Type.Tagging.Misc != nil { + entry.Misc["MatchListActionsTypeTagging"] = oMatchListActions.Type.Tagging.Misc + } + if oMatchListActions.Type.Tagging.Tags != nil { + nestedMatchListActions.Type.Tagging.Tags = util.MemToStr(oMatchListActions.Type.Tagging.Tags) + } + if oMatchListActions.Type.Tagging.Target != nil { + nestedMatchListActions.Type.Tagging.Target = oMatchListActions.Type.Tagging.Target + } + if oMatchListActions.Type.Tagging.Action != nil { + nestedMatchListActions.Type.Tagging.Action = oMatchListActions.Type.Tagging.Action + } + if oMatchListActions.Type.Tagging.Timeout != nil { + nestedMatchListActions.Type.Tagging.Timeout = oMatchListActions.Type.Tagging.Timeout + } + if oMatchListActions.Type.Tagging.Registration != nil { + nestedMatchListActions.Type.Tagging.Registration = &MatchListActionsTypeTaggingRegistration{} + if oMatchListActions.Type.Tagging.Registration.Misc != nil { + entry.Misc["MatchListActionsTypeTaggingRegistration"] = oMatchListActions.Type.Tagging.Registration.Misc + } + if oMatchListActions.Type.Tagging.Registration.Panorama != nil { + nestedMatchListActions.Type.Tagging.Registration.Panorama = &MatchListActionsTypeTaggingRegistrationPanorama{} + if oMatchListActions.Type.Tagging.Registration.Panorama.Misc != nil { + entry.Misc["MatchListActionsTypeTaggingRegistrationPanorama"] = oMatchListActions.Type.Tagging.Registration.Panorama.Misc + } + } + if oMatchListActions.Type.Tagging.Registration.Remote != nil { + nestedMatchListActions.Type.Tagging.Registration.Remote = &MatchListActionsTypeTaggingRegistrationRemote{} + if oMatchListActions.Type.Tagging.Registration.Remote.Misc != nil { + entry.Misc["MatchListActionsTypeTaggingRegistrationRemote"] = oMatchListActions.Type.Tagging.Registration.Remote.Misc + } + if oMatchListActions.Type.Tagging.Registration.Remote.HttpProfile != nil { + nestedMatchListActions.Type.Tagging.Registration.Remote.HttpProfile = oMatchListActions.Type.Tagging.Registration.Remote.HttpProfile + } + } + if oMatchListActions.Type.Tagging.Registration.Localhost != nil { + nestedMatchListActions.Type.Tagging.Registration.Localhost = &MatchListActionsTypeTaggingRegistrationLocalhost{} + if oMatchListActions.Type.Tagging.Registration.Localhost.Misc != nil { + entry.Misc["MatchListActionsTypeTaggingRegistrationLocalhost"] = oMatchListActions.Type.Tagging.Registration.Localhost.Misc + } + } + } + } + } + if oMatchListActions.Name != "" { + nestedMatchListActions.Name = oMatchListActions.Name + } + nestedMatchList.Actions = append(nestedMatchList.Actions, nestedMatchListActions) + } + } + if oMatchList.Name != "" { + nestedMatchList.Name = oMatchList.Name + } + nestedMatchListCol = append(nestedMatchListCol, nestedMatchList) + } + entry.MatchList = nestedMatchListCol + } + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { + return false + } + if !util.BoolsMatch(a.EnhancedApplicationLogging, b.EnhancedApplicationLogging) { + return false + } + if !matchMatchList(a.MatchList, b.MatchList) { + return false + } + + return true +} + +func matchMatchListActionsTypeTaggingRegistrationLocalhost(a *MatchListActionsTypeTaggingRegistrationLocalhost, b *MatchListActionsTypeTaggingRegistrationLocalhost) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchMatchListActionsTypeTaggingRegistrationPanorama(a *MatchListActionsTypeTaggingRegistrationPanorama, b *MatchListActionsTypeTaggingRegistrationPanorama) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchMatchListActionsTypeTaggingRegistrationRemote(a *MatchListActionsTypeTaggingRegistrationRemote, b *MatchListActionsTypeTaggingRegistrationRemote) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.HttpProfile, b.HttpProfile) { + return false + } + return true +} +func matchMatchListActionsTypeTaggingRegistration(a *MatchListActionsTypeTaggingRegistration, b *MatchListActionsTypeTaggingRegistration) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchMatchListActionsTypeTaggingRegistrationRemote(a.Remote, b.Remote) { + return false + } + if !matchMatchListActionsTypeTaggingRegistrationLocalhost(a.Localhost, b.Localhost) { + return false + } + if !matchMatchListActionsTypeTaggingRegistrationPanorama(a.Panorama, b.Panorama) { + return false + } + return true +} +func matchMatchListActionsTypeTagging(a *MatchListActionsTypeTagging, b *MatchListActionsTypeTagging) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Timeout, b.Timeout) { + return false + } + if !matchMatchListActionsTypeTaggingRegistration(a.Registration, b.Registration) { + return false + } + if !util.OrderedListsMatch(a.Tags, b.Tags) { + return false + } + if !util.StringsMatch(a.Target, b.Target) { + return false + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + return true +} +func matchMatchListActionsTypeIntegration(a *MatchListActionsTypeIntegration, b *MatchListActionsTypeIntegration) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + return true +} +func matchMatchListActionsType(a *MatchListActionsType, b *MatchListActionsType) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchMatchListActionsTypeIntegration(a.Integration, b.Integration) { + return false + } + if !matchMatchListActionsTypeTagging(a.Tagging, b.Tagging) { + return false + } + return true +} +func matchMatchListActions(a []MatchListActions, b []MatchListActions) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !matchMatchListActionsType(a.Type, b.Type) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchMatchList(a []MatchList, b []MatchList) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.SendToPanorama, b.SendToPanorama) { + return false + } + if !util.BoolsMatch(a.Quarantine, b.Quarantine) { + return false + } + if !util.OrderedListsMatch(a.SendSnmptrap, b.SendSnmptrap) { + return false + } + if !util.OrderedListsMatch(a.SendEmail, b.SendEmail) { + return false + } + if !util.OrderedListsMatch(a.SendSyslog, b.SendSyslog) { + return false + } + if !matchMatchListActions(a.Actions, b.Actions) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.LogType, b.LogType) { + return false + } + if !util.StringsMatch(a.Filter, b.Filter) { + return false + } + if !util.OrderedListsMatch(a.SendHttp, b.SendHttp) { + return false + } + if !util.StringsMatch(a.ActionDesc, b.ActionDesc) { + return false + } + } + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/objects/profiles/logforwarding/interfaces.go b/objects/profiles/logforwarding/interfaces.go new file mode 100644 index 00000000..69328ebb --- /dev/null +++ b/objects/profiles/logforwarding/interfaces.go @@ -0,0 +1,7 @@ +package logforwarding + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/objects/profiles/logforwarding/location.go b/objects/profiles/logforwarding/location.go new file mode 100644 index 00000000..d5d24f76 --- /dev/null +++ b/objects/profiles/logforwarding/location.go @@ -0,0 +1,118 @@ +package logforwarding + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared bool `json:"shared"` +} + +type DeviceGroupLocation struct { + DeviceGroup string `json:"device_group"` + PanoramaDevice string `json:"panorama_device"` +} + +func NewDeviceGroupLocation() *Location { + return &Location{DeviceGroup: &DeviceGroupLocation{ + DeviceGroup: "", + PanoramaDevice: "localhost.localdomain", + }, + } +} +func NewSharedLocation() *Location { + return &Location{ + Shared: true, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + count++ + case o.Shared: + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return nil, fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.DeviceGroup.PanoramaDevice}), + "device-group", + util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), + } + case o.Shared: + ans = []string{ + "config", + "shared", + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/objects/profiles/logforwarding/service.go b/objects/profiles/logforwarding/service.go new file mode 100644 index 00000000..b7740427 --- /dev/null +++ b/objects/profiles/logforwarding/service.go @@ -0,0 +1,281 @@ +package logforwarding + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/objects/profiles/secgroup/entry.go b/objects/profiles/secgroup/entry.go new file mode 100644 index 00000000..3dba6501 --- /dev/null +++ b/objects/profiles/secgroup/entry.go @@ -0,0 +1,220 @@ +package secgroup + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"profile-group"} +) + +type Entry struct { + Name string + DataFiltering []string + DisableOverride *string + FileBlocking []string + Gtp []string + Sctp []string + Spyware []string + UrlFiltering []string + Virus []string + Vulnerability []string + WildfireAnalysis []string + + Misc map[string][]generic.Xml +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + DataFiltering *util.MemberType `xml:"data-filtering,omitempty"` + DisableOverride *string `xml:"disable-override,omitempty"` + FileBlocking *util.MemberType `xml:"file-blocking,omitempty"` + Gtp *util.MemberType `xml:"gtp,omitempty"` + Sctp *util.MemberType `xml:"sctp,omitempty"` + Spyware *util.MemberType `xml:"spyware,omitempty"` + UrlFiltering *util.MemberType `xml:"url-filtering,omitempty"` + Virus *util.MemberType `xml:"virus,omitempty"` + Vulnerability *util.MemberType `xml:"vulnerability,omitempty"` + WildfireAnalysis *util.MemberType `xml:"wildfire-analysis,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "data_filtering" || v == "DataFiltering" { + return e.DataFiltering, nil + } + if v == "data_filtering|LENGTH" || v == "DataFiltering|LENGTH" { + return int64(len(e.DataFiltering)), nil + } + if v == "disable_override" || v == "DisableOverride" { + return e.DisableOverride, nil + } + if v == "file_blocking" || v == "FileBlocking" { + return e.FileBlocking, nil + } + if v == "file_blocking|LENGTH" || v == "FileBlocking|LENGTH" { + return int64(len(e.FileBlocking)), nil + } + if v == "gtp" || v == "Gtp" { + return e.Gtp, nil + } + if v == "gtp|LENGTH" || v == "Gtp|LENGTH" { + return int64(len(e.Gtp)), nil + } + if v == "sctp" || v == "Sctp" { + return e.Sctp, nil + } + if v == "sctp|LENGTH" || v == "Sctp|LENGTH" { + return int64(len(e.Sctp)), nil + } + if v == "spyware" || v == "Spyware" { + return e.Spyware, nil + } + if v == "spyware|LENGTH" || v == "Spyware|LENGTH" { + return int64(len(e.Spyware)), nil + } + if v == "url_filtering" || v == "UrlFiltering" { + return e.UrlFiltering, nil + } + if v == "url_filtering|LENGTH" || v == "UrlFiltering|LENGTH" { + return int64(len(e.UrlFiltering)), nil + } + if v == "virus" || v == "Virus" { + return e.Virus, nil + } + if v == "virus|LENGTH" || v == "Virus|LENGTH" { + return int64(len(e.Virus)), nil + } + if v == "vulnerability" || v == "Vulnerability" { + return e.Vulnerability, nil + } + if v == "vulnerability|LENGTH" || v == "Vulnerability|LENGTH" { + return int64(len(e.Vulnerability)), nil + } + if v == "wildfire_analysis" || v == "WildfireAnalysis" { + return e.WildfireAnalysis, nil + } + if v == "wildfire_analysis|LENGTH" || v == "WildfireAnalysis|LENGTH" { + return int64(len(e.WildfireAnalysis)), nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.DataFiltering = util.StrToMem(o.DataFiltering) + entry.DisableOverride = o.DisableOverride + entry.FileBlocking = util.StrToMem(o.FileBlocking) + entry.Gtp = util.StrToMem(o.Gtp) + entry.Sctp = util.StrToMem(o.Sctp) + entry.Spyware = util.StrToMem(o.Spyware) + entry.UrlFiltering = util.StrToMem(o.UrlFiltering) + entry.Virus = util.StrToMem(o.Virus) + entry.Vulnerability = util.StrToMem(o.Vulnerability) + entry.WildfireAnalysis = util.StrToMem(o.WildfireAnalysis) + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.DataFiltering = util.MemToStr(o.DataFiltering) + entry.DisableOverride = o.DisableOverride + entry.FileBlocking = util.MemToStr(o.FileBlocking) + entry.Gtp = util.MemToStr(o.Gtp) + entry.Sctp = util.MemToStr(o.Sctp) + entry.Spyware = util.MemToStr(o.Spyware) + entry.UrlFiltering = util.MemToStr(o.UrlFiltering) + entry.Virus = util.MemToStr(o.Virus) + entry.Vulnerability = util.MemToStr(o.Vulnerability) + entry.WildfireAnalysis = util.MemToStr(o.WildfireAnalysis) + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.OrderedListsMatch(a.DataFiltering, b.DataFiltering) { + return false + } + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { + return false + } + if !util.OrderedListsMatch(a.FileBlocking, b.FileBlocking) { + return false + } + if !util.OrderedListsMatch(a.Gtp, b.Gtp) { + return false + } + if !util.OrderedListsMatch(a.Sctp, b.Sctp) { + return false + } + if !util.OrderedListsMatch(a.Spyware, b.Spyware) { + return false + } + if !util.OrderedListsMatch(a.UrlFiltering, b.UrlFiltering) { + return false + } + if !util.OrderedListsMatch(a.Virus, b.Virus) { + return false + } + if !util.OrderedListsMatch(a.Vulnerability, b.Vulnerability) { + return false + } + if !util.OrderedListsMatch(a.WildfireAnalysis, b.WildfireAnalysis) { + return false + } + + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/objects/profiles/secgroup/interfaces.go b/objects/profiles/secgroup/interfaces.go new file mode 100644 index 00000000..dfcfe04a --- /dev/null +++ b/objects/profiles/secgroup/interfaces.go @@ -0,0 +1,7 @@ +package secgroup + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/objects/profiles/secgroup/location.go b/objects/profiles/secgroup/location.go new file mode 100644 index 00000000..7b9945b0 --- /dev/null +++ b/objects/profiles/secgroup/location.go @@ -0,0 +1,118 @@ +package secgroup + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared bool `json:"shared"` +} + +type DeviceGroupLocation struct { + DeviceGroup string `json:"device_group"` + PanoramaDevice string `json:"panorama_device"` +} + +func NewDeviceGroupLocation() *Location { + return &Location{DeviceGroup: &DeviceGroupLocation{ + DeviceGroup: "", + PanoramaDevice: "localhost.localdomain", + }, + } +} +func NewSharedLocation() *Location { + return &Location{ + Shared: true, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + count++ + case o.Shared: + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return nil, fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.DeviceGroup.PanoramaDevice}), + "device-group", + util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), + } + case o.Shared: + ans = []string{ + "config", + "shared", + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/objects/profiles/secgroup/service.go b/objects/profiles/secgroup/service.go new file mode 100644 index 00000000..dbad5381 --- /dev/null +++ b/objects/profiles/secgroup/service.go @@ -0,0 +1,281 @@ +package secgroup + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/objects/profiles/urlfiltering/entry.go b/objects/profiles/urlfiltering/entry.go new file mode 100644 index 00000000..e83186da --- /dev/null +++ b/objects/profiles/urlfiltering/entry.go @@ -0,0 +1,732 @@ +package urlfiltering + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"profiles", "url-filtering"} +) + +type Entry struct { + Name string + Alert []string + Allow []string + Block []string + CloudInlineCat *bool + Continue []string + CredentialEnforcement *CredentialEnforcement + Description *string + DisableOverride *string + EnableContainerPage *bool + HttpHeaderInsertion []HttpHeaderInsertion + LocalInlineCat *bool + LogContainerPageOnly *bool + LogHttpHdrReferer *bool + LogHttpHdrUserAgent *bool + LogHttpHdrXff *bool + MlavCategoryException []string + Override []string + SafeSearchEnforcement *bool + + Misc map[string][]generic.Xml +} + +type CredentialEnforcement struct { + Alert []string + Allow []string + Block []string + Continue []string + LogSeverity *string + Mode *CredentialEnforcementMode +} +type CredentialEnforcementMode struct { + Disabled *CredentialEnforcementModeDisabled + DomainCredentials *CredentialEnforcementModeDomainCredentials + GroupMapping *string + IpUser *CredentialEnforcementModeIpUser +} +type CredentialEnforcementModeDisabled struct { +} +type CredentialEnforcementModeDomainCredentials struct { +} +type CredentialEnforcementModeIpUser struct { +} +type HttpHeaderInsertion struct { + DisableOverride *string + Name string + Type []HttpHeaderInsertionType +} +type HttpHeaderInsertionType struct { + Domains []string + Headers []HttpHeaderInsertionTypeHeaders + Name string +} +type HttpHeaderInsertionTypeHeaders struct { + Header *string + Log *bool + Name string + Value *string +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Alert *util.MemberType `xml:"alert,omitempty"` + Allow *util.MemberType `xml:"allow,omitempty"` + Block *util.MemberType `xml:"block,omitempty"` + CloudInlineCat *string `xml:"cloud-inline-cat,omitempty"` + Continue *util.MemberType `xml:"continue,omitempty"` + CredentialEnforcement *CredentialEnforcementXml `xml:"credential-enforcement,omitempty"` + Description *string `xml:"description,omitempty"` + DisableOverride *string `xml:"disable-override,omitempty"` + EnableContainerPage *string `xml:"enable-container-page,omitempty"` + HttpHeaderInsertion []HttpHeaderInsertionXml `xml:"http-header-insertion>entry,omitempty"` + LocalInlineCat *string `xml:"local-inline-cat,omitempty"` + LogContainerPageOnly *string `xml:"log-container-page-only,omitempty"` + LogHttpHdrReferer *string `xml:"log-http-hdr-referer,omitempty"` + LogHttpHdrUserAgent *string `xml:"log-http-hdr-user-agent,omitempty"` + LogHttpHdrXff *string `xml:"log-http-hdr-xff,omitempty"` + MlavCategoryException *util.MemberType `xml:"mlav-category-exception,omitempty"` + Override *util.MemberType `xml:"override,omitempty"` + SafeSearchEnforcement *string `xml:"safe-search-enforcement,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type CredentialEnforcementXml struct { + Alert *util.MemberType `xml:"alert,omitempty"` + Allow *util.MemberType `xml:"allow,omitempty"` + Block *util.MemberType `xml:"block,omitempty"` + Continue *util.MemberType `xml:"continue,omitempty"` + LogSeverity *string `xml:"log-severity,omitempty"` + Mode *CredentialEnforcementModeXml `xml:"mode,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type CredentialEnforcementModeXml struct { + Disabled *CredentialEnforcementModeDisabledXml `xml:"disabled,omitempty"` + DomainCredentials *CredentialEnforcementModeDomainCredentialsXml `xml:"domain-credentials,omitempty"` + GroupMapping *string `xml:"group-mapping,omitempty"` + IpUser *CredentialEnforcementModeIpUserXml `xml:"ip-user,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type CredentialEnforcementModeDisabledXml struct { + Misc []generic.Xml `xml:",any"` +} +type CredentialEnforcementModeDomainCredentialsXml struct { + Misc []generic.Xml `xml:",any"` +} +type CredentialEnforcementModeIpUserXml struct { + Misc []generic.Xml `xml:",any"` +} +type HttpHeaderInsertionXml struct { + DisableOverride *string `xml:"disable-override,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Type []HttpHeaderInsertionTypeXml `xml:"type>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type HttpHeaderInsertionTypeXml struct { + Domains *util.MemberType `xml:"domains,omitempty"` + Headers []HttpHeaderInsertionTypeHeadersXml `xml:"headers>entry,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type HttpHeaderInsertionTypeHeadersXml struct { + Header *string `xml:"header,omitempty"` + Log *string `xml:"log,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Value *string `xml:"value,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "alert" || v == "Alert" { + return e.Alert, nil + } + if v == "alert|LENGTH" || v == "Alert|LENGTH" { + return int64(len(e.Alert)), nil + } + if v == "allow" || v == "Allow" { + return e.Allow, nil + } + if v == "allow|LENGTH" || v == "Allow|LENGTH" { + return int64(len(e.Allow)), nil + } + if v == "block" || v == "Block" { + return e.Block, nil + } + if v == "block|LENGTH" || v == "Block|LENGTH" { + return int64(len(e.Block)), nil + } + if v == "cloud_inline_cat" || v == "CloudInlineCat" { + return e.CloudInlineCat, nil + } + if v == "continue" || v == "Continue" { + return e.Continue, nil + } + if v == "continue|LENGTH" || v == "Continue|LENGTH" { + return int64(len(e.Continue)), nil + } + if v == "credential_enforcement" || v == "CredentialEnforcement" { + return e.CredentialEnforcement, nil + } + if v == "description" || v == "Description" { + return e.Description, nil + } + if v == "disable_override" || v == "DisableOverride" { + return e.DisableOverride, nil + } + if v == "enable_container_page" || v == "EnableContainerPage" { + return e.EnableContainerPage, nil + } + if v == "http_header_insertion" || v == "HttpHeaderInsertion" { + return e.HttpHeaderInsertion, nil + } + if v == "http_header_insertion|LENGTH" || v == "HttpHeaderInsertion|LENGTH" { + return int64(len(e.HttpHeaderInsertion)), nil + } + if v == "local_inline_cat" || v == "LocalInlineCat" { + return e.LocalInlineCat, nil + } + if v == "log_container_page_only" || v == "LogContainerPageOnly" { + return e.LogContainerPageOnly, nil + } + if v == "log_http_hdr_referer" || v == "LogHttpHdrReferer" { + return e.LogHttpHdrReferer, nil + } + if v == "log_http_hdr_user_agent" || v == "LogHttpHdrUserAgent" { + return e.LogHttpHdrUserAgent, nil + } + if v == "log_http_hdr_xff" || v == "LogHttpHdrXff" { + return e.LogHttpHdrXff, nil + } + if v == "mlav_category_exception" || v == "MlavCategoryException" { + return e.MlavCategoryException, nil + } + if v == "mlav_category_exception|LENGTH" || v == "MlavCategoryException|LENGTH" { + return int64(len(e.MlavCategoryException)), nil + } + if v == "override" || v == "Override" { + return e.Override, nil + } + if v == "override|LENGTH" || v == "Override|LENGTH" { + return int64(len(e.Override)), nil + } + if v == "safe_search_enforcement" || v == "SafeSearchEnforcement" { + return e.SafeSearchEnforcement, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.Alert = util.StrToMem(o.Alert) + entry.Allow = util.StrToMem(o.Allow) + entry.Block = util.StrToMem(o.Block) + entry.CloudInlineCat = util.YesNo(o.CloudInlineCat, nil) + entry.Continue = util.StrToMem(o.Continue) + var nestedCredentialEnforcement *CredentialEnforcementXml + if o.CredentialEnforcement != nil { + nestedCredentialEnforcement = &CredentialEnforcementXml{} + if _, ok := o.Misc["CredentialEnforcement"]; ok { + nestedCredentialEnforcement.Misc = o.Misc["CredentialEnforcement"] + } + if o.CredentialEnforcement.Allow != nil { + nestedCredentialEnforcement.Allow = util.StrToMem(o.CredentialEnforcement.Allow) + } + if o.CredentialEnforcement.Block != nil { + nestedCredentialEnforcement.Block = util.StrToMem(o.CredentialEnforcement.Block) + } + if o.CredentialEnforcement.Continue != nil { + nestedCredentialEnforcement.Continue = util.StrToMem(o.CredentialEnforcement.Continue) + } + if o.CredentialEnforcement.LogSeverity != nil { + nestedCredentialEnforcement.LogSeverity = o.CredentialEnforcement.LogSeverity + } + if o.CredentialEnforcement.Mode != nil { + nestedCredentialEnforcement.Mode = &CredentialEnforcementModeXml{} + if _, ok := o.Misc["CredentialEnforcementMode"]; ok { + nestedCredentialEnforcement.Mode.Misc = o.Misc["CredentialEnforcementMode"] + } + if o.CredentialEnforcement.Mode.Disabled != nil { + nestedCredentialEnforcement.Mode.Disabled = &CredentialEnforcementModeDisabledXml{} + if _, ok := o.Misc["CredentialEnforcementModeDisabled"]; ok { + nestedCredentialEnforcement.Mode.Disabled.Misc = o.Misc["CredentialEnforcementModeDisabled"] + } + } + if o.CredentialEnforcement.Mode.DomainCredentials != nil { + nestedCredentialEnforcement.Mode.DomainCredentials = &CredentialEnforcementModeDomainCredentialsXml{} + if _, ok := o.Misc["CredentialEnforcementModeDomainCredentials"]; ok { + nestedCredentialEnforcement.Mode.DomainCredentials.Misc = o.Misc["CredentialEnforcementModeDomainCredentials"] + } + } + if o.CredentialEnforcement.Mode.GroupMapping != nil { + nestedCredentialEnforcement.Mode.GroupMapping = o.CredentialEnforcement.Mode.GroupMapping + } + if o.CredentialEnforcement.Mode.IpUser != nil { + nestedCredentialEnforcement.Mode.IpUser = &CredentialEnforcementModeIpUserXml{} + if _, ok := o.Misc["CredentialEnforcementModeIpUser"]; ok { + nestedCredentialEnforcement.Mode.IpUser.Misc = o.Misc["CredentialEnforcementModeIpUser"] + } + } + } + if o.CredentialEnforcement.Alert != nil { + nestedCredentialEnforcement.Alert = util.StrToMem(o.CredentialEnforcement.Alert) + } + } + entry.CredentialEnforcement = nestedCredentialEnforcement + + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + entry.EnableContainerPage = util.YesNo(o.EnableContainerPage, nil) + var nestedHttpHeaderInsertionCol []HttpHeaderInsertionXml + if o.HttpHeaderInsertion != nil { + nestedHttpHeaderInsertionCol = []HttpHeaderInsertionXml{} + for _, oHttpHeaderInsertion := range o.HttpHeaderInsertion { + nestedHttpHeaderInsertion := HttpHeaderInsertionXml{} + if _, ok := o.Misc["HttpHeaderInsertion"]; ok { + nestedHttpHeaderInsertion.Misc = o.Misc["HttpHeaderInsertion"] + } + if oHttpHeaderInsertion.Type != nil { + nestedHttpHeaderInsertion.Type = []HttpHeaderInsertionTypeXml{} + for _, oHttpHeaderInsertionType := range oHttpHeaderInsertion.Type { + nestedHttpHeaderInsertionType := HttpHeaderInsertionTypeXml{} + if _, ok := o.Misc["HttpHeaderInsertionType"]; ok { + nestedHttpHeaderInsertionType.Misc = o.Misc["HttpHeaderInsertionType"] + } + if oHttpHeaderInsertionType.Name != "" { + nestedHttpHeaderInsertionType.Name = oHttpHeaderInsertionType.Name + } + if oHttpHeaderInsertionType.Headers != nil { + nestedHttpHeaderInsertionType.Headers = []HttpHeaderInsertionTypeHeadersXml{} + for _, oHttpHeaderInsertionTypeHeaders := range oHttpHeaderInsertionType.Headers { + nestedHttpHeaderInsertionTypeHeaders := HttpHeaderInsertionTypeHeadersXml{} + if _, ok := o.Misc["HttpHeaderInsertionTypeHeaders"]; ok { + nestedHttpHeaderInsertionTypeHeaders.Misc = o.Misc["HttpHeaderInsertionTypeHeaders"] + } + if oHttpHeaderInsertionTypeHeaders.Value != nil { + nestedHttpHeaderInsertionTypeHeaders.Value = oHttpHeaderInsertionTypeHeaders.Value + } + if oHttpHeaderInsertionTypeHeaders.Log != nil { + nestedHttpHeaderInsertionTypeHeaders.Log = util.YesNo(oHttpHeaderInsertionTypeHeaders.Log, nil) + } + if oHttpHeaderInsertionTypeHeaders.Name != "" { + nestedHttpHeaderInsertionTypeHeaders.Name = oHttpHeaderInsertionTypeHeaders.Name + } + if oHttpHeaderInsertionTypeHeaders.Header != nil { + nestedHttpHeaderInsertionTypeHeaders.Header = oHttpHeaderInsertionTypeHeaders.Header + } + nestedHttpHeaderInsertionType.Headers = append(nestedHttpHeaderInsertionType.Headers, nestedHttpHeaderInsertionTypeHeaders) + } + } + if oHttpHeaderInsertionType.Domains != nil { + nestedHttpHeaderInsertionType.Domains = util.StrToMem(oHttpHeaderInsertionType.Domains) + } + nestedHttpHeaderInsertion.Type = append(nestedHttpHeaderInsertion.Type, nestedHttpHeaderInsertionType) + } + } + if oHttpHeaderInsertion.Name != "" { + nestedHttpHeaderInsertion.Name = oHttpHeaderInsertion.Name + } + if oHttpHeaderInsertion.DisableOverride != nil { + nestedHttpHeaderInsertion.DisableOverride = oHttpHeaderInsertion.DisableOverride + } + nestedHttpHeaderInsertionCol = append(nestedHttpHeaderInsertionCol, nestedHttpHeaderInsertion) + } + entry.HttpHeaderInsertion = nestedHttpHeaderInsertionCol + } + + entry.LocalInlineCat = util.YesNo(o.LocalInlineCat, nil) + entry.LogContainerPageOnly = util.YesNo(o.LogContainerPageOnly, nil) + entry.LogHttpHdrReferer = util.YesNo(o.LogHttpHdrReferer, nil) + entry.LogHttpHdrUserAgent = util.YesNo(o.LogHttpHdrUserAgent, nil) + entry.LogHttpHdrXff = util.YesNo(o.LogHttpHdrXff, nil) + entry.MlavCategoryException = util.StrToMem(o.MlavCategoryException) + entry.Override = util.StrToMem(o.Override) + entry.SafeSearchEnforcement = util.YesNo(o.SafeSearchEnforcement, nil) + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.Alert = util.MemToStr(o.Alert) + entry.Allow = util.MemToStr(o.Allow) + entry.Block = util.MemToStr(o.Block) + entry.CloudInlineCat = util.AsBool(o.CloudInlineCat, nil) + entry.Continue = util.MemToStr(o.Continue) + var nestedCredentialEnforcement *CredentialEnforcement + if o.CredentialEnforcement != nil { + nestedCredentialEnforcement = &CredentialEnforcement{} + if o.CredentialEnforcement.Misc != nil { + entry.Misc["CredentialEnforcement"] = o.CredentialEnforcement.Misc + } + if o.CredentialEnforcement.Continue != nil { + nestedCredentialEnforcement.Continue = util.MemToStr(o.CredentialEnforcement.Continue) + } + if o.CredentialEnforcement.LogSeverity != nil { + nestedCredentialEnforcement.LogSeverity = o.CredentialEnforcement.LogSeverity + } + if o.CredentialEnforcement.Mode != nil { + nestedCredentialEnforcement.Mode = &CredentialEnforcementMode{} + if o.CredentialEnforcement.Mode.Misc != nil { + entry.Misc["CredentialEnforcementMode"] = o.CredentialEnforcement.Mode.Misc + } + if o.CredentialEnforcement.Mode.DomainCredentials != nil { + nestedCredentialEnforcement.Mode.DomainCredentials = &CredentialEnforcementModeDomainCredentials{} + if o.CredentialEnforcement.Mode.DomainCredentials.Misc != nil { + entry.Misc["CredentialEnforcementModeDomainCredentials"] = o.CredentialEnforcement.Mode.DomainCredentials.Misc + } + } + if o.CredentialEnforcement.Mode.GroupMapping != nil { + nestedCredentialEnforcement.Mode.GroupMapping = o.CredentialEnforcement.Mode.GroupMapping + } + if o.CredentialEnforcement.Mode.IpUser != nil { + nestedCredentialEnforcement.Mode.IpUser = &CredentialEnforcementModeIpUser{} + if o.CredentialEnforcement.Mode.IpUser.Misc != nil { + entry.Misc["CredentialEnforcementModeIpUser"] = o.CredentialEnforcement.Mode.IpUser.Misc + } + } + if o.CredentialEnforcement.Mode.Disabled != nil { + nestedCredentialEnforcement.Mode.Disabled = &CredentialEnforcementModeDisabled{} + if o.CredentialEnforcement.Mode.Disabled.Misc != nil { + entry.Misc["CredentialEnforcementModeDisabled"] = o.CredentialEnforcement.Mode.Disabled.Misc + } + } + } + if o.CredentialEnforcement.Alert != nil { + nestedCredentialEnforcement.Alert = util.MemToStr(o.CredentialEnforcement.Alert) + } + if o.CredentialEnforcement.Allow != nil { + nestedCredentialEnforcement.Allow = util.MemToStr(o.CredentialEnforcement.Allow) + } + if o.CredentialEnforcement.Block != nil { + nestedCredentialEnforcement.Block = util.MemToStr(o.CredentialEnforcement.Block) + } + } + entry.CredentialEnforcement = nestedCredentialEnforcement + + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + entry.EnableContainerPage = util.AsBool(o.EnableContainerPage, nil) + var nestedHttpHeaderInsertionCol []HttpHeaderInsertion + if o.HttpHeaderInsertion != nil { + nestedHttpHeaderInsertionCol = []HttpHeaderInsertion{} + for _, oHttpHeaderInsertion := range o.HttpHeaderInsertion { + nestedHttpHeaderInsertion := HttpHeaderInsertion{} + if oHttpHeaderInsertion.Misc != nil { + entry.Misc["HttpHeaderInsertion"] = oHttpHeaderInsertion.Misc + } + if oHttpHeaderInsertion.DisableOverride != nil { + nestedHttpHeaderInsertion.DisableOverride = oHttpHeaderInsertion.DisableOverride + } + if oHttpHeaderInsertion.Type != nil { + nestedHttpHeaderInsertion.Type = []HttpHeaderInsertionType{} + for _, oHttpHeaderInsertionType := range oHttpHeaderInsertion.Type { + nestedHttpHeaderInsertionType := HttpHeaderInsertionType{} + if oHttpHeaderInsertionType.Misc != nil { + entry.Misc["HttpHeaderInsertionType"] = oHttpHeaderInsertionType.Misc + } + if oHttpHeaderInsertionType.Domains != nil { + nestedHttpHeaderInsertionType.Domains = util.MemToStr(oHttpHeaderInsertionType.Domains) + } + if oHttpHeaderInsertionType.Name != "" { + nestedHttpHeaderInsertionType.Name = oHttpHeaderInsertionType.Name + } + if oHttpHeaderInsertionType.Headers != nil { + nestedHttpHeaderInsertionType.Headers = []HttpHeaderInsertionTypeHeaders{} + for _, oHttpHeaderInsertionTypeHeaders := range oHttpHeaderInsertionType.Headers { + nestedHttpHeaderInsertionTypeHeaders := HttpHeaderInsertionTypeHeaders{} + if oHttpHeaderInsertionTypeHeaders.Misc != nil { + entry.Misc["HttpHeaderInsertionTypeHeaders"] = oHttpHeaderInsertionTypeHeaders.Misc + } + if oHttpHeaderInsertionTypeHeaders.Log != nil { + nestedHttpHeaderInsertionTypeHeaders.Log = util.AsBool(oHttpHeaderInsertionTypeHeaders.Log, nil) + } + if oHttpHeaderInsertionTypeHeaders.Name != "" { + nestedHttpHeaderInsertionTypeHeaders.Name = oHttpHeaderInsertionTypeHeaders.Name + } + if oHttpHeaderInsertionTypeHeaders.Header != nil { + nestedHttpHeaderInsertionTypeHeaders.Header = oHttpHeaderInsertionTypeHeaders.Header + } + if oHttpHeaderInsertionTypeHeaders.Value != nil { + nestedHttpHeaderInsertionTypeHeaders.Value = oHttpHeaderInsertionTypeHeaders.Value + } + nestedHttpHeaderInsertionType.Headers = append(nestedHttpHeaderInsertionType.Headers, nestedHttpHeaderInsertionTypeHeaders) + } + } + nestedHttpHeaderInsertion.Type = append(nestedHttpHeaderInsertion.Type, nestedHttpHeaderInsertionType) + } + } + if oHttpHeaderInsertion.Name != "" { + nestedHttpHeaderInsertion.Name = oHttpHeaderInsertion.Name + } + nestedHttpHeaderInsertionCol = append(nestedHttpHeaderInsertionCol, nestedHttpHeaderInsertion) + } + entry.HttpHeaderInsertion = nestedHttpHeaderInsertionCol + } + + entry.LocalInlineCat = util.AsBool(o.LocalInlineCat, nil) + entry.LogContainerPageOnly = util.AsBool(o.LogContainerPageOnly, nil) + entry.LogHttpHdrReferer = util.AsBool(o.LogHttpHdrReferer, nil) + entry.LogHttpHdrUserAgent = util.AsBool(o.LogHttpHdrUserAgent, nil) + entry.LogHttpHdrXff = util.AsBool(o.LogHttpHdrXff, nil) + entry.MlavCategoryException = util.MemToStr(o.MlavCategoryException) + entry.Override = util.MemToStr(o.Override) + entry.SafeSearchEnforcement = util.AsBool(o.SafeSearchEnforcement, nil) + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.OrderedListsMatch(a.Alert, b.Alert) { + return false + } + if !util.OrderedListsMatch(a.Allow, b.Allow) { + return false + } + if !util.OrderedListsMatch(a.Block, b.Block) { + return false + } + if !util.BoolsMatch(a.CloudInlineCat, b.CloudInlineCat) { + return false + } + if !util.OrderedListsMatch(a.Continue, b.Continue) { + return false + } + if !matchCredentialEnforcement(a.CredentialEnforcement, b.CredentialEnforcement) { + return false + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { + return false + } + if !util.BoolsMatch(a.EnableContainerPage, b.EnableContainerPage) { + return false + } + if !matchHttpHeaderInsertion(a.HttpHeaderInsertion, b.HttpHeaderInsertion) { + return false + } + if !util.BoolsMatch(a.LocalInlineCat, b.LocalInlineCat) { + return false + } + if !util.BoolsMatch(a.LogContainerPageOnly, b.LogContainerPageOnly) { + return false + } + if !util.BoolsMatch(a.LogHttpHdrReferer, b.LogHttpHdrReferer) { + return false + } + if !util.BoolsMatch(a.LogHttpHdrUserAgent, b.LogHttpHdrUserAgent) { + return false + } + if !util.BoolsMatch(a.LogHttpHdrXff, b.LogHttpHdrXff) { + return false + } + if !util.OrderedListsMatch(a.MlavCategoryException, b.MlavCategoryException) { + return false + } + if !util.OrderedListsMatch(a.Override, b.Override) { + return false + } + if !util.BoolsMatch(a.SafeSearchEnforcement, b.SafeSearchEnforcement) { + return false + } + + return true +} + +func matchHttpHeaderInsertionTypeHeaders(a []HttpHeaderInsertionTypeHeaders, b []HttpHeaderInsertionTypeHeaders) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.BoolsMatch(a.Log, b.Log) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.Header, b.Header) { + return false + } + if !util.StringsMatch(a.Value, b.Value) { + return false + } + } + } + return true +} +func matchHttpHeaderInsertionType(a []HttpHeaderInsertionType, b []HttpHeaderInsertionType) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !matchHttpHeaderInsertionTypeHeaders(a.Headers, b.Headers) { + return false + } + if !util.OrderedListsMatch(a.Domains, b.Domains) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchHttpHeaderInsertion(a []HttpHeaderInsertion, b []HttpHeaderInsertion) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { + return false + } + if !matchHttpHeaderInsertionType(a.Type, b.Type) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchCredentialEnforcementModeIpUser(a *CredentialEnforcementModeIpUser, b *CredentialEnforcementModeIpUser) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchCredentialEnforcementModeDisabled(a *CredentialEnforcementModeDisabled, b *CredentialEnforcementModeDisabled) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchCredentialEnforcementModeDomainCredentials(a *CredentialEnforcementModeDomainCredentials, b *CredentialEnforcementModeDomainCredentials) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchCredentialEnforcementMode(a *CredentialEnforcementMode, b *CredentialEnforcementMode) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchCredentialEnforcementModeDisabled(a.Disabled, b.Disabled) { + return false + } + if !matchCredentialEnforcementModeDomainCredentials(a.DomainCredentials, b.DomainCredentials) { + return false + } + if !util.StringsMatch(a.GroupMapping, b.GroupMapping) { + return false + } + if !matchCredentialEnforcementModeIpUser(a.IpUser, b.IpUser) { + return false + } + return true +} +func matchCredentialEnforcement(a *CredentialEnforcement, b *CredentialEnforcement) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.OrderedListsMatch(a.Alert, b.Alert) { + return false + } + if !util.OrderedListsMatch(a.Allow, b.Allow) { + return false + } + if !util.OrderedListsMatch(a.Block, b.Block) { + return false + } + if !util.OrderedListsMatch(a.Continue, b.Continue) { + return false + } + if !util.StringsMatch(a.LogSeverity, b.LogSeverity) { + return false + } + if !matchCredentialEnforcementMode(a.Mode, b.Mode) { + return false + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/objects/profiles/urlfiltering/interfaces.go b/objects/profiles/urlfiltering/interfaces.go new file mode 100644 index 00000000..4a70d5a0 --- /dev/null +++ b/objects/profiles/urlfiltering/interfaces.go @@ -0,0 +1,7 @@ +package urlfiltering + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/objects/profiles/urlfiltering/location.go b/objects/profiles/urlfiltering/location.go new file mode 100644 index 00000000..ec13ac76 --- /dev/null +++ b/objects/profiles/urlfiltering/location.go @@ -0,0 +1,118 @@ +package urlfiltering + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared bool `json:"shared"` +} + +type DeviceGroupLocation struct { + DeviceGroup string `json:"device_group"` + PanoramaDevice string `json:"panorama_device"` +} + +func NewDeviceGroupLocation() *Location { + return &Location{DeviceGroup: &DeviceGroupLocation{ + DeviceGroup: "", + PanoramaDevice: "localhost.localdomain", + }, + } +} +func NewSharedLocation() *Location { + return &Location{ + Shared: true, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + count++ + case o.Shared: + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return nil, fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.DeviceGroup.PanoramaDevice}), + "device-group", + util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), + } + case o.Shared: + ans = []string{ + "config", + "shared", + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/objects/profiles/urlfiltering/service.go b/objects/profiles/urlfiltering/service.go new file mode 100644 index 00000000..f2100467 --- /dev/null +++ b/objects/profiles/urlfiltering/service.go @@ -0,0 +1,281 @@ +package urlfiltering + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/objects/profiles/vulnerability/entry.go b/objects/profiles/vulnerability/entry.go new file mode 100644 index 00000000..0ca0812e --- /dev/null +++ b/objects/profiles/vulnerability/entry.go @@ -0,0 +1,1156 @@ +package vulnerability + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"profiles", "vulnerability"} +) + +type Entry struct { + Name string + CloudInlineAnalysis *bool + Description *string + DisableOverride *string + InlineExceptionEdlUrl []string + InlineExceptionIpAddress []string + MicaEngineVulnerabilityEnabled []MicaEngineVulnerabilityEnabled + Rules []Rules + ThreatException []ThreatException + + Misc map[string][]generic.Xml +} + +type MicaEngineVulnerabilityEnabled struct { + InlinePolicyAction *string + Name string +} +type Rules struct { + Action *RulesAction + Category *string + Cve []string + Host *string + Name string + PacketCapture *string + Severity []string + ThreatName *string + VendorId []string +} +type RulesAction struct { + Alert *RulesActionAlert + Allow *RulesActionAllow + BlockIp *RulesActionBlockIp + Default *RulesActionDefault + Drop *RulesActionDrop + ResetBoth *RulesActionResetBoth + ResetClient *RulesActionResetClient + ResetServer *RulesActionResetServer +} +type RulesActionAlert struct { +} +type RulesActionAllow struct { +} +type RulesActionBlockIp struct { + Duration *int64 + TrackBy *string +} +type RulesActionDefault struct { +} +type RulesActionDrop struct { +} +type RulesActionResetBoth struct { +} +type RulesActionResetClient struct { +} +type RulesActionResetServer struct { +} +type ThreatException struct { + Action *ThreatExceptionAction + ExemptIp []ThreatExceptionExemptIp + Name string + PacketCapture *string + TimeAttribute *ThreatExceptionTimeAttribute +} +type ThreatExceptionAction struct { + Alert *ThreatExceptionActionAlert + Allow *ThreatExceptionActionAllow + BlockIp *ThreatExceptionActionBlockIp + Default *ThreatExceptionActionDefault + Drop *ThreatExceptionActionDrop + ResetBoth *ThreatExceptionActionResetBoth + ResetClient *ThreatExceptionActionResetClient + ResetServer *ThreatExceptionActionResetServer +} +type ThreatExceptionActionAlert struct { +} +type ThreatExceptionActionAllow struct { +} +type ThreatExceptionActionBlockIp struct { + Duration *int64 + TrackBy *string +} +type ThreatExceptionActionDefault struct { +} +type ThreatExceptionActionDrop struct { +} +type ThreatExceptionActionResetBoth struct { +} +type ThreatExceptionActionResetClient struct { +} +type ThreatExceptionActionResetServer struct { +} +type ThreatExceptionExemptIp struct { + Name string +} +type ThreatExceptionTimeAttribute struct { + Interval *int64 + Threshold *int64 + TrackBy *string +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + CloudInlineAnalysis *string `xml:"cloud-inline-analysis,omitempty"` + Description *string `xml:"description,omitempty"` + DisableOverride *string `xml:"disable-override,omitempty"` + InlineExceptionEdlUrl *util.MemberType `xml:"inline-exception-edl-url,omitempty"` + InlineExceptionIpAddress *util.MemberType `xml:"inline-exception-ip-address,omitempty"` + MicaEngineVulnerabilityEnabled []MicaEngineVulnerabilityEnabledXml `xml:"mica-engine-vulnerability-enabled>entry,omitempty"` + Rules []RulesXml `xml:"rules>entry,omitempty"` + ThreatException []ThreatExceptionXml `xml:"threat-exception>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type MicaEngineVulnerabilityEnabledXml struct { + InlinePolicyAction *string `xml:"inline-policy-action,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type RulesXml struct { + Action *RulesActionXml `xml:"action,omitempty"` + Category *string `xml:"category,omitempty"` + Cve *util.MemberType `xml:"cve,omitempty"` + Host *string `xml:"host,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + PacketCapture *string `xml:"packet-capture,omitempty"` + Severity *util.MemberType `xml:"severity,omitempty"` + ThreatName *string `xml:"threat-name,omitempty"` + VendorId *util.MemberType `xml:"vendor-id,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RulesActionXml struct { + Alert *RulesActionAlertXml `xml:"alert,omitempty"` + Allow *RulesActionAllowXml `xml:"allow,omitempty"` + BlockIp *RulesActionBlockIpXml `xml:"block-ip,omitempty"` + Default *RulesActionDefaultXml `xml:"default,omitempty"` + Drop *RulesActionDropXml `xml:"drop,omitempty"` + ResetBoth *RulesActionResetBothXml `xml:"reset-both,omitempty"` + ResetClient *RulesActionResetClientXml `xml:"reset-client,omitempty"` + ResetServer *RulesActionResetServerXml `xml:"reset-server,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RulesActionAlertXml struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionAllowXml struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionBlockIpXml struct { + Duration *int64 `xml:"duration,omitempty"` + TrackBy *string `xml:"track-by,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RulesActionDefaultXml struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionDropXml struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionResetBothXml struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionResetClientXml struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionResetServerXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionXml struct { + Action *ThreatExceptionActionXml `xml:"action,omitempty"` + ExemptIp []ThreatExceptionExemptIpXml `xml:"exempt-ip>entry,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + PacketCapture *string `xml:"packet-capture,omitempty"` + TimeAttribute *ThreatExceptionTimeAttributeXml `xml:"time-attribute,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionXml struct { + Alert *ThreatExceptionActionAlertXml `xml:"alert,omitempty"` + Allow *ThreatExceptionActionAllowXml `xml:"allow,omitempty"` + BlockIp *ThreatExceptionActionBlockIpXml `xml:"block-ip,omitempty"` + Default *ThreatExceptionActionDefaultXml `xml:"default,omitempty"` + Drop *ThreatExceptionActionDropXml `xml:"drop,omitempty"` + ResetBoth *ThreatExceptionActionResetBothXml `xml:"reset-both,omitempty"` + ResetClient *ThreatExceptionActionResetClientXml `xml:"reset-client,omitempty"` + ResetServer *ThreatExceptionActionResetServerXml `xml:"reset-server,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionAlertXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionAllowXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionBlockIpXml struct { + Duration *int64 `xml:"duration,omitempty"` + TrackBy *string `xml:"track-by,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionDefaultXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionDropXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionResetBothXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionResetClientXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionResetServerXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionExemptIpXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionTimeAttributeXml struct { + Interval *int64 `xml:"interval,omitempty"` + Threshold *int64 `xml:"threshold,omitempty"` + TrackBy *string `xml:"track-by,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "cloud_inline_analysis" || v == "CloudInlineAnalysis" { + return e.CloudInlineAnalysis, nil + } + if v == "description" || v == "Description" { + return e.Description, nil + } + if v == "disable_override" || v == "DisableOverride" { + return e.DisableOverride, nil + } + if v == "inline_exception_edl_url" || v == "InlineExceptionEdlUrl" { + return e.InlineExceptionEdlUrl, nil + } + if v == "inline_exception_edl_url|LENGTH" || v == "InlineExceptionEdlUrl|LENGTH" { + return int64(len(e.InlineExceptionEdlUrl)), nil + } + if v == "inline_exception_ip_address" || v == "InlineExceptionIpAddress" { + return e.InlineExceptionIpAddress, nil + } + if v == "inline_exception_ip_address|LENGTH" || v == "InlineExceptionIpAddress|LENGTH" { + return int64(len(e.InlineExceptionIpAddress)), nil + } + if v == "mica_engine_vulnerability_enabled" || v == "MicaEngineVulnerabilityEnabled" { + return e.MicaEngineVulnerabilityEnabled, nil + } + if v == "mica_engine_vulnerability_enabled|LENGTH" || v == "MicaEngineVulnerabilityEnabled|LENGTH" { + return int64(len(e.MicaEngineVulnerabilityEnabled)), nil + } + if v == "rules" || v == "Rules" { + return e.Rules, nil + } + if v == "rules|LENGTH" || v == "Rules|LENGTH" { + return int64(len(e.Rules)), nil + } + if v == "threat_exception" || v == "ThreatException" { + return e.ThreatException, nil + } + if v == "threat_exception|LENGTH" || v == "ThreatException|LENGTH" { + return int64(len(e.ThreatException)), nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.CloudInlineAnalysis = util.YesNo(o.CloudInlineAnalysis, nil) + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + entry.InlineExceptionEdlUrl = util.StrToMem(o.InlineExceptionEdlUrl) + entry.InlineExceptionIpAddress = util.StrToMem(o.InlineExceptionIpAddress) + var nestedMicaEngineVulnerabilityEnabledCol []MicaEngineVulnerabilityEnabledXml + if o.MicaEngineVulnerabilityEnabled != nil { + nestedMicaEngineVulnerabilityEnabledCol = []MicaEngineVulnerabilityEnabledXml{} + for _, oMicaEngineVulnerabilityEnabled := range o.MicaEngineVulnerabilityEnabled { + nestedMicaEngineVulnerabilityEnabled := MicaEngineVulnerabilityEnabledXml{} + if _, ok := o.Misc["MicaEngineVulnerabilityEnabled"]; ok { + nestedMicaEngineVulnerabilityEnabled.Misc = o.Misc["MicaEngineVulnerabilityEnabled"] + } + if oMicaEngineVulnerabilityEnabled.Name != "" { + nestedMicaEngineVulnerabilityEnabled.Name = oMicaEngineVulnerabilityEnabled.Name + } + if oMicaEngineVulnerabilityEnabled.InlinePolicyAction != nil { + nestedMicaEngineVulnerabilityEnabled.InlinePolicyAction = oMicaEngineVulnerabilityEnabled.InlinePolicyAction + } + nestedMicaEngineVulnerabilityEnabledCol = append(nestedMicaEngineVulnerabilityEnabledCol, nestedMicaEngineVulnerabilityEnabled) + } + entry.MicaEngineVulnerabilityEnabled = nestedMicaEngineVulnerabilityEnabledCol + } + + var nestedRulesCol []RulesXml + if o.Rules != nil { + nestedRulesCol = []RulesXml{} + for _, oRules := range o.Rules { + nestedRules := RulesXml{} + if _, ok := o.Misc["Rules"]; ok { + nestedRules.Misc = o.Misc["Rules"] + } + if oRules.Severity != nil { + nestedRules.Severity = util.StrToMem(oRules.Severity) + } + if oRules.Name != "" { + nestedRules.Name = oRules.Name + } + if oRules.Host != nil { + nestedRules.Host = oRules.Host + } + if oRules.PacketCapture != nil { + nestedRules.PacketCapture = oRules.PacketCapture + } + if oRules.VendorId != nil { + nestedRules.VendorId = util.StrToMem(oRules.VendorId) + } + if oRules.Action != nil { + nestedRules.Action = &RulesActionXml{} + if _, ok := o.Misc["RulesAction"]; ok { + nestedRules.Action.Misc = o.Misc["RulesAction"] + } + if oRules.Action.ResetBoth != nil { + nestedRules.Action.ResetBoth = &RulesActionResetBothXml{} + if _, ok := o.Misc["RulesActionResetBoth"]; ok { + nestedRules.Action.ResetBoth.Misc = o.Misc["RulesActionResetBoth"] + } + } + if oRules.Action.BlockIp != nil { + nestedRules.Action.BlockIp = &RulesActionBlockIpXml{} + if _, ok := o.Misc["RulesActionBlockIp"]; ok { + nestedRules.Action.BlockIp.Misc = o.Misc["RulesActionBlockIp"] + } + if oRules.Action.BlockIp.TrackBy != nil { + nestedRules.Action.BlockIp.TrackBy = oRules.Action.BlockIp.TrackBy + } + if oRules.Action.BlockIp.Duration != nil { + nestedRules.Action.BlockIp.Duration = oRules.Action.BlockIp.Duration + } + } + if oRules.Action.Default != nil { + nestedRules.Action.Default = &RulesActionDefaultXml{} + if _, ok := o.Misc["RulesActionDefault"]; ok { + nestedRules.Action.Default.Misc = o.Misc["RulesActionDefault"] + } + } + if oRules.Action.Allow != nil { + nestedRules.Action.Allow = &RulesActionAllowXml{} + if _, ok := o.Misc["RulesActionAllow"]; ok { + nestedRules.Action.Allow.Misc = o.Misc["RulesActionAllow"] + } + } + if oRules.Action.Alert != nil { + nestedRules.Action.Alert = &RulesActionAlertXml{} + if _, ok := o.Misc["RulesActionAlert"]; ok { + nestedRules.Action.Alert.Misc = o.Misc["RulesActionAlert"] + } + } + if oRules.Action.Drop != nil { + nestedRules.Action.Drop = &RulesActionDropXml{} + if _, ok := o.Misc["RulesActionDrop"]; ok { + nestedRules.Action.Drop.Misc = o.Misc["RulesActionDrop"] + } + } + if oRules.Action.ResetClient != nil { + nestedRules.Action.ResetClient = &RulesActionResetClientXml{} + if _, ok := o.Misc["RulesActionResetClient"]; ok { + nestedRules.Action.ResetClient.Misc = o.Misc["RulesActionResetClient"] + } + } + if oRules.Action.ResetServer != nil { + nestedRules.Action.ResetServer = &RulesActionResetServerXml{} + if _, ok := o.Misc["RulesActionResetServer"]; ok { + nestedRules.Action.ResetServer.Misc = o.Misc["RulesActionResetServer"] + } + } + } + if oRules.ThreatName != nil { + nestedRules.ThreatName = oRules.ThreatName + } + if oRules.Category != nil { + nestedRules.Category = oRules.Category + } + if oRules.Cve != nil { + nestedRules.Cve = util.StrToMem(oRules.Cve) + } + nestedRulesCol = append(nestedRulesCol, nestedRules) + } + entry.Rules = nestedRulesCol + } + + var nestedThreatExceptionCol []ThreatExceptionXml + if o.ThreatException != nil { + nestedThreatExceptionCol = []ThreatExceptionXml{} + for _, oThreatException := range o.ThreatException { + nestedThreatException := ThreatExceptionXml{} + if _, ok := o.Misc["ThreatException"]; ok { + nestedThreatException.Misc = o.Misc["ThreatException"] + } + if oThreatException.ExemptIp != nil { + nestedThreatException.ExemptIp = []ThreatExceptionExemptIpXml{} + for _, oThreatExceptionExemptIp := range oThreatException.ExemptIp { + nestedThreatExceptionExemptIp := ThreatExceptionExemptIpXml{} + if _, ok := o.Misc["ThreatExceptionExemptIp"]; ok { + nestedThreatExceptionExemptIp.Misc = o.Misc["ThreatExceptionExemptIp"] + } + if oThreatExceptionExemptIp.Name != "" { + nestedThreatExceptionExemptIp.Name = oThreatExceptionExemptIp.Name + } + nestedThreatException.ExemptIp = append(nestedThreatException.ExemptIp, nestedThreatExceptionExemptIp) + } + } + if oThreatException.Name != "" { + nestedThreatException.Name = oThreatException.Name + } + if oThreatException.PacketCapture != nil { + nestedThreatException.PacketCapture = oThreatException.PacketCapture + } + if oThreatException.Action != nil { + nestedThreatException.Action = &ThreatExceptionActionXml{} + if _, ok := o.Misc["ThreatExceptionAction"]; ok { + nestedThreatException.Action.Misc = o.Misc["ThreatExceptionAction"] + } + if oThreatException.Action.ResetBoth != nil { + nestedThreatException.Action.ResetBoth = &ThreatExceptionActionResetBothXml{} + if _, ok := o.Misc["ThreatExceptionActionResetBoth"]; ok { + nestedThreatException.Action.ResetBoth.Misc = o.Misc["ThreatExceptionActionResetBoth"] + } + } + if oThreatException.Action.BlockIp != nil { + nestedThreatException.Action.BlockIp = &ThreatExceptionActionBlockIpXml{} + if _, ok := o.Misc["ThreatExceptionActionBlockIp"]; ok { + nestedThreatException.Action.BlockIp.Misc = o.Misc["ThreatExceptionActionBlockIp"] + } + if oThreatException.Action.BlockIp.TrackBy != nil { + nestedThreatException.Action.BlockIp.TrackBy = oThreatException.Action.BlockIp.TrackBy + } + if oThreatException.Action.BlockIp.Duration != nil { + nestedThreatException.Action.BlockIp.Duration = oThreatException.Action.BlockIp.Duration + } + } + if oThreatException.Action.Default != nil { + nestedThreatException.Action.Default = &ThreatExceptionActionDefaultXml{} + if _, ok := o.Misc["ThreatExceptionActionDefault"]; ok { + nestedThreatException.Action.Default.Misc = o.Misc["ThreatExceptionActionDefault"] + } + } + if oThreatException.Action.Allow != nil { + nestedThreatException.Action.Allow = &ThreatExceptionActionAllowXml{} + if _, ok := o.Misc["ThreatExceptionActionAllow"]; ok { + nestedThreatException.Action.Allow.Misc = o.Misc["ThreatExceptionActionAllow"] + } + } + if oThreatException.Action.Alert != nil { + nestedThreatException.Action.Alert = &ThreatExceptionActionAlertXml{} + if _, ok := o.Misc["ThreatExceptionActionAlert"]; ok { + nestedThreatException.Action.Alert.Misc = o.Misc["ThreatExceptionActionAlert"] + } + } + if oThreatException.Action.Drop != nil { + nestedThreatException.Action.Drop = &ThreatExceptionActionDropXml{} + if _, ok := o.Misc["ThreatExceptionActionDrop"]; ok { + nestedThreatException.Action.Drop.Misc = o.Misc["ThreatExceptionActionDrop"] + } + } + if oThreatException.Action.ResetClient != nil { + nestedThreatException.Action.ResetClient = &ThreatExceptionActionResetClientXml{} + if _, ok := o.Misc["ThreatExceptionActionResetClient"]; ok { + nestedThreatException.Action.ResetClient.Misc = o.Misc["ThreatExceptionActionResetClient"] + } + } + if oThreatException.Action.ResetServer != nil { + nestedThreatException.Action.ResetServer = &ThreatExceptionActionResetServerXml{} + if _, ok := o.Misc["ThreatExceptionActionResetServer"]; ok { + nestedThreatException.Action.ResetServer.Misc = o.Misc["ThreatExceptionActionResetServer"] + } + } + } + if oThreatException.TimeAttribute != nil { + nestedThreatException.TimeAttribute = &ThreatExceptionTimeAttributeXml{} + if _, ok := o.Misc["ThreatExceptionTimeAttribute"]; ok { + nestedThreatException.TimeAttribute.Misc = o.Misc["ThreatExceptionTimeAttribute"] + } + if oThreatException.TimeAttribute.Interval != nil { + nestedThreatException.TimeAttribute.Interval = oThreatException.TimeAttribute.Interval + } + if oThreatException.TimeAttribute.Threshold != nil { + nestedThreatException.TimeAttribute.Threshold = oThreatException.TimeAttribute.Threshold + } + if oThreatException.TimeAttribute.TrackBy != nil { + nestedThreatException.TimeAttribute.TrackBy = oThreatException.TimeAttribute.TrackBy + } + } + nestedThreatExceptionCol = append(nestedThreatExceptionCol, nestedThreatException) + } + entry.ThreatException = nestedThreatExceptionCol + } + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.CloudInlineAnalysis = util.AsBool(o.CloudInlineAnalysis, nil) + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + entry.InlineExceptionEdlUrl = util.MemToStr(o.InlineExceptionEdlUrl) + entry.InlineExceptionIpAddress = util.MemToStr(o.InlineExceptionIpAddress) + var nestedMicaEngineVulnerabilityEnabledCol []MicaEngineVulnerabilityEnabled + if o.MicaEngineVulnerabilityEnabled != nil { + nestedMicaEngineVulnerabilityEnabledCol = []MicaEngineVulnerabilityEnabled{} + for _, oMicaEngineVulnerabilityEnabled := range o.MicaEngineVulnerabilityEnabled { + nestedMicaEngineVulnerabilityEnabled := MicaEngineVulnerabilityEnabled{} + if oMicaEngineVulnerabilityEnabled.Misc != nil { + entry.Misc["MicaEngineVulnerabilityEnabled"] = oMicaEngineVulnerabilityEnabled.Misc + } + if oMicaEngineVulnerabilityEnabled.InlinePolicyAction != nil { + nestedMicaEngineVulnerabilityEnabled.InlinePolicyAction = oMicaEngineVulnerabilityEnabled.InlinePolicyAction + } + if oMicaEngineVulnerabilityEnabled.Name != "" { + nestedMicaEngineVulnerabilityEnabled.Name = oMicaEngineVulnerabilityEnabled.Name + } + nestedMicaEngineVulnerabilityEnabledCol = append(nestedMicaEngineVulnerabilityEnabledCol, nestedMicaEngineVulnerabilityEnabled) + } + entry.MicaEngineVulnerabilityEnabled = nestedMicaEngineVulnerabilityEnabledCol + } + + var nestedRulesCol []Rules + if o.Rules != nil { + nestedRulesCol = []Rules{} + for _, oRules := range o.Rules { + nestedRules := Rules{} + if oRules.Misc != nil { + entry.Misc["Rules"] = oRules.Misc + } + if oRules.Name != "" { + nestedRules.Name = oRules.Name + } + if oRules.Host != nil { + nestedRules.Host = oRules.Host + } + if oRules.PacketCapture != nil { + nestedRules.PacketCapture = oRules.PacketCapture + } + if oRules.VendorId != nil { + nestedRules.VendorId = util.MemToStr(oRules.VendorId) + } + if oRules.Severity != nil { + nestedRules.Severity = util.MemToStr(oRules.Severity) + } + if oRules.ThreatName != nil { + nestedRules.ThreatName = oRules.ThreatName + } + if oRules.Category != nil { + nestedRules.Category = oRules.Category + } + if oRules.Cve != nil { + nestedRules.Cve = util.MemToStr(oRules.Cve) + } + if oRules.Action != nil { + nestedRules.Action = &RulesAction{} + if oRules.Action.Misc != nil { + entry.Misc["RulesAction"] = oRules.Action.Misc + } + if oRules.Action.ResetClient != nil { + nestedRules.Action.ResetClient = &RulesActionResetClient{} + if oRules.Action.ResetClient.Misc != nil { + entry.Misc["RulesActionResetClient"] = oRules.Action.ResetClient.Misc + } + } + if oRules.Action.ResetServer != nil { + nestedRules.Action.ResetServer = &RulesActionResetServer{} + if oRules.Action.ResetServer.Misc != nil { + entry.Misc["RulesActionResetServer"] = oRules.Action.ResetServer.Misc + } + } + if oRules.Action.ResetBoth != nil { + nestedRules.Action.ResetBoth = &RulesActionResetBoth{} + if oRules.Action.ResetBoth.Misc != nil { + entry.Misc["RulesActionResetBoth"] = oRules.Action.ResetBoth.Misc + } + } + if oRules.Action.BlockIp != nil { + nestedRules.Action.BlockIp = &RulesActionBlockIp{} + if oRules.Action.BlockIp.Misc != nil { + entry.Misc["RulesActionBlockIp"] = oRules.Action.BlockIp.Misc + } + if oRules.Action.BlockIp.TrackBy != nil { + nestedRules.Action.BlockIp.TrackBy = oRules.Action.BlockIp.TrackBy + } + if oRules.Action.BlockIp.Duration != nil { + nestedRules.Action.BlockIp.Duration = oRules.Action.BlockIp.Duration + } + } + if oRules.Action.Default != nil { + nestedRules.Action.Default = &RulesActionDefault{} + if oRules.Action.Default.Misc != nil { + entry.Misc["RulesActionDefault"] = oRules.Action.Default.Misc + } + } + if oRules.Action.Allow != nil { + nestedRules.Action.Allow = &RulesActionAllow{} + if oRules.Action.Allow.Misc != nil { + entry.Misc["RulesActionAllow"] = oRules.Action.Allow.Misc + } + } + if oRules.Action.Alert != nil { + nestedRules.Action.Alert = &RulesActionAlert{} + if oRules.Action.Alert.Misc != nil { + entry.Misc["RulesActionAlert"] = oRules.Action.Alert.Misc + } + } + if oRules.Action.Drop != nil { + nestedRules.Action.Drop = &RulesActionDrop{} + if oRules.Action.Drop.Misc != nil { + entry.Misc["RulesActionDrop"] = oRules.Action.Drop.Misc + } + } + } + nestedRulesCol = append(nestedRulesCol, nestedRules) + } + entry.Rules = nestedRulesCol + } + + var nestedThreatExceptionCol []ThreatException + if o.ThreatException != nil { + nestedThreatExceptionCol = []ThreatException{} + for _, oThreatException := range o.ThreatException { + nestedThreatException := ThreatException{} + if oThreatException.Misc != nil { + entry.Misc["ThreatException"] = oThreatException.Misc + } + if oThreatException.PacketCapture != nil { + nestedThreatException.PacketCapture = oThreatException.PacketCapture + } + if oThreatException.Action != nil { + nestedThreatException.Action = &ThreatExceptionAction{} + if oThreatException.Action.Misc != nil { + entry.Misc["ThreatExceptionAction"] = oThreatException.Action.Misc + } + if oThreatException.Action.Alert != nil { + nestedThreatException.Action.Alert = &ThreatExceptionActionAlert{} + if oThreatException.Action.Alert.Misc != nil { + entry.Misc["ThreatExceptionActionAlert"] = oThreatException.Action.Alert.Misc + } + } + if oThreatException.Action.Drop != nil { + nestedThreatException.Action.Drop = &ThreatExceptionActionDrop{} + if oThreatException.Action.Drop.Misc != nil { + entry.Misc["ThreatExceptionActionDrop"] = oThreatException.Action.Drop.Misc + } + } + if oThreatException.Action.ResetClient != nil { + nestedThreatException.Action.ResetClient = &ThreatExceptionActionResetClient{} + if oThreatException.Action.ResetClient.Misc != nil { + entry.Misc["ThreatExceptionActionResetClient"] = oThreatException.Action.ResetClient.Misc + } + } + if oThreatException.Action.ResetServer != nil { + nestedThreatException.Action.ResetServer = &ThreatExceptionActionResetServer{} + if oThreatException.Action.ResetServer.Misc != nil { + entry.Misc["ThreatExceptionActionResetServer"] = oThreatException.Action.ResetServer.Misc + } + } + if oThreatException.Action.ResetBoth != nil { + nestedThreatException.Action.ResetBoth = &ThreatExceptionActionResetBoth{} + if oThreatException.Action.ResetBoth.Misc != nil { + entry.Misc["ThreatExceptionActionResetBoth"] = oThreatException.Action.ResetBoth.Misc + } + } + if oThreatException.Action.BlockIp != nil { + nestedThreatException.Action.BlockIp = &ThreatExceptionActionBlockIp{} + if oThreatException.Action.BlockIp.Misc != nil { + entry.Misc["ThreatExceptionActionBlockIp"] = oThreatException.Action.BlockIp.Misc + } + if oThreatException.Action.BlockIp.TrackBy != nil { + nestedThreatException.Action.BlockIp.TrackBy = oThreatException.Action.BlockIp.TrackBy + } + if oThreatException.Action.BlockIp.Duration != nil { + nestedThreatException.Action.BlockIp.Duration = oThreatException.Action.BlockIp.Duration + } + } + if oThreatException.Action.Default != nil { + nestedThreatException.Action.Default = &ThreatExceptionActionDefault{} + if oThreatException.Action.Default.Misc != nil { + entry.Misc["ThreatExceptionActionDefault"] = oThreatException.Action.Default.Misc + } + } + if oThreatException.Action.Allow != nil { + nestedThreatException.Action.Allow = &ThreatExceptionActionAllow{} + if oThreatException.Action.Allow.Misc != nil { + entry.Misc["ThreatExceptionActionAllow"] = oThreatException.Action.Allow.Misc + } + } + } + if oThreatException.TimeAttribute != nil { + nestedThreatException.TimeAttribute = &ThreatExceptionTimeAttribute{} + if oThreatException.TimeAttribute.Misc != nil { + entry.Misc["ThreatExceptionTimeAttribute"] = oThreatException.TimeAttribute.Misc + } + if oThreatException.TimeAttribute.Interval != nil { + nestedThreatException.TimeAttribute.Interval = oThreatException.TimeAttribute.Interval + } + if oThreatException.TimeAttribute.Threshold != nil { + nestedThreatException.TimeAttribute.Threshold = oThreatException.TimeAttribute.Threshold + } + if oThreatException.TimeAttribute.TrackBy != nil { + nestedThreatException.TimeAttribute.TrackBy = oThreatException.TimeAttribute.TrackBy + } + } + if oThreatException.ExemptIp != nil { + nestedThreatException.ExemptIp = []ThreatExceptionExemptIp{} + for _, oThreatExceptionExemptIp := range oThreatException.ExemptIp { + nestedThreatExceptionExemptIp := ThreatExceptionExemptIp{} + if oThreatExceptionExemptIp.Misc != nil { + entry.Misc["ThreatExceptionExemptIp"] = oThreatExceptionExemptIp.Misc + } + if oThreatExceptionExemptIp.Name != "" { + nestedThreatExceptionExemptIp.Name = oThreatExceptionExemptIp.Name + } + nestedThreatException.ExemptIp = append(nestedThreatException.ExemptIp, nestedThreatExceptionExemptIp) + } + } + if oThreatException.Name != "" { + nestedThreatException.Name = oThreatException.Name + } + nestedThreatExceptionCol = append(nestedThreatExceptionCol, nestedThreatException) + } + entry.ThreatException = nestedThreatExceptionCol + } + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.BoolsMatch(a.CloudInlineAnalysis, b.CloudInlineAnalysis) { + return false + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { + return false + } + if !util.OrderedListsMatch(a.InlineExceptionEdlUrl, b.InlineExceptionEdlUrl) { + return false + } + if !util.OrderedListsMatch(a.InlineExceptionIpAddress, b.InlineExceptionIpAddress) { + return false + } + if !matchMicaEngineVulnerabilityEnabled(a.MicaEngineVulnerabilityEnabled, b.MicaEngineVulnerabilityEnabled) { + return false + } + if !matchRules(a.Rules, b.Rules) { + return false + } + if !matchThreatException(a.ThreatException, b.ThreatException) { + return false + } + + return true +} + +func matchThreatExceptionActionResetServer(a *ThreatExceptionActionResetServer, b *ThreatExceptionActionResetServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchThreatExceptionActionResetBoth(a *ThreatExceptionActionResetBoth, b *ThreatExceptionActionResetBoth) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchThreatExceptionActionBlockIp(a *ThreatExceptionActionBlockIp, b *ThreatExceptionActionBlockIp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.TrackBy, b.TrackBy) { + return false + } + if !util.Ints64Match(a.Duration, b.Duration) { + return false + } + return true +} +func matchThreatExceptionActionDefault(a *ThreatExceptionActionDefault, b *ThreatExceptionActionDefault) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchThreatExceptionActionAllow(a *ThreatExceptionActionAllow, b *ThreatExceptionActionAllow) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchThreatExceptionActionAlert(a *ThreatExceptionActionAlert, b *ThreatExceptionActionAlert) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchThreatExceptionActionDrop(a *ThreatExceptionActionDrop, b *ThreatExceptionActionDrop) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchThreatExceptionActionResetClient(a *ThreatExceptionActionResetClient, b *ThreatExceptionActionResetClient) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchThreatExceptionAction(a *ThreatExceptionAction, b *ThreatExceptionAction) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchThreatExceptionActionAlert(a.Alert, b.Alert) { + return false + } + if !matchThreatExceptionActionDrop(a.Drop, b.Drop) { + return false + } + if !matchThreatExceptionActionResetClient(a.ResetClient, b.ResetClient) { + return false + } + if !matchThreatExceptionActionResetServer(a.ResetServer, b.ResetServer) { + return false + } + if !matchThreatExceptionActionResetBoth(a.ResetBoth, b.ResetBoth) { + return false + } + if !matchThreatExceptionActionBlockIp(a.BlockIp, b.BlockIp) { + return false + } + if !matchThreatExceptionActionDefault(a.Default, b.Default) { + return false + } + if !matchThreatExceptionActionAllow(a.Allow, b.Allow) { + return false + } + return true +} +func matchThreatExceptionTimeAttribute(a *ThreatExceptionTimeAttribute, b *ThreatExceptionTimeAttribute) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.Ints64Match(a.Interval, b.Interval) { + return false + } + if !util.Ints64Match(a.Threshold, b.Threshold) { + return false + } + if !util.StringsMatch(a.TrackBy, b.TrackBy) { + return false + } + return true +} +func matchThreatExceptionExemptIp(a []ThreatExceptionExemptIp, b []ThreatExceptionExemptIp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchThreatException(a []ThreatException, b []ThreatException) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.PacketCapture, b.PacketCapture) { + return false + } + if !matchThreatExceptionAction(a.Action, b.Action) { + return false + } + if !matchThreatExceptionTimeAttribute(a.TimeAttribute, b.TimeAttribute) { + return false + } + if !matchThreatExceptionExemptIp(a.ExemptIp, b.ExemptIp) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchMicaEngineVulnerabilityEnabled(a []MicaEngineVulnerabilityEnabled, b []MicaEngineVulnerabilityEnabled) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.InlinePolicyAction, b.InlinePolicyAction) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchRulesActionResetBoth(a *RulesActionResetBoth, b *RulesActionResetBoth) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRulesActionBlockIp(a *RulesActionBlockIp, b *RulesActionBlockIp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.TrackBy, b.TrackBy) { + return false + } + if !util.Ints64Match(a.Duration, b.Duration) { + return false + } + return true +} +func matchRulesActionDefault(a *RulesActionDefault, b *RulesActionDefault) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRulesActionAllow(a *RulesActionAllow, b *RulesActionAllow) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRulesActionAlert(a *RulesActionAlert, b *RulesActionAlert) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRulesActionDrop(a *RulesActionDrop, b *RulesActionDrop) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRulesActionResetClient(a *RulesActionResetClient, b *RulesActionResetClient) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRulesActionResetServer(a *RulesActionResetServer, b *RulesActionResetServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRulesAction(a *RulesAction, b *RulesAction) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchRulesActionResetServer(a.ResetServer, b.ResetServer) { + return false + } + if !matchRulesActionResetBoth(a.ResetBoth, b.ResetBoth) { + return false + } + if !matchRulesActionBlockIp(a.BlockIp, b.BlockIp) { + return false + } + if !matchRulesActionDefault(a.Default, b.Default) { + return false + } + if !matchRulesActionAllow(a.Allow, b.Allow) { + return false + } + if !matchRulesActionAlert(a.Alert, b.Alert) { + return false + } + if !matchRulesActionDrop(a.Drop, b.Drop) { + return false + } + if !matchRulesActionResetClient(a.ResetClient, b.ResetClient) { + return false + } + return true +} +func matchRules(a []Rules, b []Rules) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.Host, b.Host) { + return false + } + if !util.StringsMatch(a.PacketCapture, b.PacketCapture) { + return false + } + if !util.OrderedListsMatch(a.VendorId, b.VendorId) { + return false + } + if !util.OrderedListsMatch(a.Severity, b.Severity) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.ThreatName, b.ThreatName) { + return false + } + if !util.StringsMatch(a.Category, b.Category) { + return false + } + if !util.OrderedListsMatch(a.Cve, b.Cve) { + return false + } + if !matchRulesAction(a.Action, b.Action) { + return false + } + } + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/objects/profiles/vulnerability/interfaces.go b/objects/profiles/vulnerability/interfaces.go new file mode 100644 index 00000000..b7550aa6 --- /dev/null +++ b/objects/profiles/vulnerability/interfaces.go @@ -0,0 +1,7 @@ +package vulnerability + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/objects/profiles/vulnerability/location.go b/objects/profiles/vulnerability/location.go new file mode 100644 index 00000000..cc4bfebe --- /dev/null +++ b/objects/profiles/vulnerability/location.go @@ -0,0 +1,118 @@ +package vulnerability + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared bool `json:"shared"` +} + +type DeviceGroupLocation struct { + DeviceGroup string `json:"device_group"` + PanoramaDevice string `json:"panorama_device"` +} + +func NewDeviceGroupLocation() *Location { + return &Location{DeviceGroup: &DeviceGroupLocation{ + DeviceGroup: "", + PanoramaDevice: "localhost.localdomain", + }, + } +} +func NewSharedLocation() *Location { + return &Location{ + Shared: true, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + count++ + case o.Shared: + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return nil, fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.DeviceGroup.PanoramaDevice}), + "device-group", + util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), + } + case o.Shared: + ans = []string{ + "config", + "shared", + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/objects/profiles/vulnerability/service.go b/objects/profiles/vulnerability/service.go new file mode 100644 index 00000000..70c72778 --- /dev/null +++ b/objects/profiles/vulnerability/service.go @@ -0,0 +1,281 @@ +package vulnerability + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/objects/profiles/wildfireanalysis/entry.go b/objects/profiles/wildfireanalysis/entry.go new file mode 100644 index 00000000..54170a86 --- /dev/null +++ b/objects/profiles/wildfireanalysis/entry.go @@ -0,0 +1,224 @@ +package wildfireanalysis + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"profiles", "wildfire-analysis"} +) + +type Entry struct { + Name string + Description *string + DisableOverride *string + Rules []Rules + + Misc map[string][]generic.Xml +} + +type Rules struct { + Analysis *string + Application []string + Direction *string + FileType []string + Name string +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Description *string `xml:"description,omitempty"` + DisableOverride *string `xml:"disable-override,omitempty"` + Rules []RulesXml `xml:"rules>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RulesXml struct { + Analysis *string `xml:"analysis,omitempty"` + Application *util.MemberType `xml:"application,omitempty"` + Direction *string `xml:"direction,omitempty"` + FileType *util.MemberType `xml:"file-type,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "description" || v == "Description" { + return e.Description, nil + } + if v == "disable_override" || v == "DisableOverride" { + return e.DisableOverride, nil + } + if v == "rules" || v == "Rules" { + return e.Rules, nil + } + if v == "rules|LENGTH" || v == "Rules|LENGTH" { + return int64(len(e.Rules)), nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + var nestedRulesCol []RulesXml + if o.Rules != nil { + nestedRulesCol = []RulesXml{} + for _, oRules := range o.Rules { + nestedRules := RulesXml{} + if _, ok := o.Misc["Rules"]; ok { + nestedRules.Misc = o.Misc["Rules"] + } + if oRules.Direction != nil { + nestedRules.Direction = oRules.Direction + } + if oRules.Analysis != nil { + nestedRules.Analysis = oRules.Analysis + } + if oRules.Name != "" { + nestedRules.Name = oRules.Name + } + if oRules.Application != nil { + nestedRules.Application = util.StrToMem(oRules.Application) + } + if oRules.FileType != nil { + nestedRules.FileType = util.StrToMem(oRules.FileType) + } + nestedRulesCol = append(nestedRulesCol, nestedRules) + } + entry.Rules = nestedRulesCol + } + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + var nestedRulesCol []Rules + if o.Rules != nil { + nestedRulesCol = []Rules{} + for _, oRules := range o.Rules { + nestedRules := Rules{} + if oRules.Misc != nil { + entry.Misc["Rules"] = oRules.Misc + } + if oRules.Name != "" { + nestedRules.Name = oRules.Name + } + if oRules.Application != nil { + nestedRules.Application = util.MemToStr(oRules.Application) + } + if oRules.FileType != nil { + nestedRules.FileType = util.MemToStr(oRules.FileType) + } + if oRules.Direction != nil { + nestedRules.Direction = oRules.Direction + } + if oRules.Analysis != nil { + nestedRules.Analysis = oRules.Analysis + } + nestedRulesCol = append(nestedRulesCol, nestedRules) + } + entry.Rules = nestedRulesCol + } + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { + return false + } + if !matchRules(a.Rules, b.Rules) { + return false + } + + return true +} + +func matchRules(a []Rules, b []Rules) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.OrderedListsMatch(a.Application, b.Application) { + return false + } + if !util.OrderedListsMatch(a.FileType, b.FileType) { + return false + } + if !util.StringsMatch(a.Direction, b.Direction) { + return false + } + if !util.StringsMatch(a.Analysis, b.Analysis) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/objects/profiles/wildfireanalysis/interfaces.go b/objects/profiles/wildfireanalysis/interfaces.go new file mode 100644 index 00000000..b5be1783 --- /dev/null +++ b/objects/profiles/wildfireanalysis/interfaces.go @@ -0,0 +1,7 @@ +package wildfireanalysis + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/objects/profiles/wildfireanalysis/location.go b/objects/profiles/wildfireanalysis/location.go new file mode 100644 index 00000000..d602b43a --- /dev/null +++ b/objects/profiles/wildfireanalysis/location.go @@ -0,0 +1,118 @@ +package wildfireanalysis + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared bool `json:"shared"` +} + +type DeviceGroupLocation struct { + DeviceGroup string `json:"device_group"` + PanoramaDevice string `json:"panorama_device"` +} + +func NewDeviceGroupLocation() *Location { + return &Location{DeviceGroup: &DeviceGroupLocation{ + DeviceGroup: "", + PanoramaDevice: "localhost.localdomain", + }, + } +} +func NewSharedLocation() *Location { + return &Location{ + Shared: true, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + count++ + case o.Shared: + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return nil, fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.DeviceGroup.PanoramaDevice}), + "device-group", + util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), + } + case o.Shared: + ans = []string{ + "config", + "shared", + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/objects/profiles/wildfireanalysis/service.go b/objects/profiles/wildfireanalysis/service.go new file mode 100644 index 00000000..99056728 --- /dev/null +++ b/objects/profiles/wildfireanalysis/service.go @@ -0,0 +1,281 @@ +package wildfireanalysis + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/objects/service/entry.go b/objects/service/entry.go index a1a50bc3..f882fa07 100644 --- a/objects/service/entry.go +++ b/objects/service/entry.go @@ -19,10 +19,11 @@ var ( ) type Entry struct { - Name string - Description *string - Protocol *Protocol - Tags []string + Name string + Description *string + DisableOverride *string + Protocol *Protocol + Tag []string Misc map[string][]generic.Xml } @@ -32,9 +33,9 @@ type Protocol struct { Udp *ProtocolUdp } type ProtocolTcp struct { - DestinationPort *int64 - Override *ProtocolTcpOverride - SourcePort *int64 + Override *ProtocolTcpOverride + Port *string + SourcePort *string } type ProtocolTcpOverride struct { HalfcloseTimeout *int64 @@ -42,15 +43,11 @@ type ProtocolTcpOverride struct { TimewaitTimeout *int64 } type ProtocolUdp struct { - DestinationPort *int64 - Override *ProtocolUdpOverride - SourcePort *int64 + Override *ProtocolUdpOverride + Port *string + SourcePort *string } type ProtocolUdpOverride struct { - No *string - Yes *ProtocolUdpOverrideYes -} -type ProtocolUdpOverrideYes struct { Timeout *int64 } @@ -59,15 +56,15 @@ type entryXmlContainer struct { } type entryXml struct { - XMLName xml.Name `xml:"entry"` - Name string `xml:"name,attr"` - Description *string `xml:"description,omitempty"` - Protocol *ProtocolXml `xml:"protocol,omitempty"` - Tags *util.MemberType `xml:"tag,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Description *string `xml:"description,omitempty"` + DisableOverride *string `xml:"disable-override,omitempty"` + Protocol *ProtocolXml `xml:"protocol,omitempty"` + Tag *util.MemberType `xml:"tag,omitempty"` Misc []generic.Xml `xml:",any"` } - type ProtocolXml struct { Tcp *ProtocolTcpXml `xml:"tcp,omitempty"` Udp *ProtocolUdpXml `xml:"udp,omitempty"` @@ -75,9 +72,9 @@ type ProtocolXml struct { Misc []generic.Xml `xml:",any"` } type ProtocolTcpXml struct { - DestinationPort *int64 `xml:"port,omitempty"` - Override *ProtocolTcpOverrideXml `xml:"override>yes,omitempty"` - SourcePort *int64 `xml:"source-port,omitempty"` + Override *ProtocolTcpOverrideXml `xml:"override>yes,omitempty"` + Port *string `xml:"port,omitempty"` + SourcePort *string `xml:"source-port,omitempty"` Misc []generic.Xml `xml:",any"` } @@ -89,19 +86,13 @@ type ProtocolTcpOverrideXml struct { Misc []generic.Xml `xml:",any"` } type ProtocolUdpXml struct { - DestinationPort *int64 `xml:"port,omitempty"` - Override *ProtocolUdpOverrideXml `xml:"override,omitempty"` - SourcePort *int64 `xml:"source-port,omitempty"` + Override *ProtocolUdpOverrideXml `xml:"override>yes,omitempty"` + Port *string `xml:"port,omitempty"` + SourcePort *string `xml:"source-port,omitempty"` Misc []generic.Xml `xml:",any"` } type ProtocolUdpOverrideXml struct { - No *string `xml:"no,omitempty"` - Yes *ProtocolUdpOverrideYesXml `xml:"yes,omitempty"` - - Misc []generic.Xml `xml:",any"` -} -type ProtocolUdpOverrideYesXml struct { Timeout *int64 `xml:"timeout,omitempty"` Misc []generic.Xml `xml:",any"` @@ -114,28 +105,31 @@ func (e *Entry) Field(v string) (any, error) { if v == "description" || v == "Description" { return e.Description, nil } + if v == "disable_override" || v == "DisableOverride" { + return e.DisableOverride, nil + } if v == "protocol" || v == "Protocol" { return e.Protocol, nil } - if v == "tags" || v == "Tags" { - return e.Tags, nil + if v == "tag" || v == "Tag" { + return e.Tag, nil } - if v == "tags|LENGTH" || v == "Tags|LENGTH" { - return int64(len(e.Tags)), nil + if v == "tag|LENGTH" || v == "Tag|LENGTH" { + return int64(len(e.Tag)), nil } return nil, fmt.Errorf("unknown field") } func Versioning(vn version.Number) (Specifier, Normalizer, error) { + return specifyEntry, &entryXmlContainer{}, nil } - func specifyEntry(o *Entry) (any, error) { entry := entryXml{} - entry.Name = o.Name entry.Description = o.Description + entry.DisableOverride = o.DisableOverride var nestedProtocol *ProtocolXml if o.Protocol != nil { nestedProtocol = &ProtocolXml{} @@ -147,67 +141,59 @@ func specifyEntry(o *Entry) (any, error) { if _, ok := o.Misc["ProtocolTcp"]; ok { nestedProtocol.Tcp.Misc = o.Misc["ProtocolTcp"] } - if o.Protocol.Tcp.DestinationPort != nil { - nestedProtocol.Tcp.DestinationPort = o.Protocol.Tcp.DestinationPort - } - if o.Protocol.Tcp.SourcePort != nil { - nestedProtocol.Tcp.SourcePort = o.Protocol.Tcp.SourcePort - } if o.Protocol.Tcp.Override != nil { nestedProtocol.Tcp.Override = &ProtocolTcpOverrideXml{} if _, ok := o.Misc["ProtocolTcpOverride"]; ok { nestedProtocol.Tcp.Override.Misc = o.Misc["ProtocolTcpOverride"] } - if o.Protocol.Tcp.Override.Timeout != nil { - nestedProtocol.Tcp.Override.Timeout = o.Protocol.Tcp.Override.Timeout - } if o.Protocol.Tcp.Override.HalfcloseTimeout != nil { nestedProtocol.Tcp.Override.HalfcloseTimeout = o.Protocol.Tcp.Override.HalfcloseTimeout } + if o.Protocol.Tcp.Override.Timeout != nil { + nestedProtocol.Tcp.Override.Timeout = o.Protocol.Tcp.Override.Timeout + } if o.Protocol.Tcp.Override.TimewaitTimeout != nil { nestedProtocol.Tcp.Override.TimewaitTimeout = o.Protocol.Tcp.Override.TimewaitTimeout } } + if o.Protocol.Tcp.Port != nil { + nestedProtocol.Tcp.Port = o.Protocol.Tcp.Port + } + if o.Protocol.Tcp.SourcePort != nil { + nestedProtocol.Tcp.SourcePort = o.Protocol.Tcp.SourcePort + } } if o.Protocol.Udp != nil { nestedProtocol.Udp = &ProtocolUdpXml{} if _, ok := o.Misc["ProtocolUdp"]; ok { nestedProtocol.Udp.Misc = o.Misc["ProtocolUdp"] } - if o.Protocol.Udp.DestinationPort != nil { - nestedProtocol.Udp.DestinationPort = o.Protocol.Udp.DestinationPort - } - if o.Protocol.Udp.SourcePort != nil { - nestedProtocol.Udp.SourcePort = o.Protocol.Udp.SourcePort - } if o.Protocol.Udp.Override != nil { nestedProtocol.Udp.Override = &ProtocolUdpOverrideXml{} if _, ok := o.Misc["ProtocolUdpOverride"]; ok { nestedProtocol.Udp.Override.Misc = o.Misc["ProtocolUdpOverride"] } - if o.Protocol.Udp.Override.Yes != nil { - nestedProtocol.Udp.Override.Yes = &ProtocolUdpOverrideYesXml{} - if _, ok := o.Misc["ProtocolUdpOverrideYes"]; ok { - nestedProtocol.Udp.Override.Yes.Misc = o.Misc["ProtocolUdpOverrideYes"] - } - if o.Protocol.Udp.Override.Yes.Timeout != nil { - nestedProtocol.Udp.Override.Yes.Timeout = o.Protocol.Udp.Override.Yes.Timeout - } - } - if o.Protocol.Udp.Override.No != nil { - nestedProtocol.Udp.Override.No = o.Protocol.Udp.Override.No + if o.Protocol.Udp.Override.Timeout != nil { + nestedProtocol.Udp.Override.Timeout = o.Protocol.Udp.Override.Timeout } } + if o.Protocol.Udp.Port != nil { + nestedProtocol.Udp.Port = o.Protocol.Udp.Port + } + if o.Protocol.Udp.SourcePort != nil { + nestedProtocol.Udp.SourcePort = o.Protocol.Udp.SourcePort + } } } entry.Protocol = nestedProtocol - entry.Tags = util.StrToMem(o.Tags) + entry.Tag = util.StrToMem(o.Tag) entry.Misc = o.Misc["Entry"] return entry, nil } + func (c *entryXmlContainer) Normalize() ([]*Entry, error) { entryList := make([]*Entry, 0, len(c.Answer)) for _, o := range c.Answer { @@ -216,73 +202,65 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { } entry.Name = o.Name entry.Description = o.Description + entry.DisableOverride = o.DisableOverride var nestedProtocol *Protocol if o.Protocol != nil { nestedProtocol = &Protocol{} if o.Protocol.Misc != nil { entry.Misc["Protocol"] = o.Protocol.Misc } - if o.Protocol.Udp != nil { - nestedProtocol.Udp = &ProtocolUdp{} - if o.Protocol.Udp.Misc != nil { - entry.Misc["ProtocolUdp"] = o.Protocol.Udp.Misc - } - if o.Protocol.Udp.DestinationPort != nil { - nestedProtocol.Udp.DestinationPort = o.Protocol.Udp.DestinationPort - } - if o.Protocol.Udp.SourcePort != nil { - nestedProtocol.Udp.SourcePort = o.Protocol.Udp.SourcePort - } - if o.Protocol.Udp.Override != nil { - nestedProtocol.Udp.Override = &ProtocolUdpOverride{} - if o.Protocol.Udp.Override.Misc != nil { - entry.Misc["ProtocolUdpOverride"] = o.Protocol.Udp.Override.Misc - } - if o.Protocol.Udp.Override.Yes != nil { - nestedProtocol.Udp.Override.Yes = &ProtocolUdpOverrideYes{} - if o.Protocol.Udp.Override.Yes.Misc != nil { - entry.Misc["ProtocolUdpOverrideYes"] = o.Protocol.Udp.Override.Yes.Misc - } - if o.Protocol.Udp.Override.Yes.Timeout != nil { - nestedProtocol.Udp.Override.Yes.Timeout = o.Protocol.Udp.Override.Yes.Timeout - } - } - if o.Protocol.Udp.Override.No != nil { - nestedProtocol.Udp.Override.No = o.Protocol.Udp.Override.No - } - } - } if o.Protocol.Tcp != nil { nestedProtocol.Tcp = &ProtocolTcp{} if o.Protocol.Tcp.Misc != nil { entry.Misc["ProtocolTcp"] = o.Protocol.Tcp.Misc } - if o.Protocol.Tcp.DestinationPort != nil { - nestedProtocol.Tcp.DestinationPort = o.Protocol.Tcp.DestinationPort - } - if o.Protocol.Tcp.SourcePort != nil { - nestedProtocol.Tcp.SourcePort = o.Protocol.Tcp.SourcePort - } if o.Protocol.Tcp.Override != nil { nestedProtocol.Tcp.Override = &ProtocolTcpOverride{} if o.Protocol.Tcp.Override.Misc != nil { entry.Misc["ProtocolTcpOverride"] = o.Protocol.Tcp.Override.Misc } - if o.Protocol.Tcp.Override.Timeout != nil { - nestedProtocol.Tcp.Override.Timeout = o.Protocol.Tcp.Override.Timeout - } if o.Protocol.Tcp.Override.HalfcloseTimeout != nil { nestedProtocol.Tcp.Override.HalfcloseTimeout = o.Protocol.Tcp.Override.HalfcloseTimeout } + if o.Protocol.Tcp.Override.Timeout != nil { + nestedProtocol.Tcp.Override.Timeout = o.Protocol.Tcp.Override.Timeout + } if o.Protocol.Tcp.Override.TimewaitTimeout != nil { nestedProtocol.Tcp.Override.TimewaitTimeout = o.Protocol.Tcp.Override.TimewaitTimeout } } + if o.Protocol.Tcp.Port != nil { + nestedProtocol.Tcp.Port = o.Protocol.Tcp.Port + } + if o.Protocol.Tcp.SourcePort != nil { + nestedProtocol.Tcp.SourcePort = o.Protocol.Tcp.SourcePort + } + } + if o.Protocol.Udp != nil { + nestedProtocol.Udp = &ProtocolUdp{} + if o.Protocol.Udp.Misc != nil { + entry.Misc["ProtocolUdp"] = o.Protocol.Udp.Misc + } + if o.Protocol.Udp.Override != nil { + nestedProtocol.Udp.Override = &ProtocolUdpOverride{} + if o.Protocol.Udp.Override.Misc != nil { + entry.Misc["ProtocolUdpOverride"] = o.Protocol.Udp.Override.Misc + } + if o.Protocol.Udp.Override.Timeout != nil { + nestedProtocol.Udp.Override.Timeout = o.Protocol.Udp.Override.Timeout + } + } + if o.Protocol.Udp.Port != nil { + nestedProtocol.Udp.Port = o.Protocol.Udp.Port + } + if o.Protocol.Udp.SourcePort != nil { + nestedProtocol.Udp.SourcePort = o.Protocol.Udp.SourcePort + } } } entry.Protocol = nestedProtocol - entry.Tags = util.MemToStr(o.Tags) + entry.Tag = util.MemToStr(o.Tag) entry.Misc["Entry"] = o.Misc @@ -303,10 +281,13 @@ func SpecMatches(a, b *Entry) bool { if !util.StringsMatch(a.Description, b.Description) { return false } + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { + return false + } if !matchProtocol(a.Protocol, b.Protocol) { return false } - if !util.OrderedListsMatch(a.Tags, b.Tags) { + if !util.OrderedListsMatch(a.Tag, b.Tag) { return false } @@ -319,10 +300,10 @@ func matchProtocolTcpOverride(a *ProtocolTcpOverride, b *ProtocolTcpOverride) bo } else if a == nil && b == nil { return true } - if !util.Ints64Match(a.Timeout, b.Timeout) { + if !util.Ints64Match(a.HalfcloseTimeout, b.HalfcloseTimeout) { return false } - if !util.Ints64Match(a.HalfcloseTimeout, b.HalfcloseTimeout) { + if !util.Ints64Match(a.Timeout, b.Timeout) { return false } if !util.Ints64Match(a.TimewaitTimeout, b.TimewaitTimeout) { @@ -336,24 +317,13 @@ func matchProtocolTcp(a *ProtocolTcp, b *ProtocolTcp) bool { } else if a == nil && b == nil { return true } - if !util.Ints64Match(a.DestinationPort, b.DestinationPort) { - return false - } - if !util.Ints64Match(a.SourcePort, b.SourcePort) { - return false - } if !matchProtocolTcpOverride(a.Override, b.Override) { return false } - return true -} -func matchProtocolUdpOverrideYes(a *ProtocolUdpOverrideYes, b *ProtocolUdpOverrideYes) bool { - if a == nil && b != nil || a != nil && b == nil { + if !util.StringsMatch(a.Port, b.Port) { return false - } else if a == nil && b == nil { - return true } - if !util.Ints64Match(a.Timeout, b.Timeout) { + if !util.StringsMatch(a.SourcePort, b.SourcePort) { return false } return true @@ -364,10 +334,7 @@ func matchProtocolUdpOverride(a *ProtocolUdpOverride, b *ProtocolUdpOverride) bo } else if a == nil && b == nil { return true } - if !matchProtocolUdpOverrideYes(a.Yes, b.Yes) { - return false - } - if !util.StringsMatch(a.No, b.No) { + if !util.Ints64Match(a.Timeout, b.Timeout) { return false } return true @@ -381,10 +348,10 @@ func matchProtocolUdp(a *ProtocolUdp, b *ProtocolUdp) bool { if !matchProtocolUdpOverride(a.Override, b.Override) { return false } - if !util.Ints64Match(a.DestinationPort, b.DestinationPort) { + if !util.StringsMatch(a.Port, b.Port) { return false } - if !util.Ints64Match(a.SourcePort, b.SourcePort) { + if !util.StringsMatch(a.SourcePort, b.SourcePort) { return false } return true diff --git a/objects/service/group/entry.go b/objects/service/group/entry.go index 58d2faaf..f7d2fb88 100644 --- a/objects/service/group/entry.go +++ b/objects/service/group/entry.go @@ -19,10 +19,10 @@ var ( ) type Entry struct { - Name string - Description *string - Members []string - Tags []string + Name string + DisableOverride *string + Members []string + Tag []string Misc map[string][]generic.Xml } @@ -32,11 +32,11 @@ type entryXmlContainer struct { } type entryXml struct { - XMLName xml.Name `xml:"entry"` - Name string `xml:"name,attr"` - Description *string `xml:"description,omitempty"` - Members *util.MemberType `xml:"members,omitempty"` - Tags *util.MemberType `xml:"tag,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + DisableOverride *string `xml:"disable-override,omitempty"` + Members *util.MemberType `xml:"members,omitempty"` + Tag *util.MemberType `xml:"tag,omitempty"` Misc []generic.Xml `xml:",any"` } @@ -45,8 +45,8 @@ func (e *Entry) Field(v string) (any, error) { if v == "name" || v == "Name" { return e.Name, nil } - if v == "description" || v == "Description" { - return e.Description, nil + if v == "disable_override" || v == "DisableOverride" { + return e.DisableOverride, nil } if v == "members" || v == "Members" { return e.Members, nil @@ -54,32 +54,32 @@ func (e *Entry) Field(v string) (any, error) { if v == "members|LENGTH" || v == "Members|LENGTH" { return int64(len(e.Members)), nil } - if v == "tags" || v == "Tags" { - return e.Tags, nil + if v == "tag" || v == "Tag" { + return e.Tag, nil } - if v == "tags|LENGTH" || v == "Tags|LENGTH" { - return int64(len(e.Tags)), nil + if v == "tag|LENGTH" || v == "Tag|LENGTH" { + return int64(len(e.Tag)), nil } return nil, fmt.Errorf("unknown field") } func Versioning(vn version.Number) (Specifier, Normalizer, error) { + return specifyEntry, &entryXmlContainer{}, nil } - func specifyEntry(o *Entry) (any, error) { entry := entryXml{} - entry.Name = o.Name - entry.Description = o.Description + entry.DisableOverride = o.DisableOverride entry.Members = util.StrToMem(o.Members) - entry.Tags = util.StrToMem(o.Tags) + entry.Tag = util.StrToMem(o.Tag) entry.Misc = o.Misc["Entry"] return entry, nil } + func (c *entryXmlContainer) Normalize() ([]*Entry, error) { entryList := make([]*Entry, 0, len(c.Answer)) for _, o := range c.Answer { @@ -87,9 +87,9 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { Misc: make(map[string][]generic.Xml), } entry.Name = o.Name - entry.Description = o.Description + entry.DisableOverride = o.DisableOverride entry.Members = util.MemToStr(o.Members) - entry.Tags = util.MemToStr(o.Tags) + entry.Tag = util.MemToStr(o.Tag) entry.Misc["Entry"] = o.Misc @@ -107,13 +107,13 @@ func SpecMatches(a, b *Entry) bool { } // Don't compare Name. - if !util.StringsMatch(a.Description, b.Description) { + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { return false } if !util.OrderedListsMatch(a.Members, b.Members) { return false } - if !util.OrderedListsMatch(a.Tags, b.Tags) { + if !util.OrderedListsMatch(a.Tag, b.Tag) { return false } diff --git a/objects/service/group/location.go b/objects/service/group/location.go index 204884e9..f61f6381 100644 --- a/objects/service/group/location.go +++ b/objects/service/group/location.go @@ -15,11 +15,9 @@ type ImportLocation interface { } type Location struct { - DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` - FromPanoramaShared bool `json:"from_panorama_shared"` - FromPanoramaVsys *FromPanoramaVsysLocation `json:"from_panorama_vsys,omitempty"` - Shared bool `json:"shared"` - Vsys *VsysLocation `json:"vsys,omitempty"` + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared bool `json:"shared"` + Vsys *VsysLocation `json:"vsys,omitempty"` } type DeviceGroupLocation struct { @@ -27,10 +25,6 @@ type DeviceGroupLocation struct { PanoramaDevice string `json:"panorama_device"` } -type FromPanoramaVsysLocation struct { - Vsys string `json:"vsys"` -} - type VsysLocation struct { NgfwDevice string `json:"ngfw_device"` Vsys string `json:"vsys"` @@ -43,12 +37,6 @@ func NewDeviceGroupLocation() *Location { }, } } -func NewFromPanoramaVsysLocation() *Location { - return &Location{FromPanoramaVsys: &FromPanoramaVsysLocation{ - Vsys: "vsys1", - }, - } -} func NewSharedLocation() *Location { return &Location{ Shared: true, @@ -74,13 +62,6 @@ func (o Location) IsValid() error { return fmt.Errorf("PanoramaDevice is unspecified") } count++ - case o.FromPanoramaShared: - count++ - case o.FromPanoramaVsys != nil: - if o.FromPanoramaVsys.Vsys == "" { - return fmt.Errorf("Vsys is unspecified") - } - count++ case o.Shared: count++ case o.Vsys != nil: @@ -123,22 +104,6 @@ func (o Location) XpathPrefix(vn version.Number) ([]string, error) { "device-group", util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), } - case o.FromPanoramaShared: - ans = []string{ - "config", - "panorama", - "shared", - } - case o.FromPanoramaVsys != nil: - if o.FromPanoramaVsys.Vsys == "" { - return nil, fmt.Errorf("Vsys is unspecified") - } - ans = []string{ - "config", - "panorama", - "vsys", - util.AsEntryXpath([]string{o.FromPanoramaVsys.Vsys}), - } case o.Shared: ans = []string{ "config", diff --git a/objects/service/location.go b/objects/service/location.go index 6e29a18c..ef14e0f0 100644 --- a/objects/service/location.go +++ b/objects/service/location.go @@ -15,11 +15,9 @@ type ImportLocation interface { } type Location struct { - DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` - FromPanoramaShared bool `json:"from_panorama_shared"` - FromPanoramaVsys *FromPanoramaVsysLocation `json:"from_panorama_vsys,omitempty"` - Shared bool `json:"shared"` - Vsys *VsysLocation `json:"vsys,omitempty"` + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared bool `json:"shared"` + Vsys *VsysLocation `json:"vsys,omitempty"` } type DeviceGroupLocation struct { @@ -27,10 +25,6 @@ type DeviceGroupLocation struct { PanoramaDevice string `json:"panorama_device"` } -type FromPanoramaVsysLocation struct { - Vsys string `json:"vsys"` -} - type VsysLocation struct { NgfwDevice string `json:"ngfw_device"` Vsys string `json:"vsys"` @@ -43,12 +37,6 @@ func NewDeviceGroupLocation() *Location { }, } } -func NewFromPanoramaVsysLocation() *Location { - return &Location{FromPanoramaVsys: &FromPanoramaVsysLocation{ - Vsys: "vsys1", - }, - } -} func NewSharedLocation() *Location { return &Location{ Shared: true, @@ -74,13 +62,6 @@ func (o Location) IsValid() error { return fmt.Errorf("PanoramaDevice is unspecified") } count++ - case o.FromPanoramaShared: - count++ - case o.FromPanoramaVsys != nil: - if o.FromPanoramaVsys.Vsys == "" { - return fmt.Errorf("Vsys is unspecified") - } - count++ case o.Shared: count++ case o.Vsys != nil: @@ -123,22 +104,6 @@ func (o Location) XpathPrefix(vn version.Number) ([]string, error) { "device-group", util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), } - case o.FromPanoramaShared: - ans = []string{ - "config", - "panorama", - "shared", - } - case o.FromPanoramaVsys != nil: - if o.FromPanoramaVsys.Vsys == "" { - return nil, fmt.Errorf("Vsys is unspecified") - } - ans = []string{ - "config", - "panorama", - "vsys", - util.AsEntryXpath([]string{o.FromPanoramaVsys.Vsys}), - } case o.Shared: ans = []string{ "config", diff --git a/panorama/devicegroup/entry.go b/panorama/devicegroup/entry.go new file mode 100644 index 00000000..3742cd78 --- /dev/null +++ b/panorama/devicegroup/entry.go @@ -0,0 +1,206 @@ +package devicegroup + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"device-group"} +) + +type Entry struct { + Name string + AuthorizationCode *string + Description *string + Devices []Devices + Templates []string + + Misc map[string][]generic.Xml +} + +type Devices struct { + Name string + Vsys []string +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + AuthorizationCode *string `xml:"authorization-code,omitempty"` + Description *string `xml:"description,omitempty"` + Devices []DevicesXml `xml:"devices>entry,omitempty"` + Templates *util.MemberType `xml:"reference-templates,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type DevicesXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Vsys *util.MemberType `xml:"vsys,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "authorization_code" || v == "AuthorizationCode" { + return e.AuthorizationCode, nil + } + if v == "description" || v == "Description" { + return e.Description, nil + } + if v == "devices" || v == "Devices" { + return e.Devices, nil + } + if v == "devices|LENGTH" || v == "Devices|LENGTH" { + return int64(len(e.Devices)), nil + } + if v == "templates" || v == "Templates" { + return e.Templates, nil + } + if v == "templates|LENGTH" || v == "Templates|LENGTH" { + return int64(len(e.Templates)), nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.AuthorizationCode = o.AuthorizationCode + entry.Description = o.Description + var nestedDevicesCol []DevicesXml + if o.Devices != nil { + nestedDevicesCol = []DevicesXml{} + for _, oDevices := range o.Devices { + nestedDevices := DevicesXml{} + if _, ok := o.Misc["Devices"]; ok { + nestedDevices.Misc = o.Misc["Devices"] + } + if oDevices.Vsys != nil { + nestedDevices.Vsys = util.StrToMem(oDevices.Vsys) + } + if oDevices.Name != "" { + nestedDevices.Name = oDevices.Name + } + nestedDevicesCol = append(nestedDevicesCol, nestedDevices) + } + entry.Devices = nestedDevicesCol + } + + entry.Templates = util.StrToMem(o.Templates) + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.AuthorizationCode = o.AuthorizationCode + entry.Description = o.Description + var nestedDevicesCol []Devices + if o.Devices != nil { + nestedDevicesCol = []Devices{} + for _, oDevices := range o.Devices { + nestedDevices := Devices{} + if oDevices.Misc != nil { + entry.Misc["Devices"] = oDevices.Misc + } + if oDevices.Vsys != nil { + nestedDevices.Vsys = util.MemToStr(oDevices.Vsys) + } + if oDevices.Name != "" { + nestedDevices.Name = oDevices.Name + } + nestedDevicesCol = append(nestedDevicesCol, nestedDevices) + } + entry.Devices = nestedDevicesCol + } + + entry.Templates = util.MemToStr(o.Templates) + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.StringsMatch(a.AuthorizationCode, b.AuthorizationCode) { + return false + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !matchDevices(a.Devices, b.Devices) { + return false + } + if !util.OrderedListsMatch(a.Templates, b.Templates) { + return false + } + + return true +} + +func matchDevices(a []Devices, b []Devices) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.OrderedListsMatch(a.Vsys, b.Vsys) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/panorama/devicegroup/interfaces.go b/panorama/devicegroup/interfaces.go new file mode 100644 index 00000000..6bbf8f76 --- /dev/null +++ b/panorama/devicegroup/interfaces.go @@ -0,0 +1,7 @@ +package devicegroup + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/panorama/devicegroup/location.go b/panorama/devicegroup/location.go new file mode 100644 index 00000000..bd906cb4 --- /dev/null +++ b/panorama/devicegroup/location.go @@ -0,0 +1,95 @@ +package devicegroup + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + Panorama *PanoramaLocation `json:"panorama,omitempty"` +} + +type PanoramaLocation struct { + PanoramaDevice string `json:"panorama_device"` +} + +func NewPanoramaLocation() *Location { + return &Location{Panorama: &PanoramaLocation{ + PanoramaDevice: "localhost.localdomain", + }, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.Panorama != nil: + if o.Panorama.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.Panorama != nil: + if o.Panorama.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Panorama.PanoramaDevice}), + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/panorama/devicegroup/service.go b/panorama/devicegroup/service.go new file mode 100644 index 00000000..ea732c41 --- /dev/null +++ b/panorama/devicegroup/service.go @@ -0,0 +1,281 @@ +package devicegroup + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/panorama/template/entry.go b/panorama/template/entry.go index 97a9cede..0331d628 100644 --- a/panorama/template/entry.go +++ b/panorama/template/entry.go @@ -58,7 +58,6 @@ type entryXml struct { Misc []generic.Xml `xml:",any"` } - type ConfigXml struct { Devices []ConfigDevicesXml `xml:"devices>entry,omitempty"` @@ -107,12 +106,11 @@ func (e *Entry) Field(v string) (any, error) { } func Versioning(vn version.Number) (Specifier, Normalizer, error) { + return specifyEntry, &entryXmlContainer{}, nil } - func specifyEntry(o *Entry) (any, error) { entry := entryXml{} - entry.Name = o.Name var nestedConfig *ConfigXml if o.Config != nil { @@ -127,9 +125,6 @@ func specifyEntry(o *Entry) (any, error) { if _, ok := o.Misc["ConfigDevices"]; ok { nestedConfigDevices.Misc = o.Misc["ConfigDevices"] } - if oConfigDevices.Name != "" { - nestedConfigDevices.Name = oConfigDevices.Name - } if oConfigDevices.Vsys != nil { nestedConfigDevices.Vsys = []ConfigDevicesVsysXml{} for _, oConfigDevicesVsys := range oConfigDevices.Vsys { @@ -158,6 +153,9 @@ func specifyEntry(o *Entry) (any, error) { nestedConfigDevices.Vsys = append(nestedConfigDevices.Vsys, nestedConfigDevicesVsys) } } + if oConfigDevices.Name != "" { + nestedConfigDevices.Name = oConfigDevices.Name + } nestedConfig.Devices = append(nestedConfig.Devices, nestedConfigDevices) } } @@ -171,6 +169,7 @@ func specifyEntry(o *Entry) (any, error) { return entry, nil } + func (c *entryXmlContainer) Normalize() ([]*Entry, error) { entryList := make([]*Entry, 0, len(c.Answer)) for _, o := range c.Answer { @@ -198,9 +197,6 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { if oConfigDevicesVsys.Misc != nil { entry.Misc["ConfigDevicesVsys"] = oConfigDevicesVsys.Misc } - if oConfigDevicesVsys.Name != "" { - nestedConfigDevicesVsys.Name = oConfigDevicesVsys.Name - } if oConfigDevicesVsys.Import != nil { nestedConfigDevicesVsys.Import = &ConfigDevicesVsysImport{} if oConfigDevicesVsys.Import.Misc != nil { @@ -216,6 +212,9 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { } } } + if oConfigDevicesVsys.Name != "" { + nestedConfigDevicesVsys.Name = oConfigDevicesVsys.Name + } nestedConfigDevices.Vsys = append(nestedConfigDevices.Vsys, nestedConfigDevicesVsys) } } @@ -290,10 +289,10 @@ func matchConfigDevicesVsys(a []ConfigDevicesVsys, b []ConfigDevicesVsys) bool { } for _, a := range a { for _, b := range b { - if !util.StringsEqual(a.Name, b.Name) { + if !matchConfigDevicesVsysImport(a.Import, b.Import) { return false } - if !matchConfigDevicesVsysImport(a.Import, b.Import) { + if !util.StringsEqual(a.Name, b.Name) { return false } } diff --git a/panorama/template_stack/entry.go b/panorama/template_stack/entry.go index e5a38e42..a7c09f01 100644 --- a/panorama/template_stack/entry.go +++ b/panorama/template_stack/entry.go @@ -48,7 +48,6 @@ type entryXml struct { Misc []generic.Xml `xml:",any"` } - type UserGroupSourceXml struct { MasterDevice *string `xml:"master-device,omitempty"` @@ -85,12 +84,11 @@ func (e *Entry) Field(v string) (any, error) { } func Versioning(vn version.Number) (Specifier, Normalizer, error) { + return specifyEntry, &entryXmlContainer{}, nil } - func specifyEntry(o *Entry) (any, error) { entry := entryXml{} - entry.Name = o.Name entry.DefaultVsys = o.DefaultVsys entry.Description = o.Description @@ -112,6 +110,7 @@ func specifyEntry(o *Entry) (any, error) { return entry, nil } + func (c *entryXmlContainer) Normalize() ([]*Entry, error) { entryList := make([]*Entry, 0, len(c.Answer)) for _, o := range c.Answer { diff --git a/panorama/template_variable/entry.go b/panorama/template_variable/entry.go index 1db348c9..2466c521 100644 --- a/panorama/template_variable/entry.go +++ b/panorama/template_variable/entry.go @@ -52,7 +52,6 @@ type entryXml struct { Misc []generic.Xml `xml:",any"` } - type TypeXml struct { AsNumber *string `xml:"as-number,omitempty"` DeviceId *string `xml:"device-id,omitempty"` @@ -84,12 +83,11 @@ func (e *Entry) Field(v string) (any, error) { } func Versioning(vn version.Number) (Specifier, Normalizer, error) { + return specifyEntry, &entryXmlContainer{}, nil } - func specifyEntry(o *Entry) (any, error) { entry := entryXml{} - entry.Name = o.Name entry.Description = o.Description var nestedType *TypeXml @@ -98,9 +96,18 @@ func specifyEntry(o *Entry) (any, error) { if _, ok := o.Misc["Type"]; ok { nestedType.Misc = o.Misc["Type"] } + if o.Type.EgressMax != nil { + nestedType.EgressMax = o.Type.EgressMax + } + if o.Type.IpNetmask != nil { + nestedType.IpNetmask = o.Type.IpNetmask + } if o.Type.Fqdn != nil { nestedType.Fqdn = o.Type.Fqdn } + if o.Type.GroupId != nil { + nestedType.GroupId = o.Type.GroupId + } if o.Type.DevicePriority != nil { nestedType.DevicePriority = o.Type.DevicePriority } @@ -110,27 +117,18 @@ func specifyEntry(o *Entry) (any, error) { if o.Type.Interface != nil { nestedType.Interface = o.Type.Interface } - if o.Type.EgressMax != nil { - nestedType.EgressMax = o.Type.EgressMax + if o.Type.QosProfile != nil { + nestedType.QosProfile = o.Type.QosProfile } if o.Type.IpRange != nil { nestedType.IpRange = o.Type.IpRange } - if o.Type.GroupId != nil { - nestedType.GroupId = o.Type.GroupId - } if o.Type.AsNumber != nil { nestedType.AsNumber = o.Type.AsNumber } - if o.Type.QosProfile != nil { - nestedType.QosProfile = o.Type.QosProfile - } if o.Type.LinkTag != nil { nestedType.LinkTag = o.Type.LinkTag } - if o.Type.IpNetmask != nil { - nestedType.IpNetmask = o.Type.IpNetmask - } } entry.Type = nestedType @@ -138,6 +136,7 @@ func specifyEntry(o *Entry) (any, error) { return entry, nil } + func (c *entryXmlContainer) Normalize() ([]*Entry, error) { entryList := make([]*Entry, 0, len(c.Answer)) for _, o := range c.Answer { @@ -152,18 +151,9 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { if o.Type.Misc != nil { entry.Misc["Type"] = o.Type.Misc } - if o.Type.IpNetmask != nil { - nestedType.IpNetmask = o.Type.IpNetmask - } - if o.Type.GroupId != nil { - nestedType.GroupId = o.Type.GroupId - } if o.Type.AsNumber != nil { nestedType.AsNumber = o.Type.AsNumber } - if o.Type.QosProfile != nil { - nestedType.QosProfile = o.Type.QosProfile - } if o.Type.LinkTag != nil { nestedType.LinkTag = o.Type.LinkTag } @@ -173,6 +163,9 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { if o.Type.Fqdn != nil { nestedType.Fqdn = o.Type.Fqdn } + if o.Type.GroupId != nil { + nestedType.GroupId = o.Type.GroupId + } if o.Type.DevicePriority != nil { nestedType.DevicePriority = o.Type.DevicePriority } @@ -182,9 +175,15 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { if o.Type.Interface != nil { nestedType.Interface = o.Type.Interface } + if o.Type.QosProfile != nil { + nestedType.QosProfile = o.Type.QosProfile + } if o.Type.EgressMax != nil { nestedType.EgressMax = o.Type.EgressMax } + if o.Type.IpNetmask != nil { + nestedType.IpNetmask = o.Type.IpNetmask + } } entry.Type = nestedType @@ -220,37 +219,37 @@ func matchType(a *Type, b *Type) bool { } else if a == nil && b == nil { return true } - if !util.StringsMatch(a.IpNetmask, b.IpNetmask) { + if !util.StringsMatch(a.EgressMax, b.EgressMax) { return false } - if !util.StringsMatch(a.GroupId, b.GroupId) { + if !util.StringsMatch(a.IpNetmask, b.IpNetmask) { return false } - if !util.StringsMatch(a.AsNumber, b.AsNumber) { + if !util.StringsMatch(a.Fqdn, b.Fqdn) { return false } - if !util.StringsMatch(a.QosProfile, b.QosProfile) { + if !util.StringsMatch(a.GroupId, b.GroupId) { return false } - if !util.StringsMatch(a.LinkTag, b.LinkTag) { + if !util.StringsMatch(a.DevicePriority, b.DevicePriority) { return false } - if !util.StringsMatch(a.IpRange, b.IpRange) { + if !util.StringsMatch(a.DeviceId, b.DeviceId) { return false } - if !util.StringsMatch(a.Fqdn, b.Fqdn) { + if !util.StringsMatch(a.Interface, b.Interface) { return false } - if !util.StringsMatch(a.DevicePriority, b.DevicePriority) { + if !util.StringsMatch(a.QosProfile, b.QosProfile) { return false } - if !util.StringsMatch(a.DeviceId, b.DeviceId) { + if !util.StringsMatch(a.IpRange, b.IpRange) { return false } - if !util.StringsMatch(a.Interface, b.Interface) { + if !util.StringsMatch(a.AsNumber, b.AsNumber) { return false } - if !util.StringsMatch(a.EgressMax, b.EgressMax) { + if !util.StringsMatch(a.LinkTag, b.LinkTag) { return false } return true diff --git a/policies/rules/decryption/const.go b/policies/rules/decryption/const.go new file mode 100644 index 00000000..d0105745 --- /dev/null +++ b/policies/rules/decryption/const.go @@ -0,0 +1,3 @@ +package decryption + +const RuleType = "decryption" diff --git a/policies/rules/decryption/entry.go b/policies/rules/decryption/entry.go new file mode 100644 index 00000000..f5e7a7ec --- /dev/null +++ b/policies/rules/decryption/entry.go @@ -0,0 +1,666 @@ +package decryption + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"decryption", "rules"} +) + +type Entry struct { + Name string + Action *string + Category []string + Description *string + Destination []string + DestinationHip []string + Disabled *bool + From []string + GroupTag *string + LogFail *bool + LogSetting *string + LogSuccess *bool + NegateDestination *bool + NegateSource *bool + PacketBrokerProfile *string + Profile *string + Service []string + Source []string + SourceHip []string + SourceUser []string + Tag []string + Target *Target + To []string + Type *Type + Uuid *string + + Misc map[string][]generic.Xml +} + +type Target struct { + Devices []TargetDevices + Negate *bool + Tags []string +} +type TargetDevices struct { + Name string + Vsys []TargetDevicesVsys +} +type TargetDevicesVsys struct { + Name string +} +type Type struct { + SshProxy *TypeSshProxy + SslForwardProxy *TypeSslForwardProxy + SslInboundInspection *TypeSslInboundInspection +} +type TypeSshProxy struct { +} +type TypeSslForwardProxy struct { +} +type TypeSslInboundInspection struct { + Certificates []string +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Action *string `xml:"action,omitempty"` + Category *util.MemberType `xml:"category,omitempty"` + Description *string `xml:"description,omitempty"` + Destination *util.MemberType `xml:"destination,omitempty"` + DestinationHip *util.MemberType `xml:"destination-hip,omitempty"` + Disabled *string `xml:"disabled,omitempty"` + From *util.MemberType `xml:"from,omitempty"` + GroupTag *string `xml:"group-tag,omitempty"` + LogFail *string `xml:"log-fail,omitempty"` + LogSetting *string `xml:"log-setting,omitempty"` + LogSuccess *string `xml:"log-success,omitempty"` + NegateDestination *string `xml:"negate-destination,omitempty"` + NegateSource *string `xml:"negate-source,omitempty"` + PacketBrokerProfile *string `xml:"packet-broker-profile,omitempty"` + Profile *string `xml:"profile,omitempty"` + Service *util.MemberType `xml:"service,omitempty"` + Source *util.MemberType `xml:"source,omitempty"` + SourceHip *util.MemberType `xml:"source-hip,omitempty"` + SourceUser *util.MemberType `xml:"source-user,omitempty"` + Tag *util.MemberType `xml:"tag,omitempty"` + Target *TargetXml `xml:"target,omitempty"` + To *util.MemberType `xml:"to,omitempty"` + Type *TypeXml `xml:"type,omitempty"` + Uuid *string `xml:"uuid,attr,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TargetXml struct { + Devices []TargetDevicesXml `xml:"devices>entry,omitempty"` + Negate *string `xml:"negate,omitempty"` + Tags *util.MemberType `xml:"tags,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TargetDevicesXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Vsys []TargetDevicesVsysXml `xml:"vsys>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TargetDevicesVsysXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type TypeXml struct { + SshProxy *TypeSshProxyXml `xml:"ssh-proxy,omitempty"` + SslForwardProxy *TypeSslForwardProxyXml `xml:"ssl-forward-proxy,omitempty"` + SslInboundInspection *TypeSslInboundInspectionXml `xml:"ssl-inbound-inspection,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TypeSshProxyXml struct { + Misc []generic.Xml `xml:",any"` +} +type TypeSslForwardProxyXml struct { + Misc []generic.Xml `xml:",any"` +} +type TypeSslInboundInspectionXml struct { + Certificates *util.MemberType `xml:"certificates,omitempty"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "action" || v == "Action" { + return e.Action, nil + } + if v == "category" || v == "Category" { + return e.Category, nil + } + if v == "category|LENGTH" || v == "Category|LENGTH" { + return int64(len(e.Category)), nil + } + if v == "description" || v == "Description" { + return e.Description, nil + } + if v == "destination" || v == "Destination" { + return e.Destination, nil + } + if v == "destination|LENGTH" || v == "Destination|LENGTH" { + return int64(len(e.Destination)), nil + } + if v == "destination_hip" || v == "DestinationHip" { + return e.DestinationHip, nil + } + if v == "destination_hip|LENGTH" || v == "DestinationHip|LENGTH" { + return int64(len(e.DestinationHip)), nil + } + if v == "disabled" || v == "Disabled" { + return e.Disabled, nil + } + if v == "from" || v == "From" { + return e.From, nil + } + if v == "from|LENGTH" || v == "From|LENGTH" { + return int64(len(e.From)), nil + } + if v == "group_tag" || v == "GroupTag" { + return e.GroupTag, nil + } + if v == "log_fail" || v == "LogFail" { + return e.LogFail, nil + } + if v == "log_setting" || v == "LogSetting" { + return e.LogSetting, nil + } + if v == "log_success" || v == "LogSuccess" { + return e.LogSuccess, nil + } + if v == "negate_destination" || v == "NegateDestination" { + return e.NegateDestination, nil + } + if v == "negate_source" || v == "NegateSource" { + return e.NegateSource, nil + } + if v == "packet_broker_profile" || v == "PacketBrokerProfile" { + return e.PacketBrokerProfile, nil + } + if v == "profile" || v == "Profile" { + return e.Profile, nil + } + if v == "service" || v == "Service" { + return e.Service, nil + } + if v == "service|LENGTH" || v == "Service|LENGTH" { + return int64(len(e.Service)), nil + } + if v == "source" || v == "Source" { + return e.Source, nil + } + if v == "source|LENGTH" || v == "Source|LENGTH" { + return int64(len(e.Source)), nil + } + if v == "source_hip" || v == "SourceHip" { + return e.SourceHip, nil + } + if v == "source_hip|LENGTH" || v == "SourceHip|LENGTH" { + return int64(len(e.SourceHip)), nil + } + if v == "source_user" || v == "SourceUser" { + return e.SourceUser, nil + } + if v == "source_user|LENGTH" || v == "SourceUser|LENGTH" { + return int64(len(e.SourceUser)), nil + } + if v == "tag" || v == "Tag" { + return e.Tag, nil + } + if v == "tag|LENGTH" || v == "Tag|LENGTH" { + return int64(len(e.Tag)), nil + } + if v == "target" || v == "Target" { + return e.Target, nil + } + if v == "to" || v == "To" { + return e.To, nil + } + if v == "to|LENGTH" || v == "To|LENGTH" { + return int64(len(e.To)), nil + } + if v == "type" || v == "Type" { + return e.Type, nil + } + if v == "uuid" || v == "Uuid" { + return e.Uuid, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.Action = o.Action + entry.Category = util.StrToMem(o.Category) + entry.Description = o.Description + entry.Destination = util.StrToMem(o.Destination) + entry.DestinationHip = util.StrToMem(o.DestinationHip) + entry.Disabled = util.YesNo(o.Disabled, nil) + entry.From = util.StrToMem(o.From) + entry.GroupTag = o.GroupTag + entry.LogFail = util.YesNo(o.LogFail, nil) + entry.LogSetting = o.LogSetting + entry.LogSuccess = util.YesNo(o.LogSuccess, nil) + entry.NegateDestination = util.YesNo(o.NegateDestination, nil) + entry.NegateSource = util.YesNo(o.NegateSource, nil) + entry.PacketBrokerProfile = o.PacketBrokerProfile + entry.Profile = o.Profile + entry.Service = util.StrToMem(o.Service) + entry.Source = util.StrToMem(o.Source) + entry.SourceHip = util.StrToMem(o.SourceHip) + entry.SourceUser = util.StrToMem(o.SourceUser) + entry.Tag = util.StrToMem(o.Tag) + var nestedTarget *TargetXml + if o.Target != nil { + nestedTarget = &TargetXml{} + if _, ok := o.Misc["Target"]; ok { + nestedTarget.Misc = o.Misc["Target"] + } + if o.Target.Negate != nil { + nestedTarget.Negate = util.YesNo(o.Target.Negate, nil) + } + if o.Target.Tags != nil { + nestedTarget.Tags = util.StrToMem(o.Target.Tags) + } + if o.Target.Devices != nil { + nestedTarget.Devices = []TargetDevicesXml{} + for _, oTargetDevices := range o.Target.Devices { + nestedTargetDevices := TargetDevicesXml{} + if _, ok := o.Misc["TargetDevices"]; ok { + nestedTargetDevices.Misc = o.Misc["TargetDevices"] + } + if oTargetDevices.Vsys != nil { + nestedTargetDevices.Vsys = []TargetDevicesVsysXml{} + for _, oTargetDevicesVsys := range oTargetDevices.Vsys { + nestedTargetDevicesVsys := TargetDevicesVsysXml{} + if _, ok := o.Misc["TargetDevicesVsys"]; ok { + nestedTargetDevicesVsys.Misc = o.Misc["TargetDevicesVsys"] + } + if oTargetDevicesVsys.Name != "" { + nestedTargetDevicesVsys.Name = oTargetDevicesVsys.Name + } + nestedTargetDevices.Vsys = append(nestedTargetDevices.Vsys, nestedTargetDevicesVsys) + } + } + if oTargetDevices.Name != "" { + nestedTargetDevices.Name = oTargetDevices.Name + } + nestedTarget.Devices = append(nestedTarget.Devices, nestedTargetDevices) + } + } + } + entry.Target = nestedTarget + + entry.To = util.StrToMem(o.To) + var nestedType *TypeXml + if o.Type != nil { + nestedType = &TypeXml{} + if _, ok := o.Misc["Type"]; ok { + nestedType.Misc = o.Misc["Type"] + } + if o.Type.SshProxy != nil { + nestedType.SshProxy = &TypeSshProxyXml{} + if _, ok := o.Misc["TypeSshProxy"]; ok { + nestedType.SshProxy.Misc = o.Misc["TypeSshProxy"] + } + } + if o.Type.SslForwardProxy != nil { + nestedType.SslForwardProxy = &TypeSslForwardProxyXml{} + if _, ok := o.Misc["TypeSslForwardProxy"]; ok { + nestedType.SslForwardProxy.Misc = o.Misc["TypeSslForwardProxy"] + } + } + if o.Type.SslInboundInspection != nil { + nestedType.SslInboundInspection = &TypeSslInboundInspectionXml{} + if _, ok := o.Misc["TypeSslInboundInspection"]; ok { + nestedType.SslInboundInspection.Misc = o.Misc["TypeSslInboundInspection"] + } + if o.Type.SslInboundInspection.Certificates != nil { + nestedType.SslInboundInspection.Certificates = util.StrToMem(o.Type.SslInboundInspection.Certificates) + } + } + } + entry.Type = nestedType + + entry.Uuid = o.Uuid + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.Action = o.Action + entry.Category = util.MemToStr(o.Category) + entry.Description = o.Description + entry.Destination = util.MemToStr(o.Destination) + entry.DestinationHip = util.MemToStr(o.DestinationHip) + entry.Disabled = util.AsBool(o.Disabled, nil) + entry.From = util.MemToStr(o.From) + entry.GroupTag = o.GroupTag + entry.LogFail = util.AsBool(o.LogFail, nil) + entry.LogSetting = o.LogSetting + entry.LogSuccess = util.AsBool(o.LogSuccess, nil) + entry.NegateDestination = util.AsBool(o.NegateDestination, nil) + entry.NegateSource = util.AsBool(o.NegateSource, nil) + entry.PacketBrokerProfile = o.PacketBrokerProfile + entry.Profile = o.Profile + entry.Service = util.MemToStr(o.Service) + entry.Source = util.MemToStr(o.Source) + entry.SourceHip = util.MemToStr(o.SourceHip) + entry.SourceUser = util.MemToStr(o.SourceUser) + entry.Tag = util.MemToStr(o.Tag) + var nestedTarget *Target + if o.Target != nil { + nestedTarget = &Target{} + if o.Target.Misc != nil { + entry.Misc["Target"] = o.Target.Misc + } + if o.Target.Devices != nil { + nestedTarget.Devices = []TargetDevices{} + for _, oTargetDevices := range o.Target.Devices { + nestedTargetDevices := TargetDevices{} + if oTargetDevices.Misc != nil { + entry.Misc["TargetDevices"] = oTargetDevices.Misc + } + if oTargetDevices.Vsys != nil { + nestedTargetDevices.Vsys = []TargetDevicesVsys{} + for _, oTargetDevicesVsys := range oTargetDevices.Vsys { + nestedTargetDevicesVsys := TargetDevicesVsys{} + if oTargetDevicesVsys.Misc != nil { + entry.Misc["TargetDevicesVsys"] = oTargetDevicesVsys.Misc + } + if oTargetDevicesVsys.Name != "" { + nestedTargetDevicesVsys.Name = oTargetDevicesVsys.Name + } + nestedTargetDevices.Vsys = append(nestedTargetDevices.Vsys, nestedTargetDevicesVsys) + } + } + if oTargetDevices.Name != "" { + nestedTargetDevices.Name = oTargetDevices.Name + } + nestedTarget.Devices = append(nestedTarget.Devices, nestedTargetDevices) + } + } + if o.Target.Negate != nil { + nestedTarget.Negate = util.AsBool(o.Target.Negate, nil) + } + if o.Target.Tags != nil { + nestedTarget.Tags = util.MemToStr(o.Target.Tags) + } + } + entry.Target = nestedTarget + + entry.To = util.MemToStr(o.To) + var nestedType *Type + if o.Type != nil { + nestedType = &Type{} + if o.Type.Misc != nil { + entry.Misc["Type"] = o.Type.Misc + } + if o.Type.SshProxy != nil { + nestedType.SshProxy = &TypeSshProxy{} + if o.Type.SshProxy.Misc != nil { + entry.Misc["TypeSshProxy"] = o.Type.SshProxy.Misc + } + } + if o.Type.SslForwardProxy != nil { + nestedType.SslForwardProxy = &TypeSslForwardProxy{} + if o.Type.SslForwardProxy.Misc != nil { + entry.Misc["TypeSslForwardProxy"] = o.Type.SslForwardProxy.Misc + } + } + if o.Type.SslInboundInspection != nil { + nestedType.SslInboundInspection = &TypeSslInboundInspection{} + if o.Type.SslInboundInspection.Misc != nil { + entry.Misc["TypeSslInboundInspection"] = o.Type.SslInboundInspection.Misc + } + if o.Type.SslInboundInspection.Certificates != nil { + nestedType.SslInboundInspection.Certificates = util.MemToStr(o.Type.SslInboundInspection.Certificates) + } + } + } + entry.Type = nestedType + + entry.Uuid = o.Uuid + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.OrderedListsMatch(a.Category, b.Category) { + return false + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.OrderedListsMatch(a.Destination, b.Destination) { + return false + } + if !util.OrderedListsMatch(a.DestinationHip, b.DestinationHip) { + return false + } + if !util.BoolsMatch(a.Disabled, b.Disabled) { + return false + } + if !util.OrderedListsMatch(a.From, b.From) { + return false + } + if !util.StringsMatch(a.GroupTag, b.GroupTag) { + return false + } + if !util.BoolsMatch(a.LogFail, b.LogFail) { + return false + } + if !util.StringsMatch(a.LogSetting, b.LogSetting) { + return false + } + if !util.BoolsMatch(a.LogSuccess, b.LogSuccess) { + return false + } + if !util.BoolsMatch(a.NegateDestination, b.NegateDestination) { + return false + } + if !util.BoolsMatch(a.NegateSource, b.NegateSource) { + return false + } + if !util.StringsMatch(a.PacketBrokerProfile, b.PacketBrokerProfile) { + return false + } + if !util.StringsMatch(a.Profile, b.Profile) { + return false + } + if !util.OrderedListsMatch(a.Service, b.Service) { + return false + } + if !util.OrderedListsMatch(a.Source, b.Source) { + return false + } + if !util.OrderedListsMatch(a.SourceHip, b.SourceHip) { + return false + } + if !util.OrderedListsMatch(a.SourceUser, b.SourceUser) { + return false + } + if !util.OrderedListsMatch(a.Tag, b.Tag) { + return false + } + if !matchTarget(a.Target, b.Target) { + return false + } + if !util.OrderedListsMatch(a.To, b.To) { + return false + } + if !matchType(a.Type, b.Type) { + return false + } + if !util.StringsMatch(a.Uuid, b.Uuid) { + return false + } + + return true +} + +func matchTargetDevicesVsys(a []TargetDevicesVsys, b []TargetDevicesVsys) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchTargetDevices(a []TargetDevices, b []TargetDevices) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !matchTargetDevicesVsys(a.Vsys, b.Vsys) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchTarget(a *Target, b *Target) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchTargetDevices(a.Devices, b.Devices) { + return false + } + if !util.BoolsMatch(a.Negate, b.Negate) { + return false + } + if !util.OrderedListsMatch(a.Tags, b.Tags) { + return false + } + return true +} +func matchTypeSslForwardProxy(a *TypeSslForwardProxy, b *TypeSslForwardProxy) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchTypeSslInboundInspection(a *TypeSslInboundInspection, b *TypeSslInboundInspection) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.OrderedListsMatch(a.Certificates, b.Certificates) { + return false + } + return true +} +func matchTypeSshProxy(a *TypeSshProxy, b *TypeSshProxy) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchType(a *Type, b *Type) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchTypeSshProxy(a.SshProxy, b.SshProxy) { + return false + } + if !matchTypeSslForwardProxy(a.SslForwardProxy, b.SslForwardProxy) { + return false + } + if !matchTypeSslInboundInspection(a.SslInboundInspection, b.SslInboundInspection) { + return false + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} +func (o *Entry) EntryUuid() *string { + return o.Uuid +} + +func (o *Entry) SetEntryUuid(uuid *string) { + o.Uuid = uuid +} diff --git a/policies/rules/decryption/interfaces.go b/policies/rules/decryption/interfaces.go new file mode 100644 index 00000000..940e86ee --- /dev/null +++ b/policies/rules/decryption/interfaces.go @@ -0,0 +1,7 @@ +package decryption + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/policies/rules/decryption/location.go b/policies/rules/decryption/location.go new file mode 100644 index 00000000..0c55cf29 --- /dev/null +++ b/policies/rules/decryption/location.go @@ -0,0 +1,175 @@ +package decryption + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared *SharedLocation `json:"shared,omitempty"` + Vsys *VsysLocation `json:"vsys,omitempty"` +} + +type DeviceGroupLocation struct { + DeviceGroup string `json:"device_group"` + PanoramaDevice string `json:"panorama_device"` + Rulebase string `json:"rulebase"` +} + +type SharedLocation struct { + Rulebase string `json:"rulebase"` +} + +type VsysLocation struct { + NgfwDevice string `json:"ngfw_device"` + Vsys string `json:"vsys"` +} + +func NewDeviceGroupLocation() *Location { + return &Location{DeviceGroup: &DeviceGroupLocation{ + DeviceGroup: "", + PanoramaDevice: "localhost.localdomain", + Rulebase: "pre-rulebase", + }, + } +} +func NewSharedLocation() *Location { + return &Location{Shared: &SharedLocation{ + Rulebase: "pre-rulebase", + }, + } +} +func NewVsysLocation() *Location { + return &Location{Vsys: &VsysLocation{ + NgfwDevice: "localhost.localdomain", + Vsys: "vsys1", + }, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.DeviceGroup.Rulebase == "" { + return fmt.Errorf("Rulebase is unspecified") + } + count++ + case o.Shared != nil: + if o.Shared.Rulebase == "" { + return fmt.Errorf("Rulebase is unspecified") + } + count++ + case o.Vsys != nil: + if o.Vsys.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.Vsys.Vsys == "" { + return fmt.Errorf("Vsys is unspecified") + } + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return nil, fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.DeviceGroup.Rulebase == "" { + return nil, fmt.Errorf("Rulebase is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.DeviceGroup.PanoramaDevice}), + "device-group", + util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), + o.DeviceGroup.Rulebase, + } + case o.Shared != nil: + if o.Shared.Rulebase == "" { + return nil, fmt.Errorf("Rulebase is unspecified") + } + ans = []string{ + "config", + "shared", + o.Shared.Rulebase, + } + case o.Vsys != nil: + if o.Vsys.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.Vsys.Vsys == "" { + return nil, fmt.Errorf("Vsys is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Vsys.NgfwDevice}), + "vsys", + util.AsEntryXpath([]string{o.Vsys.Vsys}), + "rulebase", + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/policies/rules/decryption/service.go b/policies/rules/decryption/service.go new file mode 100644 index 00000000..da9d5641 --- /dev/null +++ b/policies/rules/decryption/service.go @@ -0,0 +1,862 @@ +package decryption + +import ( + "context" + "fmt" + "net/url" + "strings" + "time" + + "github.com/PaloAltoNetworks/pango/audit" + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/rule" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, true, false) +} + +// ReadById returns the given config object with specified ID, using the specified action ("get" or "show"). +func (s *Service) ReadById(ctx context.Context, loc Location, uuid, action string) (*Entry, error) { + return s.read(ctx, loc, uuid, action, false, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true, true) +} + +// ReadFromConfigById returns the given config object with specified ID from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfigById(ctx context.Context, loc Location, uuid string) (*Entry, error) { + return s.read(ctx, loc, uuid, "", false, true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, byName, usePanosConfig bool) (*Entry, error) { + if byName && value == "" { + return nil, errors.NameNotSpecifiedError + } + if !byName && value == "" { + return nil, errors.UuidNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + if byName { + path, err = loc.XpathWithEntryName(vn, value) + } else { + path, err = loc.XpathWithUuid(vn, value) + } + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name, true) +} + +// UpdateById updates the given config object, then returns the result. +func (s *Service) UpdateById(ctx context.Context, loc Location, entry *Entry, uuid string) (*Entry, error) { + return s.update(ctx, loc, entry, uuid, false) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string, byName bool) (*Entry, error) { + if byName && entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + if !byName && value == "" { + return nil, errors.UuidNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if byName { + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + } else { + old, err = s.ReadById(ctx, loc, value, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + if byName { + return s.Read(ctx, loc, entry.Name, "get") + } else { + return s.ReadById(ctx, loc, value, "get") + } +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name, true) +} + +// DeleteById deletes the given item with specified ID. +func (s *Service) DeleteById(ctx context.Context, loc Location, uuid ...string) error { + return s.delete(ctx, loc, uuid, false) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string, byName bool) error { + for _, value := range values { + if byName && value == "" { + return errors.NameNotSpecifiedError + } + if !byName && value == "" { + return errors.UuidNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + if byName { + path, err = loc.XpathWithEntryName(vn, value) + } else { + path, err = loc.XpathWithUuid(vn, value) + } + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} + +// MoveGroup arranges the given rules in the order specified. +// Any rule with a UUID specified is ignored. +// Only the rule names are considered for the purposes of the rule placement. +func (s *Service) MoveGroup(ctx context.Context, loc Location, position rule.Position, entries []*Entry) error { + if len(entries) == 0 { + return nil + } + + listing, err := s.List(ctx, loc, "get", "", "") + if err != nil { + return err + } else if len(listing) == 0 { + return fmt.Errorf("no rules present") + } + + rp := make(map[string]int) + for idx, live := range listing { + rp[live.Name] = idx + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(len(entries)) + + var ok, topDown bool + var otherIndex int + baseIndex := -1 + switch { + case position.First != nil && *position.First: + topDown, baseIndex, ok, err = s.moveTop(topDown, entries, baseIndex, ok, rp, loc, vn, updates) + if err != nil { + return err + } + case position.Last != nil && *position.Last: + baseIndex, ok, err = s.moveBottom(entries, baseIndex, ok, rp, listing, loc, vn, updates) + if err != nil { + return err + } + case position.SomewhereAfter != nil && *position.SomewhereAfter != "": + topDown, baseIndex, ok, otherIndex, err = s.moveSomewhereAfter(topDown, entries, baseIndex, ok, rp, otherIndex, position, loc, vn, updates) + if err != nil { + return err + } + case position.SomewhereBefore != nil && *position.SomewhereBefore != "": + baseIndex, ok, otherIndex, err = s.moveSomewhereBefore(entries, baseIndex, ok, rp, otherIndex, position, loc, vn, updates) + if err != nil { + return err + } + case position.DirectlyAfter != nil && *position.DirectlyAfter != "": + topDown, baseIndex, ok, otherIndex, err = s.moveDirectlyAfter(topDown, entries, baseIndex, ok, rp, otherIndex, position, loc, vn, updates) + if err != nil { + return err + } + case position.DirectlyBefore != nil && *position.DirectlyBefore != "": + baseIndex, ok, err = s.moveDirectlyBefore(entries, baseIndex, ok, rp, otherIndex, position, loc, vn, updates) + if err != nil { + return err + } + default: + topDown = true + target := entries[0] + + baseIndex, ok = rp[target.Name] + if !ok { + return fmt.Errorf("could not find rule %q for first positioning", target.Name) + } + } + + var prevName, where string + if topDown { + prevName = entries[0].Name + where = "after" + } else { + prevName = entries[len(entries)-1].Name + where = "before" + } + + for i := 1; i < len(entries); i++ { + err := s.moveRestOfRules(topDown, entries, i, baseIndex, rp, loc, vn, updates, where, prevName) + if err != nil { + return err + } + } + + if len(updates.Operations) > 0 { + _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil) + return err + } + + return nil +} + +func (s *Service) moveRestOfRules(topDown bool, entries []*Entry, i int, baseIndex int, rp map[string]int, loc Location, vn version.Number, updates *xmlapi.MultiConfig, where string, prevName string) error { + var target Entry + var desiredIndex int + if topDown { + target = *entries[i] + desiredIndex = baseIndex + i + } else { + target = *entries[len(entries)-1-i] + desiredIndex = baseIndex - i + } + + idx, ok := rp[target.Name] + if !ok { + return fmt.Errorf("rule %q not present", target.Name) + } + + if idx != desiredIndex { + path, err := loc.XpathWithEntryName(vn, target.Name) + if err != nil { + return err + } + + if idx < desiredIndex { + for name, val := range rp { + if val > idx && val <= desiredIndex { + rp[name] = val - 1 + } + } + } else { + for name, val := range rp { + if val < idx && val >= desiredIndex { + rp[name] = val + 1 + } + } + } + rp[target.Name] = desiredIndex + + updates.Add(&xmlapi.Config{ + Action: "move", + Xpath: util.AsXpath(path), + Where: where, + Destination: prevName, + Target: s.client.GetTarget(), + }) + } + + prevName = target.Name + return nil +} + +func (s *Service) moveDirectlyBefore(entries []*Entry, baseIndex int, ok bool, rp map[string]int, otherIndex int, position rule.Position, loc Location, vn version.Number, updates *xmlapi.MultiConfig) (int, bool, error) { + target := entries[len(entries)-1] + + baseIndex, ok = rp[target.Name] + if !ok { + return 0, false, fmt.Errorf("could not find rule %q for initial positioning", target.Name) + } + + otherIndex, ok = rp[*position.DirectlyBefore] + if !ok { + return 0, false, fmt.Errorf("could not find referenced rule %q", *position.DirectlyBefore) + } + + if baseIndex+1 != otherIndex { + path, err := loc.XpathWithEntryName(vn, target.Name) + if err != nil { + return 0, false, err + } + + for name, val := range rp { + switch { + case name == target.Name: + rp[name] = otherIndex + case val < baseIndex && val >= otherIndex: + rp[name] = val + 1 + } + } + + updates.Add(&xmlapi.Config{ + Action: "move", + Xpath: util.AsXpath(path), + Where: "before", + Destination: *position.DirectlyBefore, + Target: s.client.GetTarget(), + }) + + baseIndex = otherIndex + } + return baseIndex, ok, nil +} + +func (s *Service) moveDirectlyAfter(topDown bool, entries []*Entry, baseIndex int, ok bool, rp map[string]int, otherIndex int, position rule.Position, loc Location, vn version.Number, updates *xmlapi.MultiConfig) (bool, int, bool, int, error) { + topDown = true + target := entries[0] + + baseIndex, ok = rp[target.Name] + if !ok { + return false, 0, false, 0, fmt.Errorf("could not find rule %q for initial positioning", target.Name) + } + + otherIndex, ok = rp[*position.DirectlyAfter] + if !ok { + return false, 0, false, 0, fmt.Errorf("could not find referenced rule %q for initial positioning", *position.DirectlyAfter) + } + + if baseIndex != otherIndex+1 { + path, err := loc.XpathWithEntryName(vn, target.Name) + if err != nil { + return false, 0, false, 0, err + } + + for name, val := range rp { + switch { + case name == target.Name: + rp[name] = otherIndex + case val > baseIndex && val <= otherIndex: + rp[name] = otherIndex - 1 + } + } + + updates.Add(&xmlapi.Config{ + Action: "move", + Xpath: util.AsXpath(path), + Where: "after", + Destination: *position.DirectlyAfter, + Target: s.client.GetTarget(), + }) + + baseIndex = otherIndex + } + return topDown, baseIndex, ok, otherIndex, nil +} + +func (s *Service) moveSomewhereBefore(entries []*Entry, baseIndex int, ok bool, rp map[string]int, otherIndex int, position rule.Position, loc Location, vn version.Number, updates *xmlapi.MultiConfig) (int, bool, int, error) { + target := entries[len(entries)-1] + + baseIndex, ok = rp[target.Name] + if !ok { + return 0, false, 0, fmt.Errorf("could not find rule %q for initial positioning", target.Name) + } + + otherIndex, ok = rp[*position.SomewhereBefore] + if !ok { + return 0, false, 0, fmt.Errorf("could not find referenced rule %q", *position.SomewhereBefore) + } + + if baseIndex > otherIndex { + path, err := loc.XpathWithEntryName(vn, target.Name) + if err != nil { + return 0, false, 0, err + } + + for name, val := range rp { + switch { + case name == target.Name: + rp[name] = otherIndex + case val < baseIndex && val >= otherIndex: + rp[name] = val + 1 + } + } + + updates.Add(&xmlapi.Config{ + Action: "move", + Xpath: util.AsXpath(path), + Where: "before", + Destination: *position.SomewhereBefore, + Target: s.client.GetTarget(), + }) + + baseIndex = otherIndex + } + return baseIndex, ok, otherIndex, nil +} + +func (s *Service) moveSomewhereAfter(topDown bool, entries []*Entry, baseIndex int, ok bool, rp map[string]int, otherIndex int, position rule.Position, loc Location, vn version.Number, updates *xmlapi.MultiConfig) (bool, int, bool, int, error) { + topDown = true + target := entries[0] + + baseIndex, ok = rp[target.Name] + if !ok { + return false, 0, false, 0, fmt.Errorf("could not find rule %q for initial positioning", target.Name) + } + + otherIndex, ok = rp[*position.SomewhereAfter] + if !ok { + return false, 0, false, 0, fmt.Errorf("could not find referenced rule %q for initial positioning", *position.SomewhereAfter) + } + + if baseIndex < otherIndex { + path, err := loc.XpathWithEntryName(vn, target.Name) + if err != nil { + return false, 0, false, 0, err + } + + for name, val := range rp { + switch { + case name == target.Name: + rp[name] = otherIndex + case val > baseIndex && val <= otherIndex: + rp[name] = otherIndex - 1 + } + } + + updates.Add(&xmlapi.Config{ + Action: "move", + Xpath: util.AsXpath(path), + Where: "after", + Destination: *position.SomewhereAfter, + Target: s.client.GetTarget(), + }) + + baseIndex = otherIndex + } + return topDown, baseIndex, ok, otherIndex, nil +} + +func (s *Service) moveBottom(entries []*Entry, baseIndex int, ok bool, rp map[string]int, listing []*Entry, loc Location, vn version.Number, updates *xmlapi.MultiConfig) (int, bool, error) { + target := entries[len(entries)-1] + + baseIndex, ok = rp[target.Name] + if !ok { + return 0, false, fmt.Errorf("could not find rule %q for last positioning", target.Name) + } + + if baseIndex != len(listing)-1 { + path, err := loc.XpathWithEntryName(vn, target.Name) + if err != nil { + return 0, false, err + } + + for name, val := range rp { + switch { + case name == target.Name: + rp[name] = len(listing) - 1 + case val > baseIndex: + rp[name] = val - 1 + } + } + + // some versions of PAN-OS require that the destination always be set + var dst string + if !vn.Gte(util.FixedPanosVersionForMultiConfigMove) { + dst = "bottom" + } + + updates.Add(&xmlapi.Config{ + Action: "move", + Xpath: util.AsXpath(path), + Where: "bottom", + Destination: dst, + Target: s.client.GetTarget(), + }) + + baseIndex = len(listing) - 1 + } + return baseIndex, ok, nil +} + +func (s *Service) moveTop(topDown bool, entries []*Entry, baseIndex int, ok bool, rp map[string]int, loc Location, vn version.Number, updates *xmlapi.MultiConfig) (bool, int, bool, error) { + topDown = true + target := entries[0] + + baseIndex, ok = rp[target.Name] + if !ok { + return false, 0, false, fmt.Errorf("could not find rule %q for first positioning", target.Name) + } + + if baseIndex != 0 { + path, err := loc.XpathWithEntryName(vn, target.Name) + if err != nil { + return false, 0, false, err + } + + for name, val := range rp { + switch { + case name == entries[0].Name: + rp[name] = 0 + case val < baseIndex: + rp[name] = val + 1 + } + } + + // some versions of PAN-OS require that the destination always be set + var dst string + if !vn.Gte(util.FixedPanosVersionForMultiConfigMove) { + dst = "top" + } + + updates.Add(&xmlapi.Config{ + Action: "move", + Xpath: util.AsXpath(path), + Where: "top", + Destination: dst, + Target: s.client.GetTarget(), + }) + + baseIndex = 0 + } + return topDown, baseIndex, ok, nil +} + +// HitCount returns the hit count for the given rule. +func (s *Service) HitCount(ctx context.Context, loc Location, rules ...string) ([]util.HitCount, error) { + switch { + case loc.Vsys != nil: + cmd := &xmlapi.Op{ + Command: util.NewHitCountRequest(RuleType, loc.Vsys.Vsys, rules), + Target: s.client.GetTarget(), + } + var resp util.HitCountResponse + + if _, _, err := s.client.Communicate(ctx, cmd, false, &resp); err != nil { + return nil, err + } + + return resp.Results, nil + } + + return nil, fmt.Errorf("unsupported location") +} + +// SetAuditComment sets the given audit comment for the given rule. +func (s *Service) SetAuditComment(ctx context.Context, loc Location, name, comment string) error { + if name == "" { + return errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + path, err := loc.XpathWithEntryName(vn, name) + if err != nil { + return err + } + + cmd := &xmlapi.Op{ + Command: audit.SetComment{ + Xpath: util.AsXpath(path), + Comment: comment, + }, + Target: s.client.GetTarget(), + } + + _, _, err = s.client.Communicate(ctx, cmd, false, nil) + return err +} + +// CurrentAuditComment gets any current uncommitted audit comment for the given rule. +func (s *Service) CurrentAuditComment(ctx context.Context, loc Location, name string) (string, error) { + if name == "" { + return "", errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + path, err := loc.XpathWithEntryName(vn, name) + if err != nil { + return "", err + } + + cmd := &xmlapi.Op{ + Command: audit.GetComment{ + Xpath: util.AsXpath(path), + }, + Target: s.client.GetTarget(), + } + + var resp audit.UncommittedComment + if _, _, err = s.client.Communicate(ctx, cmd, false, &resp); err != nil { + return "", err + } + + return resp.Comment, nil +} + +// AuditCommentHistory returns a chunk of historical audit comment logs. +func (s *Service) AuditCommentHistory(ctx context.Context, loc Location, name, direction string, nlogs, skip int) ([]audit.Comment, error) { + if name == "" { + return nil, errors.NameNotSpecifiedError + } + + var err error + var base, vsysDg string + switch { + case loc.Vsys != nil: + vsysDg = loc.Vsys.Vsys + base = "rulebase" + case loc.Shared != nil: + vsysDg = "shared" + base = loc.Shared.Rulebase + case loc.DeviceGroup != nil: + vsysDg = loc.DeviceGroup.DeviceGroup + base = loc.DeviceGroup.Rulebase + } + + if vsysDg == "" || base == "" { + return nil, fmt.Errorf("unsupported location") + } + + query := strings.Join([]string{ + "(subtype eq audit-comment)", + fmt.Sprintf("(path contains '\\'%s\\'')", name), + fmt.Sprintf("(path contains '%s')", RuleType), + fmt.Sprintf("(path contains %s)", base), + fmt.Sprintf("(path contains '\\'%s\\'')", vsysDg), + }, " and ") + extras := url.Values{} + extras.Set("uniq", "yes") + + cmd := &xmlapi.Log{ + LogType: "config", + Query: query, + Direction: direction, + Nlogs: nlogs, + Skip: skip, + Extras: extras, + } + + var job util.JobResponse + if _, _, err = s.client.Communicate(ctx, cmd, false, &job); err != nil { + return nil, err + } + + var resp audit.CommentHistory + if _, err = s.client.WaitForLogs(ctx, job.Id, 1*time.Second, &resp); err != nil { + return nil, err + } + + if len(resp.Comments) != 0 { + if clock, err := s.client.Clock(ctx); err == nil { + for i := range resp.Comments { + resp.Comments[i].SetTime(clock) + } + } + } + + return resp.Comments, nil +} diff --git a/policies/rules/nat/const.go b/policies/rules/nat/const.go new file mode 100644 index 00000000..204da9ce --- /dev/null +++ b/policies/rules/nat/const.go @@ -0,0 +1,3 @@ +package nat + +const RuleType = "nat" diff --git a/policies/rules/nat/entry.go b/policies/rules/nat/entry.go new file mode 100644 index 00000000..86e99772 --- /dev/null +++ b/policies/rules/nat/entry.go @@ -0,0 +1,941 @@ +package nat + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"nat", "rules"} +) + +type Entry struct { + Name string + ActiveActiveDeviceBinding *string + Description *string + Destination []string + Disabled *bool + From []string + GroupTag *string + NatType *string + Service *string + Source []string + SourceTranslation *SourceTranslation + Tag []string + Target *Target + To []string + ToInterface *string + Uuid *string + DestinationTranslation *DestinationTranslation + DynamicDestinationTranslation *DynamicDestinationTranslation + + Misc map[string][]generic.Xml +} + +type DestinationTranslation struct { + DnsRewrite *DestinationTranslationDnsRewrite + TranslatedAddress *string + TranslatedPort *int64 +} +type DestinationTranslationDnsRewrite struct { + Direction *string +} +type DynamicDestinationTranslation struct { + Distribution *string + TranslatedAddress *string + TranslatedPort *int64 +} +type SourceTranslation struct { + DynamicIp *SourceTranslationDynamicIp + DynamicIpAndPort *SourceTranslationDynamicIpAndPort + StaticIp *SourceTranslationStaticIp +} +type SourceTranslationDynamicIp struct { + Fallback *SourceTranslationDynamicIpFallback + TranslatedAddress []string +} +type SourceTranslationDynamicIpAndPort struct { + InterfaceAddress *SourceTranslationDynamicIpAndPortInterfaceAddress + TranslatedAddress []string +} +type SourceTranslationDynamicIpAndPortInterfaceAddress struct { + Interface *string + FloatingIp *string + Ip *string +} +type SourceTranslationDynamicIpFallback struct { + InterfaceAddress *SourceTranslationDynamicIpFallbackInterfaceAddress + TranslatedAddress []string +} +type SourceTranslationDynamicIpFallbackInterfaceAddress struct { + Interface *string + FloatingIp *string + Ip *string +} +type SourceTranslationStaticIp struct { + BiDirectional *string + TranslatedAddress *string +} +type Target struct { + Devices []TargetDevices + Negate *bool + Tags []string +} +type TargetDevices struct { + Name string + Vsys []TargetDevicesVsys +} +type TargetDevicesVsys struct { + Name string +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + ActiveActiveDeviceBinding *string `xml:"active-active-device-binding,omitempty"` + Description *string `xml:"description,omitempty"` + Destination *util.MemberType `xml:"destination,omitempty"` + Disabled *string `xml:"disabled,omitempty"` + From *util.MemberType `xml:"from,omitempty"` + GroupTag *string `xml:"group-tag,omitempty"` + NatType *string `xml:"nat-type,omitempty"` + Service *string `xml:"service,omitempty"` + Source *util.MemberType `xml:"source,omitempty"` + SourceTranslation *SourceTranslationXml `xml:"source-translation,omitempty"` + Tag *util.MemberType `xml:"tag,omitempty"` + Target *TargetXml `xml:"target,omitempty"` + To *util.MemberType `xml:"to,omitempty"` + ToInterface *string `xml:"to-interface,omitempty"` + Uuid *string `xml:"uuid,attr,omitempty"` + DestinationTranslation *DestinationTranslationXml `xml:"destination-translation,omitempty"` + DynamicDestinationTranslation *DynamicDestinationTranslationXml `xml:"dynamic-destination-translation,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type DestinationTranslationXml struct { + DnsRewrite *DestinationTranslationDnsRewriteXml `xml:"dns-rewrite,omitempty"` + TranslatedAddress *string `xml:"translated-address,omitempty"` + TranslatedPort *int64 `xml:"translated-port,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type DestinationTranslationDnsRewriteXml struct { + Direction *string `xml:"direction,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type DynamicDestinationTranslationXml struct { + Distribution *string `xml:"distribution,omitempty"` + TranslatedAddress *string `xml:"translated-address,omitempty"` + TranslatedPort *int64 `xml:"translated-port,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type SourceTranslationXml struct { + DynamicIp *SourceTranslationDynamicIpXml `xml:"dynamic-ip,omitempty"` + DynamicIpAndPort *SourceTranslationDynamicIpAndPortXml `xml:"dynamic-ip-and-port,omitempty"` + StaticIp *SourceTranslationStaticIpXml `xml:"static-ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type SourceTranslationDynamicIpXml struct { + Fallback *SourceTranslationDynamicIpFallbackXml `xml:"fallback,omitempty"` + TranslatedAddress *util.MemberType `xml:"translated-address,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type SourceTranslationDynamicIpAndPortXml struct { + InterfaceAddress *SourceTranslationDynamicIpAndPortInterfaceAddressXml `xml:"interface-address,omitempty"` + TranslatedAddress *util.MemberType `xml:"translated-address,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type SourceTranslationDynamicIpAndPortInterfaceAddressXml struct { + Interface *string `xml:"interface,omitempty"` + FloatingIp *string `xml:"floating-ip,omitempty"` + Ip *string `xml:"ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type SourceTranslationDynamicIpFallbackXml struct { + InterfaceAddress *SourceTranslationDynamicIpFallbackInterfaceAddressXml `xml:"interface-address,omitempty"` + TranslatedAddress *util.MemberType `xml:"translated-address,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type SourceTranslationDynamicIpFallbackInterfaceAddressXml struct { + Interface *string `xml:"interface,omitempty"` + FloatingIp *string `xml:"floating-ip,omitempty"` + Ip *string `xml:"ip,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type SourceTranslationStaticIpXml struct { + BiDirectional *string `xml:"bi-directional,omitempty"` + TranslatedAddress *string `xml:"translated-address,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TargetXml struct { + Devices []TargetDevicesXml `xml:"devices>entry,omitempty"` + Negate *string `xml:"negate,omitempty"` + Tags *util.MemberType `xml:"tags,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TargetDevicesXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Vsys []TargetDevicesVsysXml `xml:"vsys>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TargetDevicesVsysXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "active_active_device_binding" || v == "ActiveActiveDeviceBinding" { + return e.ActiveActiveDeviceBinding, nil + } + if v == "description" || v == "Description" { + return e.Description, nil + } + if v == "destination" || v == "Destination" { + return e.Destination, nil + } + if v == "destination|LENGTH" || v == "Destination|LENGTH" { + return int64(len(e.Destination)), nil + } + if v == "disabled" || v == "Disabled" { + return e.Disabled, nil + } + if v == "from" || v == "From" { + return e.From, nil + } + if v == "from|LENGTH" || v == "From|LENGTH" { + return int64(len(e.From)), nil + } + if v == "group_tag" || v == "GroupTag" { + return e.GroupTag, nil + } + if v == "nat_type" || v == "NatType" { + return e.NatType, nil + } + if v == "service" || v == "Service" { + return e.Service, nil + } + if v == "source" || v == "Source" { + return e.Source, nil + } + if v == "source|LENGTH" || v == "Source|LENGTH" { + return int64(len(e.Source)), nil + } + if v == "source_translation" || v == "SourceTranslation" { + return e.SourceTranslation, nil + } + if v == "tag" || v == "Tag" { + return e.Tag, nil + } + if v == "tag|LENGTH" || v == "Tag|LENGTH" { + return int64(len(e.Tag)), nil + } + if v == "target" || v == "Target" { + return e.Target, nil + } + if v == "to" || v == "To" { + return e.To, nil + } + if v == "to|LENGTH" || v == "To|LENGTH" { + return int64(len(e.To)), nil + } + if v == "to_interface" || v == "ToInterface" { + return e.ToInterface, nil + } + if v == "uuid" || v == "Uuid" { + return e.Uuid, nil + } + if v == "destination_translation" || v == "DestinationTranslation" { + return e.DestinationTranslation, nil + } + if v == "dynamic_destination_translation" || v == "DynamicDestinationTranslation" { + return e.DynamicDestinationTranslation, nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + entry.ActiveActiveDeviceBinding = o.ActiveActiveDeviceBinding + entry.Description = o.Description + entry.Destination = util.StrToMem(o.Destination) + entry.Disabled = util.YesNo(o.Disabled, nil) + entry.From = util.StrToMem(o.From) + entry.GroupTag = o.GroupTag + entry.NatType = o.NatType + entry.Service = o.Service + entry.Source = util.StrToMem(o.Source) + var nestedSourceTranslation *SourceTranslationXml + if o.SourceTranslation != nil { + nestedSourceTranslation = &SourceTranslationXml{} + if _, ok := o.Misc["SourceTranslation"]; ok { + nestedSourceTranslation.Misc = o.Misc["SourceTranslation"] + } + if o.SourceTranslation.DynamicIp != nil { + nestedSourceTranslation.DynamicIp = &SourceTranslationDynamicIpXml{} + if _, ok := o.Misc["SourceTranslationDynamicIp"]; ok { + nestedSourceTranslation.DynamicIp.Misc = o.Misc["SourceTranslationDynamicIp"] + } + if o.SourceTranslation.DynamicIp.Fallback != nil { + nestedSourceTranslation.DynamicIp.Fallback = &SourceTranslationDynamicIpFallbackXml{} + if _, ok := o.Misc["SourceTranslationDynamicIpFallback"]; ok { + nestedSourceTranslation.DynamicIp.Fallback.Misc = o.Misc["SourceTranslationDynamicIpFallback"] + } + if o.SourceTranslation.DynamicIp.Fallback.TranslatedAddress != nil { + nestedSourceTranslation.DynamicIp.Fallback.TranslatedAddress = util.StrToMem(o.SourceTranslation.DynamicIp.Fallback.TranslatedAddress) + } + if o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress != nil { + nestedSourceTranslation.DynamicIp.Fallback.InterfaceAddress = &SourceTranslationDynamicIpFallbackInterfaceAddressXml{} + if _, ok := o.Misc["SourceTranslationDynamicIpFallbackInterfaceAddress"]; ok { + nestedSourceTranslation.DynamicIp.Fallback.InterfaceAddress.Misc = o.Misc["SourceTranslationDynamicIpFallbackInterfaceAddress"] + } + if o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress.Interface != nil { + nestedSourceTranslation.DynamicIp.Fallback.InterfaceAddress.Interface = o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress.Interface + } + if o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress.FloatingIp != nil { + nestedSourceTranslation.DynamicIp.Fallback.InterfaceAddress.FloatingIp = o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress.FloatingIp + } + if o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress.Ip != nil { + nestedSourceTranslation.DynamicIp.Fallback.InterfaceAddress.Ip = o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress.Ip + } + } + } + if o.SourceTranslation.DynamicIp.TranslatedAddress != nil { + nestedSourceTranslation.DynamicIp.TranslatedAddress = util.StrToMem(o.SourceTranslation.DynamicIp.TranslatedAddress) + } + } + if o.SourceTranslation.DynamicIpAndPort != nil { + nestedSourceTranslation.DynamicIpAndPort = &SourceTranslationDynamicIpAndPortXml{} + if _, ok := o.Misc["SourceTranslationDynamicIpAndPort"]; ok { + nestedSourceTranslation.DynamicIpAndPort.Misc = o.Misc["SourceTranslationDynamicIpAndPort"] + } + if o.SourceTranslation.DynamicIpAndPort.InterfaceAddress != nil { + nestedSourceTranslation.DynamicIpAndPort.InterfaceAddress = &SourceTranslationDynamicIpAndPortInterfaceAddressXml{} + if _, ok := o.Misc["SourceTranslationDynamicIpAndPortInterfaceAddress"]; ok { + nestedSourceTranslation.DynamicIpAndPort.InterfaceAddress.Misc = o.Misc["SourceTranslationDynamicIpAndPortInterfaceAddress"] + } + if o.SourceTranslation.DynamicIpAndPort.InterfaceAddress.Interface != nil { + nestedSourceTranslation.DynamicIpAndPort.InterfaceAddress.Interface = o.SourceTranslation.DynamicIpAndPort.InterfaceAddress.Interface + } + if o.SourceTranslation.DynamicIpAndPort.InterfaceAddress.FloatingIp != nil { + nestedSourceTranslation.DynamicIpAndPort.InterfaceAddress.FloatingIp = o.SourceTranslation.DynamicIpAndPort.InterfaceAddress.FloatingIp + } + if o.SourceTranslation.DynamicIpAndPort.InterfaceAddress.Ip != nil { + nestedSourceTranslation.DynamicIpAndPort.InterfaceAddress.Ip = o.SourceTranslation.DynamicIpAndPort.InterfaceAddress.Ip + } + } + if o.SourceTranslation.DynamicIpAndPort.TranslatedAddress != nil { + nestedSourceTranslation.DynamicIpAndPort.TranslatedAddress = util.StrToMem(o.SourceTranslation.DynamicIpAndPort.TranslatedAddress) + } + } + if o.SourceTranslation.StaticIp != nil { + nestedSourceTranslation.StaticIp = &SourceTranslationStaticIpXml{} + if _, ok := o.Misc["SourceTranslationStaticIp"]; ok { + nestedSourceTranslation.StaticIp.Misc = o.Misc["SourceTranslationStaticIp"] + } + if o.SourceTranslation.StaticIp.BiDirectional != nil { + nestedSourceTranslation.StaticIp.BiDirectional = o.SourceTranslation.StaticIp.BiDirectional + } + if o.SourceTranslation.StaticIp.TranslatedAddress != nil { + nestedSourceTranslation.StaticIp.TranslatedAddress = o.SourceTranslation.StaticIp.TranslatedAddress + } + } + } + entry.SourceTranslation = nestedSourceTranslation + + entry.Tag = util.StrToMem(o.Tag) + var nestedTarget *TargetXml + if o.Target != nil { + nestedTarget = &TargetXml{} + if _, ok := o.Misc["Target"]; ok { + nestedTarget.Misc = o.Misc["Target"] + } + if o.Target.Devices != nil { + nestedTarget.Devices = []TargetDevicesXml{} + for _, oTargetDevices := range o.Target.Devices { + nestedTargetDevices := TargetDevicesXml{} + if _, ok := o.Misc["TargetDevices"]; ok { + nestedTargetDevices.Misc = o.Misc["TargetDevices"] + } + if oTargetDevices.Vsys != nil { + nestedTargetDevices.Vsys = []TargetDevicesVsysXml{} + for _, oTargetDevicesVsys := range oTargetDevices.Vsys { + nestedTargetDevicesVsys := TargetDevicesVsysXml{} + if _, ok := o.Misc["TargetDevicesVsys"]; ok { + nestedTargetDevicesVsys.Misc = o.Misc["TargetDevicesVsys"] + } + if oTargetDevicesVsys.Name != "" { + nestedTargetDevicesVsys.Name = oTargetDevicesVsys.Name + } + nestedTargetDevices.Vsys = append(nestedTargetDevices.Vsys, nestedTargetDevicesVsys) + } + } + if oTargetDevices.Name != "" { + nestedTargetDevices.Name = oTargetDevices.Name + } + nestedTarget.Devices = append(nestedTarget.Devices, nestedTargetDevices) + } + } + if o.Target.Negate != nil { + nestedTarget.Negate = util.YesNo(o.Target.Negate, nil) + } + if o.Target.Tags != nil { + nestedTarget.Tags = util.StrToMem(o.Target.Tags) + } + } + entry.Target = nestedTarget + + entry.To = util.StrToMem(o.To) + entry.ToInterface = o.ToInterface + entry.Uuid = o.Uuid + var nestedDestinationTranslation *DestinationTranslationXml + if o.DestinationTranslation != nil { + nestedDestinationTranslation = &DestinationTranslationXml{} + if _, ok := o.Misc["DestinationTranslation"]; ok { + nestedDestinationTranslation.Misc = o.Misc["DestinationTranslation"] + } + if o.DestinationTranslation.DnsRewrite != nil { + nestedDestinationTranslation.DnsRewrite = &DestinationTranslationDnsRewriteXml{} + if _, ok := o.Misc["DestinationTranslationDnsRewrite"]; ok { + nestedDestinationTranslation.DnsRewrite.Misc = o.Misc["DestinationTranslationDnsRewrite"] + } + if o.DestinationTranslation.DnsRewrite.Direction != nil { + nestedDestinationTranslation.DnsRewrite.Direction = o.DestinationTranslation.DnsRewrite.Direction + } + } + if o.DestinationTranslation.TranslatedAddress != nil { + nestedDestinationTranslation.TranslatedAddress = o.DestinationTranslation.TranslatedAddress + } + if o.DestinationTranslation.TranslatedPort != nil { + nestedDestinationTranslation.TranslatedPort = o.DestinationTranslation.TranslatedPort + } + } + entry.DestinationTranslation = nestedDestinationTranslation + + var nestedDynamicDestinationTranslation *DynamicDestinationTranslationXml + if o.DynamicDestinationTranslation != nil { + nestedDynamicDestinationTranslation = &DynamicDestinationTranslationXml{} + if _, ok := o.Misc["DynamicDestinationTranslation"]; ok { + nestedDynamicDestinationTranslation.Misc = o.Misc["DynamicDestinationTranslation"] + } + if o.DynamicDestinationTranslation.Distribution != nil { + nestedDynamicDestinationTranslation.Distribution = o.DynamicDestinationTranslation.Distribution + } + if o.DynamicDestinationTranslation.TranslatedAddress != nil { + nestedDynamicDestinationTranslation.TranslatedAddress = o.DynamicDestinationTranslation.TranslatedAddress + } + if o.DynamicDestinationTranslation.TranslatedPort != nil { + nestedDynamicDestinationTranslation.TranslatedPort = o.DynamicDestinationTranslation.TranslatedPort + } + } + entry.DynamicDestinationTranslation = nestedDynamicDestinationTranslation + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + entry.ActiveActiveDeviceBinding = o.ActiveActiveDeviceBinding + entry.Description = o.Description + entry.Destination = util.MemToStr(o.Destination) + entry.Disabled = util.AsBool(o.Disabled, nil) + entry.From = util.MemToStr(o.From) + entry.GroupTag = o.GroupTag + entry.NatType = o.NatType + entry.Service = o.Service + entry.Source = util.MemToStr(o.Source) + var nestedSourceTranslation *SourceTranslation + if o.SourceTranslation != nil { + nestedSourceTranslation = &SourceTranslation{} + if o.SourceTranslation.Misc != nil { + entry.Misc["SourceTranslation"] = o.SourceTranslation.Misc + } + if o.SourceTranslation.DynamicIp != nil { + nestedSourceTranslation.DynamicIp = &SourceTranslationDynamicIp{} + if o.SourceTranslation.DynamicIp.Misc != nil { + entry.Misc["SourceTranslationDynamicIp"] = o.SourceTranslation.DynamicIp.Misc + } + if o.SourceTranslation.DynamicIp.TranslatedAddress != nil { + nestedSourceTranslation.DynamicIp.TranslatedAddress = util.MemToStr(o.SourceTranslation.DynamicIp.TranslatedAddress) + } + if o.SourceTranslation.DynamicIp.Fallback != nil { + nestedSourceTranslation.DynamicIp.Fallback = &SourceTranslationDynamicIpFallback{} + if o.SourceTranslation.DynamicIp.Fallback.Misc != nil { + entry.Misc["SourceTranslationDynamicIpFallback"] = o.SourceTranslation.DynamicIp.Fallback.Misc + } + if o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress != nil { + nestedSourceTranslation.DynamicIp.Fallback.InterfaceAddress = &SourceTranslationDynamicIpFallbackInterfaceAddress{} + if o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress.Misc != nil { + entry.Misc["SourceTranslationDynamicIpFallbackInterfaceAddress"] = o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress.Misc + } + if o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress.Interface != nil { + nestedSourceTranslation.DynamicIp.Fallback.InterfaceAddress.Interface = o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress.Interface + } + if o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress.FloatingIp != nil { + nestedSourceTranslation.DynamicIp.Fallback.InterfaceAddress.FloatingIp = o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress.FloatingIp + } + if o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress.Ip != nil { + nestedSourceTranslation.DynamicIp.Fallback.InterfaceAddress.Ip = o.SourceTranslation.DynamicIp.Fallback.InterfaceAddress.Ip + } + } + if o.SourceTranslation.DynamicIp.Fallback.TranslatedAddress != nil { + nestedSourceTranslation.DynamicIp.Fallback.TranslatedAddress = util.MemToStr(o.SourceTranslation.DynamicIp.Fallback.TranslatedAddress) + } + } + } + if o.SourceTranslation.DynamicIpAndPort != nil { + nestedSourceTranslation.DynamicIpAndPort = &SourceTranslationDynamicIpAndPort{} + if o.SourceTranslation.DynamicIpAndPort.Misc != nil { + entry.Misc["SourceTranslationDynamicIpAndPort"] = o.SourceTranslation.DynamicIpAndPort.Misc + } + if o.SourceTranslation.DynamicIpAndPort.InterfaceAddress != nil { + nestedSourceTranslation.DynamicIpAndPort.InterfaceAddress = &SourceTranslationDynamicIpAndPortInterfaceAddress{} + if o.SourceTranslation.DynamicIpAndPort.InterfaceAddress.Misc != nil { + entry.Misc["SourceTranslationDynamicIpAndPortInterfaceAddress"] = o.SourceTranslation.DynamicIpAndPort.InterfaceAddress.Misc + } + if o.SourceTranslation.DynamicIpAndPort.InterfaceAddress.Interface != nil { + nestedSourceTranslation.DynamicIpAndPort.InterfaceAddress.Interface = o.SourceTranslation.DynamicIpAndPort.InterfaceAddress.Interface + } + if o.SourceTranslation.DynamicIpAndPort.InterfaceAddress.FloatingIp != nil { + nestedSourceTranslation.DynamicIpAndPort.InterfaceAddress.FloatingIp = o.SourceTranslation.DynamicIpAndPort.InterfaceAddress.FloatingIp + } + if o.SourceTranslation.DynamicIpAndPort.InterfaceAddress.Ip != nil { + nestedSourceTranslation.DynamicIpAndPort.InterfaceAddress.Ip = o.SourceTranslation.DynamicIpAndPort.InterfaceAddress.Ip + } + } + if o.SourceTranslation.DynamicIpAndPort.TranslatedAddress != nil { + nestedSourceTranslation.DynamicIpAndPort.TranslatedAddress = util.MemToStr(o.SourceTranslation.DynamicIpAndPort.TranslatedAddress) + } + } + if o.SourceTranslation.StaticIp != nil { + nestedSourceTranslation.StaticIp = &SourceTranslationStaticIp{} + if o.SourceTranslation.StaticIp.Misc != nil { + entry.Misc["SourceTranslationStaticIp"] = o.SourceTranslation.StaticIp.Misc + } + if o.SourceTranslation.StaticIp.BiDirectional != nil { + nestedSourceTranslation.StaticIp.BiDirectional = o.SourceTranslation.StaticIp.BiDirectional + } + if o.SourceTranslation.StaticIp.TranslatedAddress != nil { + nestedSourceTranslation.StaticIp.TranslatedAddress = o.SourceTranslation.StaticIp.TranslatedAddress + } + } + } + entry.SourceTranslation = nestedSourceTranslation + + entry.Tag = util.MemToStr(o.Tag) + var nestedTarget *Target + if o.Target != nil { + nestedTarget = &Target{} + if o.Target.Misc != nil { + entry.Misc["Target"] = o.Target.Misc + } + if o.Target.Tags != nil { + nestedTarget.Tags = util.MemToStr(o.Target.Tags) + } + if o.Target.Devices != nil { + nestedTarget.Devices = []TargetDevices{} + for _, oTargetDevices := range o.Target.Devices { + nestedTargetDevices := TargetDevices{} + if oTargetDevices.Misc != nil { + entry.Misc["TargetDevices"] = oTargetDevices.Misc + } + if oTargetDevices.Name != "" { + nestedTargetDevices.Name = oTargetDevices.Name + } + if oTargetDevices.Vsys != nil { + nestedTargetDevices.Vsys = []TargetDevicesVsys{} + for _, oTargetDevicesVsys := range oTargetDevices.Vsys { + nestedTargetDevicesVsys := TargetDevicesVsys{} + if oTargetDevicesVsys.Misc != nil { + entry.Misc["TargetDevicesVsys"] = oTargetDevicesVsys.Misc + } + if oTargetDevicesVsys.Name != "" { + nestedTargetDevicesVsys.Name = oTargetDevicesVsys.Name + } + nestedTargetDevices.Vsys = append(nestedTargetDevices.Vsys, nestedTargetDevicesVsys) + } + } + nestedTarget.Devices = append(nestedTarget.Devices, nestedTargetDevices) + } + } + if o.Target.Negate != nil { + nestedTarget.Negate = util.AsBool(o.Target.Negate, nil) + } + } + entry.Target = nestedTarget + + entry.To = util.MemToStr(o.To) + entry.ToInterface = o.ToInterface + entry.Uuid = o.Uuid + var nestedDestinationTranslation *DestinationTranslation + if o.DestinationTranslation != nil { + nestedDestinationTranslation = &DestinationTranslation{} + if o.DestinationTranslation.Misc != nil { + entry.Misc["DestinationTranslation"] = o.DestinationTranslation.Misc + } + if o.DestinationTranslation.DnsRewrite != nil { + nestedDestinationTranslation.DnsRewrite = &DestinationTranslationDnsRewrite{} + if o.DestinationTranslation.DnsRewrite.Misc != nil { + entry.Misc["DestinationTranslationDnsRewrite"] = o.DestinationTranslation.DnsRewrite.Misc + } + if o.DestinationTranslation.DnsRewrite.Direction != nil { + nestedDestinationTranslation.DnsRewrite.Direction = o.DestinationTranslation.DnsRewrite.Direction + } + } + if o.DestinationTranslation.TranslatedAddress != nil { + nestedDestinationTranslation.TranslatedAddress = o.DestinationTranslation.TranslatedAddress + } + if o.DestinationTranslation.TranslatedPort != nil { + nestedDestinationTranslation.TranslatedPort = o.DestinationTranslation.TranslatedPort + } + } + entry.DestinationTranslation = nestedDestinationTranslation + + var nestedDynamicDestinationTranslation *DynamicDestinationTranslation + if o.DynamicDestinationTranslation != nil { + nestedDynamicDestinationTranslation = &DynamicDestinationTranslation{} + if o.DynamicDestinationTranslation.Misc != nil { + entry.Misc["DynamicDestinationTranslation"] = o.DynamicDestinationTranslation.Misc + } + if o.DynamicDestinationTranslation.Distribution != nil { + nestedDynamicDestinationTranslation.Distribution = o.DynamicDestinationTranslation.Distribution + } + if o.DynamicDestinationTranslation.TranslatedAddress != nil { + nestedDynamicDestinationTranslation.TranslatedAddress = o.DynamicDestinationTranslation.TranslatedAddress + } + if o.DynamicDestinationTranslation.TranslatedPort != nil { + nestedDynamicDestinationTranslation.TranslatedPort = o.DynamicDestinationTranslation.TranslatedPort + } + } + entry.DynamicDestinationTranslation = nestedDynamicDestinationTranslation + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !util.StringsMatch(a.ActiveActiveDeviceBinding, b.ActiveActiveDeviceBinding) { + return false + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.OrderedListsMatch(a.Destination, b.Destination) { + return false + } + if !util.BoolsMatch(a.Disabled, b.Disabled) { + return false + } + if !util.OrderedListsMatch(a.From, b.From) { + return false + } + if !util.StringsMatch(a.GroupTag, b.GroupTag) { + return false + } + if !util.StringsMatch(a.NatType, b.NatType) { + return false + } + if !util.StringsMatch(a.Service, b.Service) { + return false + } + if !util.OrderedListsMatch(a.Source, b.Source) { + return false + } + if !matchSourceTranslation(a.SourceTranslation, b.SourceTranslation) { + return false + } + if !util.OrderedListsMatch(a.Tag, b.Tag) { + return false + } + if !matchTarget(a.Target, b.Target) { + return false + } + if !util.OrderedListsMatch(a.To, b.To) { + return false + } + if !util.StringsMatch(a.ToInterface, b.ToInterface) { + return false + } + if !util.StringsMatch(a.Uuid, b.Uuid) { + return false + } + if !matchDestinationTranslation(a.DestinationTranslation, b.DestinationTranslation) { + return false + } + if !matchDynamicDestinationTranslation(a.DynamicDestinationTranslation, b.DynamicDestinationTranslation) { + return false + } + + return true +} + +func matchSourceTranslationDynamicIpFallbackInterfaceAddress(a *SourceTranslationDynamicIpFallbackInterfaceAddress, b *SourceTranslationDynamicIpFallbackInterfaceAddress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Interface, b.Interface) { + return false + } + if !util.StringsMatch(a.FloatingIp, b.FloatingIp) { + return false + } + if !util.StringsMatch(a.Ip, b.Ip) { + return false + } + return true +} +func matchSourceTranslationDynamicIpFallback(a *SourceTranslationDynamicIpFallback, b *SourceTranslationDynamicIpFallback) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.OrderedListsMatch(a.TranslatedAddress, b.TranslatedAddress) { + return false + } + if !matchSourceTranslationDynamicIpFallbackInterfaceAddress(a.InterfaceAddress, b.InterfaceAddress) { + return false + } + return true +} +func matchSourceTranslationDynamicIp(a *SourceTranslationDynamicIp, b *SourceTranslationDynamicIp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.OrderedListsMatch(a.TranslatedAddress, b.TranslatedAddress) { + return false + } + if !matchSourceTranslationDynamicIpFallback(a.Fallback, b.Fallback) { + return false + } + return true +} +func matchSourceTranslationDynamicIpAndPortInterfaceAddress(a *SourceTranslationDynamicIpAndPortInterfaceAddress, b *SourceTranslationDynamicIpAndPortInterfaceAddress) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Interface, b.Interface) { + return false + } + if !util.StringsMatch(a.Ip, b.Ip) { + return false + } + if !util.StringsMatch(a.FloatingIp, b.FloatingIp) { + return false + } + return true +} +func matchSourceTranslationDynamicIpAndPort(a *SourceTranslationDynamicIpAndPort, b *SourceTranslationDynamicIpAndPort) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchSourceTranslationDynamicIpAndPortInterfaceAddress(a.InterfaceAddress, b.InterfaceAddress) { + return false + } + if !util.OrderedListsMatch(a.TranslatedAddress, b.TranslatedAddress) { + return false + } + return true +} +func matchSourceTranslationStaticIp(a *SourceTranslationStaticIp, b *SourceTranslationStaticIp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.BiDirectional, b.BiDirectional) { + return false + } + if !util.StringsMatch(a.TranslatedAddress, b.TranslatedAddress) { + return false + } + return true +} +func matchSourceTranslation(a *SourceTranslation, b *SourceTranslation) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchSourceTranslationStaticIp(a.StaticIp, b.StaticIp) { + return false + } + if !matchSourceTranslationDynamicIp(a.DynamicIp, b.DynamicIp) { + return false + } + if !matchSourceTranslationDynamicIpAndPort(a.DynamicIpAndPort, b.DynamicIpAndPort) { + return false + } + return true +} +func matchTargetDevicesVsys(a []TargetDevicesVsys, b []TargetDevicesVsys) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchTargetDevices(a []TargetDevices, b []TargetDevices) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !matchTargetDevicesVsys(a.Vsys, b.Vsys) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchTarget(a *Target, b *Target) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchTargetDevices(a.Devices, b.Devices) { + return false + } + if !util.BoolsMatch(a.Negate, b.Negate) { + return false + } + if !util.OrderedListsMatch(a.Tags, b.Tags) { + return false + } + return true +} +func matchDestinationTranslationDnsRewrite(a *DestinationTranslationDnsRewrite, b *DestinationTranslationDnsRewrite) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Direction, b.Direction) { + return false + } + return true +} +func matchDestinationTranslation(a *DestinationTranslation, b *DestinationTranslation) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.TranslatedAddress, b.TranslatedAddress) { + return false + } + if !util.Ints64Match(a.TranslatedPort, b.TranslatedPort) { + return false + } + if !matchDestinationTranslationDnsRewrite(a.DnsRewrite, b.DnsRewrite) { + return false + } + return true +} +func matchDynamicDestinationTranslation(a *DynamicDestinationTranslation, b *DynamicDestinationTranslation) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Distribution, b.Distribution) { + return false + } + if !util.StringsMatch(a.TranslatedAddress, b.TranslatedAddress) { + return false + } + if !util.Ints64Match(a.TranslatedPort, b.TranslatedPort) { + return false + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} +func (o *Entry) EntryUuid() *string { + return o.Uuid +} + +func (o *Entry) SetEntryUuid(uuid *string) { + o.Uuid = uuid +} diff --git a/policies/rules/nat/interfaces.go b/policies/rules/nat/interfaces.go new file mode 100644 index 00000000..0513ac3a --- /dev/null +++ b/policies/rules/nat/interfaces.go @@ -0,0 +1,7 @@ +package nat + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/policies/rules/nat/location.go b/policies/rules/nat/location.go new file mode 100644 index 00000000..8bc35393 --- /dev/null +++ b/policies/rules/nat/location.go @@ -0,0 +1,175 @@ +package nat + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared *SharedLocation `json:"shared,omitempty"` + Vsys *VsysLocation `json:"vsys,omitempty"` +} + +type DeviceGroupLocation struct { + DeviceGroup string `json:"device_group"` + PanoramaDevice string `json:"panorama_device"` + Rulebase string `json:"rulebase"` +} + +type SharedLocation struct { + Rulebase string `json:"rulebase"` +} + +type VsysLocation struct { + NgfwDevice string `json:"ngfw_device"` + Vsys string `json:"vsys"` +} + +func NewDeviceGroupLocation() *Location { + return &Location{DeviceGroup: &DeviceGroupLocation{ + DeviceGroup: "", + PanoramaDevice: "localhost.localdomain", + Rulebase: "pre-rulebase", + }, + } +} +func NewSharedLocation() *Location { + return &Location{Shared: &SharedLocation{ + Rulebase: "pre-rulebase", + }, + } +} +func NewVsysLocation() *Location { + return &Location{Vsys: &VsysLocation{ + NgfwDevice: "localhost.localdomain", + Vsys: "vsys1", + }, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + if o.DeviceGroup.Rulebase == "" { + return fmt.Errorf("Rulebase is unspecified") + } + count++ + case o.Shared != nil: + if o.Shared.Rulebase == "" { + return fmt.Errorf("Rulebase is unspecified") + } + count++ + case o.Vsys != nil: + if o.Vsys.NgfwDevice == "" { + return fmt.Errorf("NgfwDevice is unspecified") + } + if o.Vsys.Vsys == "" { + return fmt.Errorf("Vsys is unspecified") + } + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return nil, fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + if o.DeviceGroup.Rulebase == "" { + return nil, fmt.Errorf("Rulebase is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.DeviceGroup.PanoramaDevice}), + "device-group", + util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), + o.DeviceGroup.Rulebase, + } + case o.Shared != nil: + if o.Shared.Rulebase == "" { + return nil, fmt.Errorf("Rulebase is unspecified") + } + ans = []string{ + "config", + "shared", + o.Shared.Rulebase, + } + case o.Vsys != nil: + if o.Vsys.NgfwDevice == "" { + return nil, fmt.Errorf("NgfwDevice is unspecified") + } + if o.Vsys.Vsys == "" { + return nil, fmt.Errorf("Vsys is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.Vsys.NgfwDevice}), + "vsys", + util.AsEntryXpath([]string{o.Vsys.Vsys}), + "rulebase", + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/policies/rules/nat/service.go b/policies/rules/nat/service.go new file mode 100644 index 00000000..bea643c4 --- /dev/null +++ b/policies/rules/nat/service.go @@ -0,0 +1,862 @@ +package nat + +import ( + "context" + "fmt" + "net/url" + "strings" + "time" + + "github.com/PaloAltoNetworks/pango/audit" + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/rule" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, true, false) +} + +// ReadById returns the given config object with specified ID, using the specified action ("get" or "show"). +func (s *Service) ReadById(ctx context.Context, loc Location, uuid, action string) (*Entry, error) { + return s.read(ctx, loc, uuid, action, false, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true, true) +} + +// ReadFromConfigById returns the given config object with specified ID from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfigById(ctx context.Context, loc Location, uuid string) (*Entry, error) { + return s.read(ctx, loc, uuid, "", false, true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, byName, usePanosConfig bool) (*Entry, error) { + if byName && value == "" { + return nil, errors.NameNotSpecifiedError + } + if !byName && value == "" { + return nil, errors.UuidNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + if byName { + path, err = loc.XpathWithEntryName(vn, value) + } else { + path, err = loc.XpathWithUuid(vn, value) + } + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name, true) +} + +// UpdateById updates the given config object, then returns the result. +func (s *Service) UpdateById(ctx context.Context, loc Location, entry *Entry, uuid string) (*Entry, error) { + return s.update(ctx, loc, entry, uuid, false) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string, byName bool) (*Entry, error) { + if byName && entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + if !byName && value == "" { + return nil, errors.UuidNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if byName { + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + } else { + old, err = s.ReadById(ctx, loc, value, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + if byName { + return s.Read(ctx, loc, entry.Name, "get") + } else { + return s.ReadById(ctx, loc, value, "get") + } +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name, true) +} + +// DeleteById deletes the given item with specified ID. +func (s *Service) DeleteById(ctx context.Context, loc Location, uuid ...string) error { + return s.delete(ctx, loc, uuid, false) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string, byName bool) error { + for _, value := range values { + if byName && value == "" { + return errors.NameNotSpecifiedError + } + if !byName && value == "" { + return errors.UuidNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + if byName { + path, err = loc.XpathWithEntryName(vn, value) + } else { + path, err = loc.XpathWithUuid(vn, value) + } + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} + +// MoveGroup arranges the given rules in the order specified. +// Any rule with a UUID specified is ignored. +// Only the rule names are considered for the purposes of the rule placement. +func (s *Service) MoveGroup(ctx context.Context, loc Location, position rule.Position, entries []*Entry) error { + if len(entries) == 0 { + return nil + } + + listing, err := s.List(ctx, loc, "get", "", "") + if err != nil { + return err + } else if len(listing) == 0 { + return fmt.Errorf("no rules present") + } + + rp := make(map[string]int) + for idx, live := range listing { + rp[live.Name] = idx + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(len(entries)) + + var ok, topDown bool + var otherIndex int + baseIndex := -1 + switch { + case position.First != nil && *position.First: + topDown, baseIndex, ok, err = s.moveTop(topDown, entries, baseIndex, ok, rp, loc, vn, updates) + if err != nil { + return err + } + case position.Last != nil && *position.Last: + baseIndex, ok, err = s.moveBottom(entries, baseIndex, ok, rp, listing, loc, vn, updates) + if err != nil { + return err + } + case position.SomewhereAfter != nil && *position.SomewhereAfter != "": + topDown, baseIndex, ok, otherIndex, err = s.moveSomewhereAfter(topDown, entries, baseIndex, ok, rp, otherIndex, position, loc, vn, updates) + if err != nil { + return err + } + case position.SomewhereBefore != nil && *position.SomewhereBefore != "": + baseIndex, ok, otherIndex, err = s.moveSomewhereBefore(entries, baseIndex, ok, rp, otherIndex, position, loc, vn, updates) + if err != nil { + return err + } + case position.DirectlyAfter != nil && *position.DirectlyAfter != "": + topDown, baseIndex, ok, otherIndex, err = s.moveDirectlyAfter(topDown, entries, baseIndex, ok, rp, otherIndex, position, loc, vn, updates) + if err != nil { + return err + } + case position.DirectlyBefore != nil && *position.DirectlyBefore != "": + baseIndex, ok, err = s.moveDirectlyBefore(entries, baseIndex, ok, rp, otherIndex, position, loc, vn, updates) + if err != nil { + return err + } + default: + topDown = true + target := entries[0] + + baseIndex, ok = rp[target.Name] + if !ok { + return fmt.Errorf("could not find rule %q for first positioning", target.Name) + } + } + + var prevName, where string + if topDown { + prevName = entries[0].Name + where = "after" + } else { + prevName = entries[len(entries)-1].Name + where = "before" + } + + for i := 1; i < len(entries); i++ { + err := s.moveRestOfRules(topDown, entries, i, baseIndex, rp, loc, vn, updates, where, prevName) + if err != nil { + return err + } + } + + if len(updates.Operations) > 0 { + _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil) + return err + } + + return nil +} + +func (s *Service) moveRestOfRules(topDown bool, entries []*Entry, i int, baseIndex int, rp map[string]int, loc Location, vn version.Number, updates *xmlapi.MultiConfig, where string, prevName string) error { + var target Entry + var desiredIndex int + if topDown { + target = *entries[i] + desiredIndex = baseIndex + i + } else { + target = *entries[len(entries)-1-i] + desiredIndex = baseIndex - i + } + + idx, ok := rp[target.Name] + if !ok { + return fmt.Errorf("rule %q not present", target.Name) + } + + if idx != desiredIndex { + path, err := loc.XpathWithEntryName(vn, target.Name) + if err != nil { + return err + } + + if idx < desiredIndex { + for name, val := range rp { + if val > idx && val <= desiredIndex { + rp[name] = val - 1 + } + } + } else { + for name, val := range rp { + if val < idx && val >= desiredIndex { + rp[name] = val + 1 + } + } + } + rp[target.Name] = desiredIndex + + updates.Add(&xmlapi.Config{ + Action: "move", + Xpath: util.AsXpath(path), + Where: where, + Destination: prevName, + Target: s.client.GetTarget(), + }) + } + + prevName = target.Name + return nil +} + +func (s *Service) moveDirectlyBefore(entries []*Entry, baseIndex int, ok bool, rp map[string]int, otherIndex int, position rule.Position, loc Location, vn version.Number, updates *xmlapi.MultiConfig) (int, bool, error) { + target := entries[len(entries)-1] + + baseIndex, ok = rp[target.Name] + if !ok { + return 0, false, fmt.Errorf("could not find rule %q for initial positioning", target.Name) + } + + otherIndex, ok = rp[*position.DirectlyBefore] + if !ok { + return 0, false, fmt.Errorf("could not find referenced rule %q", *position.DirectlyBefore) + } + + if baseIndex+1 != otherIndex { + path, err := loc.XpathWithEntryName(vn, target.Name) + if err != nil { + return 0, false, err + } + + for name, val := range rp { + switch { + case name == target.Name: + rp[name] = otherIndex + case val < baseIndex && val >= otherIndex: + rp[name] = val + 1 + } + } + + updates.Add(&xmlapi.Config{ + Action: "move", + Xpath: util.AsXpath(path), + Where: "before", + Destination: *position.DirectlyBefore, + Target: s.client.GetTarget(), + }) + + baseIndex = otherIndex + } + return baseIndex, ok, nil +} + +func (s *Service) moveDirectlyAfter(topDown bool, entries []*Entry, baseIndex int, ok bool, rp map[string]int, otherIndex int, position rule.Position, loc Location, vn version.Number, updates *xmlapi.MultiConfig) (bool, int, bool, int, error) { + topDown = true + target := entries[0] + + baseIndex, ok = rp[target.Name] + if !ok { + return false, 0, false, 0, fmt.Errorf("could not find rule %q for initial positioning", target.Name) + } + + otherIndex, ok = rp[*position.DirectlyAfter] + if !ok { + return false, 0, false, 0, fmt.Errorf("could not find referenced rule %q for initial positioning", *position.DirectlyAfter) + } + + if baseIndex != otherIndex+1 { + path, err := loc.XpathWithEntryName(vn, target.Name) + if err != nil { + return false, 0, false, 0, err + } + + for name, val := range rp { + switch { + case name == target.Name: + rp[name] = otherIndex + case val > baseIndex && val <= otherIndex: + rp[name] = otherIndex - 1 + } + } + + updates.Add(&xmlapi.Config{ + Action: "move", + Xpath: util.AsXpath(path), + Where: "after", + Destination: *position.DirectlyAfter, + Target: s.client.GetTarget(), + }) + + baseIndex = otherIndex + } + return topDown, baseIndex, ok, otherIndex, nil +} + +func (s *Service) moveSomewhereBefore(entries []*Entry, baseIndex int, ok bool, rp map[string]int, otherIndex int, position rule.Position, loc Location, vn version.Number, updates *xmlapi.MultiConfig) (int, bool, int, error) { + target := entries[len(entries)-1] + + baseIndex, ok = rp[target.Name] + if !ok { + return 0, false, 0, fmt.Errorf("could not find rule %q for initial positioning", target.Name) + } + + otherIndex, ok = rp[*position.SomewhereBefore] + if !ok { + return 0, false, 0, fmt.Errorf("could not find referenced rule %q", *position.SomewhereBefore) + } + + if baseIndex > otherIndex { + path, err := loc.XpathWithEntryName(vn, target.Name) + if err != nil { + return 0, false, 0, err + } + + for name, val := range rp { + switch { + case name == target.Name: + rp[name] = otherIndex + case val < baseIndex && val >= otherIndex: + rp[name] = val + 1 + } + } + + updates.Add(&xmlapi.Config{ + Action: "move", + Xpath: util.AsXpath(path), + Where: "before", + Destination: *position.SomewhereBefore, + Target: s.client.GetTarget(), + }) + + baseIndex = otherIndex + } + return baseIndex, ok, otherIndex, nil +} + +func (s *Service) moveSomewhereAfter(topDown bool, entries []*Entry, baseIndex int, ok bool, rp map[string]int, otherIndex int, position rule.Position, loc Location, vn version.Number, updates *xmlapi.MultiConfig) (bool, int, bool, int, error) { + topDown = true + target := entries[0] + + baseIndex, ok = rp[target.Name] + if !ok { + return false, 0, false, 0, fmt.Errorf("could not find rule %q for initial positioning", target.Name) + } + + otherIndex, ok = rp[*position.SomewhereAfter] + if !ok { + return false, 0, false, 0, fmt.Errorf("could not find referenced rule %q for initial positioning", *position.SomewhereAfter) + } + + if baseIndex < otherIndex { + path, err := loc.XpathWithEntryName(vn, target.Name) + if err != nil { + return false, 0, false, 0, err + } + + for name, val := range rp { + switch { + case name == target.Name: + rp[name] = otherIndex + case val > baseIndex && val <= otherIndex: + rp[name] = otherIndex - 1 + } + } + + updates.Add(&xmlapi.Config{ + Action: "move", + Xpath: util.AsXpath(path), + Where: "after", + Destination: *position.SomewhereAfter, + Target: s.client.GetTarget(), + }) + + baseIndex = otherIndex + } + return topDown, baseIndex, ok, otherIndex, nil +} + +func (s *Service) moveBottom(entries []*Entry, baseIndex int, ok bool, rp map[string]int, listing []*Entry, loc Location, vn version.Number, updates *xmlapi.MultiConfig) (int, bool, error) { + target := entries[len(entries)-1] + + baseIndex, ok = rp[target.Name] + if !ok { + return 0, false, fmt.Errorf("could not find rule %q for last positioning", target.Name) + } + + if baseIndex != len(listing)-1 { + path, err := loc.XpathWithEntryName(vn, target.Name) + if err != nil { + return 0, false, err + } + + for name, val := range rp { + switch { + case name == target.Name: + rp[name] = len(listing) - 1 + case val > baseIndex: + rp[name] = val - 1 + } + } + + // some versions of PAN-OS require that the destination always be set + var dst string + if !vn.Gte(util.FixedPanosVersionForMultiConfigMove) { + dst = "bottom" + } + + updates.Add(&xmlapi.Config{ + Action: "move", + Xpath: util.AsXpath(path), + Where: "bottom", + Destination: dst, + Target: s.client.GetTarget(), + }) + + baseIndex = len(listing) - 1 + } + return baseIndex, ok, nil +} + +func (s *Service) moveTop(topDown bool, entries []*Entry, baseIndex int, ok bool, rp map[string]int, loc Location, vn version.Number, updates *xmlapi.MultiConfig) (bool, int, bool, error) { + topDown = true + target := entries[0] + + baseIndex, ok = rp[target.Name] + if !ok { + return false, 0, false, fmt.Errorf("could not find rule %q for first positioning", target.Name) + } + + if baseIndex != 0 { + path, err := loc.XpathWithEntryName(vn, target.Name) + if err != nil { + return false, 0, false, err + } + + for name, val := range rp { + switch { + case name == entries[0].Name: + rp[name] = 0 + case val < baseIndex: + rp[name] = val + 1 + } + } + + // some versions of PAN-OS require that the destination always be set + var dst string + if !vn.Gte(util.FixedPanosVersionForMultiConfigMove) { + dst = "top" + } + + updates.Add(&xmlapi.Config{ + Action: "move", + Xpath: util.AsXpath(path), + Where: "top", + Destination: dst, + Target: s.client.GetTarget(), + }) + + baseIndex = 0 + } + return topDown, baseIndex, ok, nil +} + +// HitCount returns the hit count for the given rule. +func (s *Service) HitCount(ctx context.Context, loc Location, rules ...string) ([]util.HitCount, error) { + switch { + case loc.Vsys != nil: + cmd := &xmlapi.Op{ + Command: util.NewHitCountRequest(RuleType, loc.Vsys.Vsys, rules), + Target: s.client.GetTarget(), + } + var resp util.HitCountResponse + + if _, _, err := s.client.Communicate(ctx, cmd, false, &resp); err != nil { + return nil, err + } + + return resp.Results, nil + } + + return nil, fmt.Errorf("unsupported location") +} + +// SetAuditComment sets the given audit comment for the given rule. +func (s *Service) SetAuditComment(ctx context.Context, loc Location, name, comment string) error { + if name == "" { + return errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + path, err := loc.XpathWithEntryName(vn, name) + if err != nil { + return err + } + + cmd := &xmlapi.Op{ + Command: audit.SetComment{ + Xpath: util.AsXpath(path), + Comment: comment, + }, + Target: s.client.GetTarget(), + } + + _, _, err = s.client.Communicate(ctx, cmd, false, nil) + return err +} + +// CurrentAuditComment gets any current uncommitted audit comment for the given rule. +func (s *Service) CurrentAuditComment(ctx context.Context, loc Location, name string) (string, error) { + if name == "" { + return "", errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + path, err := loc.XpathWithEntryName(vn, name) + if err != nil { + return "", err + } + + cmd := &xmlapi.Op{ + Command: audit.GetComment{ + Xpath: util.AsXpath(path), + }, + Target: s.client.GetTarget(), + } + + var resp audit.UncommittedComment + if _, _, err = s.client.Communicate(ctx, cmd, false, &resp); err != nil { + return "", err + } + + return resp.Comment, nil +} + +// AuditCommentHistory returns a chunk of historical audit comment logs. +func (s *Service) AuditCommentHistory(ctx context.Context, loc Location, name, direction string, nlogs, skip int) ([]audit.Comment, error) { + if name == "" { + return nil, errors.NameNotSpecifiedError + } + + var err error + var base, vsysDg string + switch { + case loc.Vsys != nil: + vsysDg = loc.Vsys.Vsys + base = "rulebase" + case loc.Shared != nil: + vsysDg = "shared" + base = loc.Shared.Rulebase + case loc.DeviceGroup != nil: + vsysDg = loc.DeviceGroup.DeviceGroup + base = loc.DeviceGroup.Rulebase + } + + if vsysDg == "" || base == "" { + return nil, fmt.Errorf("unsupported location") + } + + query := strings.Join([]string{ + "(subtype eq audit-comment)", + fmt.Sprintf("(path contains '\\'%s\\'')", name), + fmt.Sprintf("(path contains '%s')", RuleType), + fmt.Sprintf("(path contains %s)", base), + fmt.Sprintf("(path contains '\\'%s\\'')", vsysDg), + }, " and ") + extras := url.Values{} + extras.Set("uniq", "yes") + + cmd := &xmlapi.Log{ + LogType: "config", + Query: query, + Direction: direction, + Nlogs: nlogs, + Skip: skip, + Extras: extras, + } + + var job util.JobResponse + if _, _, err = s.client.Communicate(ctx, cmd, false, &job); err != nil { + return nil, err + } + + var resp audit.CommentHistory + if _, err = s.client.WaitForLogs(ctx, job.Id, 1*time.Second, &resp); err != nil { + return nil, err + } + + if len(resp.Comments) != 0 { + if clock, err := s.client.Clock(ctx); err == nil { + for i := range resp.Comments { + resp.Comments[i].SetTime(clock) + } + } + } + + return resp.Comments, nil +} diff --git a/policies/rules/security/entry.go b/policies/rules/security/entry.go index 7f154d93..3ee03d9e 100644 --- a/policies/rules/security/entry.go +++ b/policies/rules/security/entry.go @@ -21,14 +21,16 @@ var ( type Entry struct { Name string Action *string - Applications []string - Categories []string + Application []string + Category []string Description *string - DestinationAddresses []string - DestinationHips []string - DestinationZones []string + Destination []string + DestinationHip []string + DisableInspect *bool DisableServerResponseInspection *bool Disabled *bool + From []string + GroupTag *string IcmpUnreachable *bool LogEnd *bool LogSetting *string @@ -36,31 +38,61 @@ type Entry struct { NegateDestination *bool NegateSource *bool ProfileSetting *ProfileSetting + Qos *Qos RuleType *string - Services []string - SourceAddresses []string - SourceHips []string - SourceUsers []string - SourceZones []string - Tags []string + Schedule *string + Service []string + Source []string + SourceHip []string + SourceImei []string + SourceImsi []string + SourceNwSlice []string + SourceUser []string + Tag []string + Target *Target + To []string Uuid *string Misc map[string][]generic.Xml } type ProfileSetting struct { - Group *string + Group []string Profiles *ProfileSettingProfiles } type ProfileSettingProfiles struct { DataFiltering []string FileBlocking []string + Gtp []string + Sctp []string Spyware []string UrlFiltering []string Virus []string Vulnerability []string WildfireAnalysis []string } +type Qos struct { + Marking *QosMarking +} +type QosMarking struct { + FollowC2sFlow *QosMarkingFollowC2sFlow + IpDscp *string + IpPrecedence *string +} +type QosMarkingFollowC2sFlow struct { +} +type Target struct { + Devices []TargetDevices + Negate *bool + Tags []string +} +type TargetDevices struct { + Name string + Vsys []TargetDevicesVsys +} +type TargetDevicesVsys struct { + Name string +} type entryXmlContainer struct { Answer []entryXml `xml:"entry"` @@ -70,14 +102,16 @@ type entryXml struct { XMLName xml.Name `xml:"entry"` Name string `xml:"name,attr"` Action *string `xml:"action,omitempty"` - Applications *util.MemberType `xml:"application,omitempty"` - Categories *util.MemberType `xml:"category,omitempty"` + Application *util.MemberType `xml:"application,omitempty"` + Category *util.MemberType `xml:"category,omitempty"` Description *string `xml:"description,omitempty"` - DestinationAddresses *util.MemberType `xml:"destination,omitempty"` - DestinationHips *util.MemberType `xml:"destination-hip,omitempty"` - DestinationZones *util.MemberType `xml:"to,omitempty"` + Destination *util.MemberType `xml:"destination,omitempty"` + DestinationHip *util.MemberType `xml:"destination-hip,omitempty"` + DisableInspect *string `xml:"disable-inspect,omitempty"` DisableServerResponseInspection *string `xml:"option>disable-server-response-inspection,omitempty"` Disabled *string `xml:"disabled,omitempty"` + From *util.MemberType `xml:"from,omitempty"` + GroupTag *string `xml:"group-tag,omitempty"` IcmpUnreachable *string `xml:"icmp-unreachable,omitempty"` LogEnd *string `xml:"log-end,omitempty"` LogSetting *string `xml:"log-setting,omitempty"` @@ -85,20 +119,25 @@ type entryXml struct { NegateDestination *string `xml:"negate-destination,omitempty"` NegateSource *string `xml:"negate-source,omitempty"` ProfileSetting *ProfileSettingXml `xml:"profile-setting,omitempty"` + Qos *QosXml `xml:"qos,omitempty"` RuleType *string `xml:"rule-type,omitempty"` - Services *util.MemberType `xml:"service,omitempty"` - SourceAddresses *util.MemberType `xml:"source,omitempty"` - SourceHips *util.MemberType `xml:"source-hip,omitempty"` - SourceUsers *util.MemberType `xml:"source-user,omitempty"` - SourceZones *util.MemberType `xml:"from,omitempty"` - Tags *util.MemberType `xml:"tag,omitempty"` + Schedule *string `xml:"schedule,omitempty"` + Service *util.MemberType `xml:"service,omitempty"` + Source *util.MemberType `xml:"source,omitempty"` + SourceHip *util.MemberType `xml:"source-hip,omitempty"` + SourceImei *util.MemberType `xml:"source-imei,omitempty"` + SourceImsi *util.MemberType `xml:"source-imsi,omitempty"` + SourceNwSlice *util.MemberType `xml:"source-nw-slice,omitempty"` + SourceUser *util.MemberType `xml:"source-user,omitempty"` + Tag *util.MemberType `xml:"tag,omitempty"` + Target *TargetXml `xml:"target,omitempty"` + To *util.MemberType `xml:"to,omitempty"` Uuid *string `xml:"uuid,attr,omitempty"` Misc []generic.Xml `xml:",any"` } - type ProfileSettingXml struct { - Group *string `xml:"group,omitempty"` + Group *util.MemberType `xml:"group,omitempty"` Profiles *ProfileSettingProfilesXml `xml:"profiles,omitempty"` Misc []generic.Xml `xml:",any"` @@ -106,6 +145,8 @@ type ProfileSettingXml struct { type ProfileSettingProfilesXml struct { DataFiltering *util.MemberType `xml:"data-filtering,omitempty"` FileBlocking *util.MemberType `xml:"file-blocking,omitempty"` + Gtp *util.MemberType `xml:"gtp,omitempty"` + Sctp *util.MemberType `xml:"sctp,omitempty"` Spyware *util.MemberType `xml:"spyware,omitempty"` UrlFiltering *util.MemberType `xml:"url-filtering,omitempty"` Virus *util.MemberType `xml:"virus,omitempty"` @@ -114,6 +155,41 @@ type ProfileSettingProfilesXml struct { Misc []generic.Xml `xml:",any"` } +type QosXml struct { + Marking *QosMarkingXml `xml:"marking,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type QosMarkingXml struct { + FollowC2sFlow *QosMarkingFollowC2sFlowXml `xml:"follow-c2s-flow,omitempty"` + IpDscp *string `xml:"ip-dscp,omitempty"` + IpPrecedence *string `xml:"ip-precedence,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type QosMarkingFollowC2sFlowXml struct { + Misc []generic.Xml `xml:",any"` +} +type TargetXml struct { + Devices []TargetDevicesXml `xml:"devices>entry,omitempty"` + Negate *string `xml:"negate,omitempty"` + Tags *util.MemberType `xml:"tags,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TargetDevicesXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + Vsys []TargetDevicesVsysXml `xml:"vsys>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type TargetDevicesVsysXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} func (e *Entry) Field(v string) (any, error) { if v == "name" || v == "Name" { @@ -122,38 +198,35 @@ func (e *Entry) Field(v string) (any, error) { if v == "action" || v == "Action" { return e.Action, nil } - if v == "applications" || v == "Applications" { - return e.Applications, nil + if v == "application" || v == "Application" { + return e.Application, nil } - if v == "applications|LENGTH" || v == "Applications|LENGTH" { - return int64(len(e.Applications)), nil + if v == "application|LENGTH" || v == "Application|LENGTH" { + return int64(len(e.Application)), nil } - if v == "categories" || v == "Categories" { - return e.Categories, nil + if v == "category" || v == "Category" { + return e.Category, nil } - if v == "categories|LENGTH" || v == "Categories|LENGTH" { - return int64(len(e.Categories)), nil + if v == "category|LENGTH" || v == "Category|LENGTH" { + return int64(len(e.Category)), nil } if v == "description" || v == "Description" { return e.Description, nil } - if v == "destination_addresses" || v == "DestinationAddresses" { - return e.DestinationAddresses, nil - } - if v == "destination_addresses|LENGTH" || v == "DestinationAddresses|LENGTH" { - return int64(len(e.DestinationAddresses)), nil + if v == "destination" || v == "Destination" { + return e.Destination, nil } - if v == "destination_hips" || v == "DestinationHips" { - return e.DestinationHips, nil + if v == "destination|LENGTH" || v == "Destination|LENGTH" { + return int64(len(e.Destination)), nil } - if v == "destination_hips|LENGTH" || v == "DestinationHips|LENGTH" { - return int64(len(e.DestinationHips)), nil + if v == "destination_hip" || v == "DestinationHip" { + return e.DestinationHip, nil } - if v == "destination_zones" || v == "DestinationZones" { - return e.DestinationZones, nil + if v == "destination_hip|LENGTH" || v == "DestinationHip|LENGTH" { + return int64(len(e.DestinationHip)), nil } - if v == "destination_zones|LENGTH" || v == "DestinationZones|LENGTH" { - return int64(len(e.DestinationZones)), nil + if v == "disable_inspect" || v == "DisableInspect" { + return e.DisableInspect, nil } if v == "disable_server_response_inspection" || v == "DisableServerResponseInspection" { return e.DisableServerResponseInspection, nil @@ -161,6 +234,15 @@ func (e *Entry) Field(v string) (any, error) { if v == "disabled" || v == "Disabled" { return e.Disabled, nil } + if v == "from" || v == "From" { + return e.From, nil + } + if v == "from|LENGTH" || v == "From|LENGTH" { + return int64(len(e.From)), nil + } + if v == "group_tag" || v == "GroupTag" { + return e.GroupTag, nil + } if v == "icmp_unreachable" || v == "IcmpUnreachable" { return e.IcmpUnreachable, nil } @@ -182,44 +264,71 @@ func (e *Entry) Field(v string) (any, error) { if v == "profile_setting" || v == "ProfileSetting" { return e.ProfileSetting, nil } + if v == "qos" || v == "Qos" { + return e.Qos, nil + } if v == "rule_type" || v == "RuleType" { return e.RuleType, nil } - if v == "services" || v == "Services" { - return e.Services, nil + if v == "schedule" || v == "Schedule" { + return e.Schedule, nil + } + if v == "service" || v == "Service" { + return e.Service, nil + } + if v == "service|LENGTH" || v == "Service|LENGTH" { + return int64(len(e.Service)), nil + } + if v == "source" || v == "Source" { + return e.Source, nil + } + if v == "source|LENGTH" || v == "Source|LENGTH" { + return int64(len(e.Source)), nil } - if v == "services|LENGTH" || v == "Services|LENGTH" { - return int64(len(e.Services)), nil + if v == "source_hip" || v == "SourceHip" { + return e.SourceHip, nil } - if v == "source_addresses" || v == "SourceAddresses" { - return e.SourceAddresses, nil + if v == "source_hip|LENGTH" || v == "SourceHip|LENGTH" { + return int64(len(e.SourceHip)), nil } - if v == "source_addresses|LENGTH" || v == "SourceAddresses|LENGTH" { - return int64(len(e.SourceAddresses)), nil + if v == "source_imei" || v == "SourceImei" { + return e.SourceImei, nil } - if v == "source_hips" || v == "SourceHips" { - return e.SourceHips, nil + if v == "source_imei|LENGTH" || v == "SourceImei|LENGTH" { + return int64(len(e.SourceImei)), nil } - if v == "source_hips|LENGTH" || v == "SourceHips|LENGTH" { - return int64(len(e.SourceHips)), nil + if v == "source_imsi" || v == "SourceImsi" { + return e.SourceImsi, nil } - if v == "source_users" || v == "SourceUsers" { - return e.SourceUsers, nil + if v == "source_imsi|LENGTH" || v == "SourceImsi|LENGTH" { + return int64(len(e.SourceImsi)), nil } - if v == "source_users|LENGTH" || v == "SourceUsers|LENGTH" { - return int64(len(e.SourceUsers)), nil + if v == "source_nw_slice" || v == "SourceNwSlice" { + return e.SourceNwSlice, nil } - if v == "source_zones" || v == "SourceZones" { - return e.SourceZones, nil + if v == "source_nw_slice|LENGTH" || v == "SourceNwSlice|LENGTH" { + return int64(len(e.SourceNwSlice)), nil } - if v == "source_zones|LENGTH" || v == "SourceZones|LENGTH" { - return int64(len(e.SourceZones)), nil + if v == "source_user" || v == "SourceUser" { + return e.SourceUser, nil } - if v == "tags" || v == "Tags" { - return e.Tags, nil + if v == "source_user|LENGTH" || v == "SourceUser|LENGTH" { + return int64(len(e.SourceUser)), nil } - if v == "tags|LENGTH" || v == "Tags|LENGTH" { - return int64(len(e.Tags)), nil + if v == "tag" || v == "Tag" { + return e.Tag, nil + } + if v == "tag|LENGTH" || v == "Tag|LENGTH" { + return int64(len(e.Tag)), nil + } + if v == "target" || v == "Target" { + return e.Target, nil + } + if v == "to" || v == "To" { + return e.To, nil + } + if v == "to|LENGTH" || v == "To|LENGTH" { + return int64(len(e.To)), nil } if v == "uuid" || v == "Uuid" { return e.Uuid, nil @@ -229,22 +338,23 @@ func (e *Entry) Field(v string) (any, error) { } func Versioning(vn version.Number) (Specifier, Normalizer, error) { + return specifyEntry, &entryXmlContainer{}, nil } - func specifyEntry(o *Entry) (any, error) { entry := entryXml{} - entry.Name = o.Name entry.Action = o.Action - entry.Applications = util.StrToMem(o.Applications) - entry.Categories = util.StrToMem(o.Categories) + entry.Application = util.StrToMem(o.Application) + entry.Category = util.StrToMem(o.Category) entry.Description = o.Description - entry.DestinationAddresses = util.StrToMem(o.DestinationAddresses) - entry.DestinationHips = util.StrToMem(o.DestinationHips) - entry.DestinationZones = util.StrToMem(o.DestinationZones) + entry.Destination = util.StrToMem(o.Destination) + entry.DestinationHip = util.StrToMem(o.DestinationHip) + entry.DisableInspect = util.YesNo(o.DisableInspect, nil) entry.DisableServerResponseInspection = util.YesNo(o.DisableServerResponseInspection, nil) entry.Disabled = util.YesNo(o.Disabled, nil) + entry.From = util.StrToMem(o.From) + entry.GroupTag = o.GroupTag entry.IcmpUnreachable = util.YesNo(o.IcmpUnreachable, nil) entry.LogEnd = util.YesNo(o.LogEnd, nil) entry.LogSetting = o.LogSetting @@ -258,51 +368,130 @@ func specifyEntry(o *Entry) (any, error) { nestedProfileSetting.Misc = o.Misc["ProfileSetting"] } if o.ProfileSetting.Group != nil { - nestedProfileSetting.Group = o.ProfileSetting.Group + nestedProfileSetting.Group = util.StrToMem(o.ProfileSetting.Group) } if o.ProfileSetting.Profiles != nil { nestedProfileSetting.Profiles = &ProfileSettingProfilesXml{} if _, ok := o.Misc["ProfileSettingProfiles"]; ok { nestedProfileSetting.Profiles.Misc = o.Misc["ProfileSettingProfiles"] } - if o.ProfileSetting.Profiles.WildfireAnalysis != nil { - nestedProfileSetting.Profiles.WildfireAnalysis = util.StrToMem(o.ProfileSetting.Profiles.WildfireAnalysis) + if o.ProfileSetting.Profiles.Vulnerability != nil { + nestedProfileSetting.Profiles.Vulnerability = util.StrToMem(o.ProfileSetting.Profiles.Vulnerability) } if o.ProfileSetting.Profiles.DataFiltering != nil { nestedProfileSetting.Profiles.DataFiltering = util.StrToMem(o.ProfileSetting.Profiles.DataFiltering) } - if o.ProfileSetting.Profiles.Virus != nil { - nestedProfileSetting.Profiles.Virus = util.StrToMem(o.ProfileSetting.Profiles.Virus) + if o.ProfileSetting.Profiles.Gtp != nil { + nestedProfileSetting.Profiles.Gtp = util.StrToMem(o.ProfileSetting.Profiles.Gtp) } if o.ProfileSetting.Profiles.Spyware != nil { nestedProfileSetting.Profiles.Spyware = util.StrToMem(o.ProfileSetting.Profiles.Spyware) } - if o.ProfileSetting.Profiles.Vulnerability != nil { - nestedProfileSetting.Profiles.Vulnerability = util.StrToMem(o.ProfileSetting.Profiles.Vulnerability) - } if o.ProfileSetting.Profiles.UrlFiltering != nil { nestedProfileSetting.Profiles.UrlFiltering = util.StrToMem(o.ProfileSetting.Profiles.UrlFiltering) } if o.ProfileSetting.Profiles.FileBlocking != nil { nestedProfileSetting.Profiles.FileBlocking = util.StrToMem(o.ProfileSetting.Profiles.FileBlocking) } + if o.ProfileSetting.Profiles.Sctp != nil { + nestedProfileSetting.Profiles.Sctp = util.StrToMem(o.ProfileSetting.Profiles.Sctp) + } + if o.ProfileSetting.Profiles.Virus != nil { + nestedProfileSetting.Profiles.Virus = util.StrToMem(o.ProfileSetting.Profiles.Virus) + } + if o.ProfileSetting.Profiles.WildfireAnalysis != nil { + nestedProfileSetting.Profiles.WildfireAnalysis = util.StrToMem(o.ProfileSetting.Profiles.WildfireAnalysis) + } } } entry.ProfileSetting = nestedProfileSetting + var nestedQos *QosXml + if o.Qos != nil { + nestedQos = &QosXml{} + if _, ok := o.Misc["Qos"]; ok { + nestedQos.Misc = o.Misc["Qos"] + } + if o.Qos.Marking != nil { + nestedQos.Marking = &QosMarkingXml{} + if _, ok := o.Misc["QosMarking"]; ok { + nestedQos.Marking.Misc = o.Misc["QosMarking"] + } + if o.Qos.Marking.FollowC2sFlow != nil { + nestedQos.Marking.FollowC2sFlow = &QosMarkingFollowC2sFlowXml{} + if _, ok := o.Misc["QosMarkingFollowC2sFlow"]; ok { + nestedQos.Marking.FollowC2sFlow.Misc = o.Misc["QosMarkingFollowC2sFlow"] + } + } + if o.Qos.Marking.IpDscp != nil { + nestedQos.Marking.IpDscp = o.Qos.Marking.IpDscp + } + if o.Qos.Marking.IpPrecedence != nil { + nestedQos.Marking.IpPrecedence = o.Qos.Marking.IpPrecedence + } + } + } + entry.Qos = nestedQos + entry.RuleType = o.RuleType - entry.Services = util.StrToMem(o.Services) - entry.SourceAddresses = util.StrToMem(o.SourceAddresses) - entry.SourceHips = util.StrToMem(o.SourceHips) - entry.SourceUsers = util.StrToMem(o.SourceUsers) - entry.SourceZones = util.StrToMem(o.SourceZones) - entry.Tags = util.StrToMem(o.Tags) + entry.Schedule = o.Schedule + entry.Service = util.StrToMem(o.Service) + entry.Source = util.StrToMem(o.Source) + entry.SourceHip = util.StrToMem(o.SourceHip) + entry.SourceImei = util.StrToMem(o.SourceImei) + entry.SourceImsi = util.StrToMem(o.SourceImsi) + entry.SourceNwSlice = util.StrToMem(o.SourceNwSlice) + entry.SourceUser = util.StrToMem(o.SourceUser) + entry.Tag = util.StrToMem(o.Tag) + var nestedTarget *TargetXml + if o.Target != nil { + nestedTarget = &TargetXml{} + if _, ok := o.Misc["Target"]; ok { + nestedTarget.Misc = o.Misc["Target"] + } + if o.Target.Devices != nil { + nestedTarget.Devices = []TargetDevicesXml{} + for _, oTargetDevices := range o.Target.Devices { + nestedTargetDevices := TargetDevicesXml{} + if _, ok := o.Misc["TargetDevices"]; ok { + nestedTargetDevices.Misc = o.Misc["TargetDevices"] + } + if oTargetDevices.Vsys != nil { + nestedTargetDevices.Vsys = []TargetDevicesVsysXml{} + for _, oTargetDevicesVsys := range oTargetDevices.Vsys { + nestedTargetDevicesVsys := TargetDevicesVsysXml{} + if _, ok := o.Misc["TargetDevicesVsys"]; ok { + nestedTargetDevicesVsys.Misc = o.Misc["TargetDevicesVsys"] + } + if oTargetDevicesVsys.Name != "" { + nestedTargetDevicesVsys.Name = oTargetDevicesVsys.Name + } + nestedTargetDevices.Vsys = append(nestedTargetDevices.Vsys, nestedTargetDevicesVsys) + } + } + if oTargetDevices.Name != "" { + nestedTargetDevices.Name = oTargetDevices.Name + } + nestedTarget.Devices = append(nestedTarget.Devices, nestedTargetDevices) + } + } + if o.Target.Negate != nil { + nestedTarget.Negate = util.YesNo(o.Target.Negate, nil) + } + if o.Target.Tags != nil { + nestedTarget.Tags = util.StrToMem(o.Target.Tags) + } + } + entry.Target = nestedTarget + + entry.To = util.StrToMem(o.To) entry.Uuid = o.Uuid entry.Misc = o.Misc["Entry"] return entry, nil } + func (c *entryXmlContainer) Normalize() ([]*Entry, error) { entryList := make([]*Entry, 0, len(c.Answer)) for _, o := range c.Answer { @@ -311,14 +500,16 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { } entry.Name = o.Name entry.Action = o.Action - entry.Applications = util.MemToStr(o.Applications) - entry.Categories = util.MemToStr(o.Categories) + entry.Application = util.MemToStr(o.Application) + entry.Category = util.MemToStr(o.Category) entry.Description = o.Description - entry.DestinationAddresses = util.MemToStr(o.DestinationAddresses) - entry.DestinationHips = util.MemToStr(o.DestinationHips) - entry.DestinationZones = util.MemToStr(o.DestinationZones) + entry.Destination = util.MemToStr(o.Destination) + entry.DestinationHip = util.MemToStr(o.DestinationHip) + entry.DisableInspect = util.AsBool(o.DisableInspect, nil) entry.DisableServerResponseInspection = util.AsBool(o.DisableServerResponseInspection, nil) entry.Disabled = util.AsBool(o.Disabled, nil) + entry.From = util.MemToStr(o.From) + entry.GroupTag = o.GroupTag entry.IcmpUnreachable = util.AsBool(o.IcmpUnreachable, nil) entry.LogEnd = util.AsBool(o.LogEnd, nil) entry.LogSetting = o.LogSetting @@ -332,45 +523,123 @@ func (c *entryXmlContainer) Normalize() ([]*Entry, error) { entry.Misc["ProfileSetting"] = o.ProfileSetting.Misc } if o.ProfileSetting.Group != nil { - nestedProfileSetting.Group = o.ProfileSetting.Group + nestedProfileSetting.Group = util.MemToStr(o.ProfileSetting.Group) } if o.ProfileSetting.Profiles != nil { nestedProfileSetting.Profiles = &ProfileSettingProfiles{} if o.ProfileSetting.Profiles.Misc != nil { entry.Misc["ProfileSettingProfiles"] = o.ProfileSetting.Profiles.Misc } - if o.ProfileSetting.Profiles.Vulnerability != nil { - nestedProfileSetting.Profiles.Vulnerability = util.MemToStr(o.ProfileSetting.Profiles.Vulnerability) + if o.ProfileSetting.Profiles.DataFiltering != nil { + nestedProfileSetting.Profiles.DataFiltering = util.MemToStr(o.ProfileSetting.Profiles.DataFiltering) + } + if o.ProfileSetting.Profiles.Gtp != nil { + nestedProfileSetting.Profiles.Gtp = util.MemToStr(o.ProfileSetting.Profiles.Gtp) + } + if o.ProfileSetting.Profiles.Spyware != nil { + nestedProfileSetting.Profiles.Spyware = util.MemToStr(o.ProfileSetting.Profiles.Spyware) } if o.ProfileSetting.Profiles.UrlFiltering != nil { nestedProfileSetting.Profiles.UrlFiltering = util.MemToStr(o.ProfileSetting.Profiles.UrlFiltering) } + if o.ProfileSetting.Profiles.Vulnerability != nil { + nestedProfileSetting.Profiles.Vulnerability = util.MemToStr(o.ProfileSetting.Profiles.Vulnerability) + } if o.ProfileSetting.Profiles.FileBlocking != nil { nestedProfileSetting.Profiles.FileBlocking = util.MemToStr(o.ProfileSetting.Profiles.FileBlocking) } - if o.ProfileSetting.Profiles.WildfireAnalysis != nil { - nestedProfileSetting.Profiles.WildfireAnalysis = util.MemToStr(o.ProfileSetting.Profiles.WildfireAnalysis) - } - if o.ProfileSetting.Profiles.DataFiltering != nil { - nestedProfileSetting.Profiles.DataFiltering = util.MemToStr(o.ProfileSetting.Profiles.DataFiltering) + if o.ProfileSetting.Profiles.Sctp != nil { + nestedProfileSetting.Profiles.Sctp = util.MemToStr(o.ProfileSetting.Profiles.Sctp) } if o.ProfileSetting.Profiles.Virus != nil { nestedProfileSetting.Profiles.Virus = util.MemToStr(o.ProfileSetting.Profiles.Virus) } - if o.ProfileSetting.Profiles.Spyware != nil { - nestedProfileSetting.Profiles.Spyware = util.MemToStr(o.ProfileSetting.Profiles.Spyware) + if o.ProfileSetting.Profiles.WildfireAnalysis != nil { + nestedProfileSetting.Profiles.WildfireAnalysis = util.MemToStr(o.ProfileSetting.Profiles.WildfireAnalysis) } } } entry.ProfileSetting = nestedProfileSetting + var nestedQos *Qos + if o.Qos != nil { + nestedQos = &Qos{} + if o.Qos.Misc != nil { + entry.Misc["Qos"] = o.Qos.Misc + } + if o.Qos.Marking != nil { + nestedQos.Marking = &QosMarking{} + if o.Qos.Marking.Misc != nil { + entry.Misc["QosMarking"] = o.Qos.Marking.Misc + } + if o.Qos.Marking.FollowC2sFlow != nil { + nestedQos.Marking.FollowC2sFlow = &QosMarkingFollowC2sFlow{} + if o.Qos.Marking.FollowC2sFlow.Misc != nil { + entry.Misc["QosMarkingFollowC2sFlow"] = o.Qos.Marking.FollowC2sFlow.Misc + } + } + if o.Qos.Marking.IpDscp != nil { + nestedQos.Marking.IpDscp = o.Qos.Marking.IpDscp + } + if o.Qos.Marking.IpPrecedence != nil { + nestedQos.Marking.IpPrecedence = o.Qos.Marking.IpPrecedence + } + } + } + entry.Qos = nestedQos + entry.RuleType = o.RuleType - entry.Services = util.MemToStr(o.Services) - entry.SourceAddresses = util.MemToStr(o.SourceAddresses) - entry.SourceHips = util.MemToStr(o.SourceHips) - entry.SourceUsers = util.MemToStr(o.SourceUsers) - entry.SourceZones = util.MemToStr(o.SourceZones) - entry.Tags = util.MemToStr(o.Tags) + entry.Schedule = o.Schedule + entry.Service = util.MemToStr(o.Service) + entry.Source = util.MemToStr(o.Source) + entry.SourceHip = util.MemToStr(o.SourceHip) + entry.SourceImei = util.MemToStr(o.SourceImei) + entry.SourceImsi = util.MemToStr(o.SourceImsi) + entry.SourceNwSlice = util.MemToStr(o.SourceNwSlice) + entry.SourceUser = util.MemToStr(o.SourceUser) + entry.Tag = util.MemToStr(o.Tag) + var nestedTarget *Target + if o.Target != nil { + nestedTarget = &Target{} + if o.Target.Misc != nil { + entry.Misc["Target"] = o.Target.Misc + } + if o.Target.Devices != nil { + nestedTarget.Devices = []TargetDevices{} + for _, oTargetDevices := range o.Target.Devices { + nestedTargetDevices := TargetDevices{} + if oTargetDevices.Misc != nil { + entry.Misc["TargetDevices"] = oTargetDevices.Misc + } + if oTargetDevices.Vsys != nil { + nestedTargetDevices.Vsys = []TargetDevicesVsys{} + for _, oTargetDevicesVsys := range oTargetDevices.Vsys { + nestedTargetDevicesVsys := TargetDevicesVsys{} + if oTargetDevicesVsys.Misc != nil { + entry.Misc["TargetDevicesVsys"] = oTargetDevicesVsys.Misc + } + if oTargetDevicesVsys.Name != "" { + nestedTargetDevicesVsys.Name = oTargetDevicesVsys.Name + } + nestedTargetDevices.Vsys = append(nestedTargetDevices.Vsys, nestedTargetDevicesVsys) + } + } + if oTargetDevices.Name != "" { + nestedTargetDevices.Name = oTargetDevices.Name + } + nestedTarget.Devices = append(nestedTarget.Devices, nestedTargetDevices) + } + } + if o.Target.Negate != nil { + nestedTarget.Negate = util.AsBool(o.Target.Negate, nil) + } + if o.Target.Tags != nil { + nestedTarget.Tags = util.MemToStr(o.Target.Tags) + } + } + entry.Target = nestedTarget + + entry.To = util.MemToStr(o.To) entry.Uuid = o.Uuid entry.Misc["Entry"] = o.Misc @@ -392,22 +661,22 @@ func SpecMatches(a, b *Entry) bool { if !util.StringsMatch(a.Action, b.Action) { return false } - if !util.OrderedListsMatch(a.Applications, b.Applications) { + if !util.OrderedListsMatch(a.Application, b.Application) { return false } - if !util.OrderedListsMatch(a.Categories, b.Categories) { + if !util.OrderedListsMatch(a.Category, b.Category) { return false } if !util.StringsMatch(a.Description, b.Description) { return false } - if !util.OrderedListsMatch(a.DestinationAddresses, b.DestinationAddresses) { + if !util.OrderedListsMatch(a.Destination, b.Destination) { return false } - if !util.OrderedListsMatch(a.DestinationHips, b.DestinationHips) { + if !util.OrderedListsMatch(a.DestinationHip, b.DestinationHip) { return false } - if !util.OrderedListsMatch(a.DestinationZones, b.DestinationZones) { + if !util.BoolsMatch(a.DisableInspect, b.DisableInspect) { return false } if !util.BoolsMatch(a.DisableServerResponseInspection, b.DisableServerResponseInspection) { @@ -416,6 +685,12 @@ func SpecMatches(a, b *Entry) bool { if !util.BoolsMatch(a.Disabled, b.Disabled) { return false } + if !util.OrderedListsMatch(a.From, b.From) { + return false + } + if !util.StringsMatch(a.GroupTag, b.GroupTag) { + return false + } if !util.BoolsMatch(a.IcmpUnreachable, b.IcmpUnreachable) { return false } @@ -437,25 +712,43 @@ func SpecMatches(a, b *Entry) bool { if !matchProfileSetting(a.ProfileSetting, b.ProfileSetting) { return false } + if !matchQos(a.Qos, b.Qos) { + return false + } if !util.StringsMatch(a.RuleType, b.RuleType) { return false } - if !util.OrderedListsMatch(a.Services, b.Services) { + if !util.StringsMatch(a.Schedule, b.Schedule) { return false } - if !util.OrderedListsMatch(a.SourceAddresses, b.SourceAddresses) { + if !util.OrderedListsMatch(a.Service, b.Service) { return false } - if !util.OrderedListsMatch(a.SourceHips, b.SourceHips) { + if !util.OrderedListsMatch(a.Source, b.Source) { return false } - if !util.OrderedListsMatch(a.SourceUsers, b.SourceUsers) { + if !util.OrderedListsMatch(a.SourceHip, b.SourceHip) { return false } - if !util.OrderedListsMatch(a.SourceZones, b.SourceZones) { + if !util.OrderedListsMatch(a.SourceImei, b.SourceImei) { return false } - if !util.OrderedListsMatch(a.Tags, b.Tags) { + if !util.OrderedListsMatch(a.SourceImsi, b.SourceImsi) { + return false + } + if !util.OrderedListsMatch(a.SourceNwSlice, b.SourceNwSlice) { + return false + } + if !util.OrderedListsMatch(a.SourceUser, b.SourceUser) { + return false + } + if !util.OrderedListsMatch(a.Tag, b.Tag) { + return false + } + if !matchTarget(a.Target, b.Target) { + return false + } + if !util.OrderedListsMatch(a.To, b.To) { return false } if !util.StringsMatch(a.Uuid, b.Uuid) { @@ -465,30 +758,72 @@ func SpecMatches(a, b *Entry) bool { return true } -func matchProfileSettingProfiles(a *ProfileSettingProfiles, b *ProfileSettingProfiles) bool { +func matchQosMarkingFollowC2sFlow(a *QosMarkingFollowC2sFlow, b *QosMarkingFollowC2sFlow) bool { if a == nil && b != nil || a != nil && b == nil { return false } else if a == nil && b == nil { return true } - if !util.OrderedListsMatch(a.Vulnerability, b.Vulnerability) { + return true +} +func matchQosMarking(a *QosMarking, b *QosMarking) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true } - if !util.OrderedListsMatch(a.UrlFiltering, b.UrlFiltering) { + if !matchQosMarkingFollowC2sFlow(a.FollowC2sFlow, b.FollowC2sFlow) { return false } - if !util.OrderedListsMatch(a.FileBlocking, b.FileBlocking) { + if !util.StringsMatch(a.IpDscp, b.IpDscp) { + return false + } + if !util.StringsMatch(a.IpPrecedence, b.IpPrecedence) { + return false + } + return true +} +func matchQos(a *Qos, b *Qos) bool { + if a == nil && b != nil || a != nil && b == nil { return false + } else if a == nil && b == nil { + return true + } + if !matchQosMarking(a.Marking, b.Marking) { + return false + } + return true +} +func matchProfileSettingProfiles(a *ProfileSettingProfiles, b *ProfileSettingProfiles) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true } if !util.OrderedListsMatch(a.WildfireAnalysis, b.WildfireAnalysis) { return false } - if !util.OrderedListsMatch(a.DataFiltering, b.DataFiltering) { + if !util.OrderedListsMatch(a.FileBlocking, b.FileBlocking) { + return false + } + if !util.OrderedListsMatch(a.Sctp, b.Sctp) { return false } if !util.OrderedListsMatch(a.Virus, b.Virus) { return false } + if !util.OrderedListsMatch(a.UrlFiltering, b.UrlFiltering) { + return false + } + if !util.OrderedListsMatch(a.Vulnerability, b.Vulnerability) { + return false + } + if !util.OrderedListsMatch(a.DataFiltering, b.DataFiltering) { + return false + } + if !util.OrderedListsMatch(a.Gtp, b.Gtp) { + return false + } if !util.OrderedListsMatch(a.Spyware, b.Spyware) { return false } @@ -500,7 +835,7 @@ func matchProfileSetting(a *ProfileSetting, b *ProfileSetting) bool { } else if a == nil && b == nil { return true } - if !util.StringsMatch(a.Group, b.Group) { + if !util.OrderedListsMatch(a.Group, b.Group) { return false } if !matchProfileSettingProfiles(a.Profiles, b.Profiles) { @@ -508,6 +843,56 @@ func matchProfileSetting(a *ProfileSetting, b *ProfileSetting) bool { } return true } +func matchTargetDevicesVsys(a []TargetDevicesVsys, b []TargetDevicesVsys) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchTargetDevices(a []TargetDevices, b []TargetDevices) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !matchTargetDevicesVsys(a.Vsys, b.Vsys) { + return false + } + } + } + return true +} +func matchTarget(a *Target, b *Target) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchTargetDevices(a.Devices, b.Devices) { + return false + } + if !util.BoolsMatch(a.Negate, b.Negate) { + return false + } + if !util.OrderedListsMatch(a.Tags, b.Tags) { + return false + } + return true +} func (o *Entry) EntryName() string { return o.Name diff --git a/policies/rules/security/location.go b/policies/rules/security/location.go index d24cdb87..f024f86e 100644 --- a/policies/rules/security/location.go +++ b/policies/rules/security/location.go @@ -15,10 +15,9 @@ type ImportLocation interface { } type Location struct { - DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` - FromPanoramaVsys *FromPanoramaVsysLocation `json:"from_panorama_vsys,omitempty"` - Shared *SharedLocation `json:"shared,omitempty"` - Vsys *VsysLocation `json:"vsys,omitempty"` + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared *SharedLocation `json:"shared,omitempty"` + Vsys *VsysLocation `json:"vsys,omitempty"` } type DeviceGroupLocation struct { @@ -27,17 +26,12 @@ type DeviceGroupLocation struct { Rulebase string `json:"rulebase"` } -type FromPanoramaVsysLocation struct { - Vsys string `json:"vsys"` -} - type SharedLocation struct { Rulebase string `json:"rulebase"` } type VsysLocation struct { NgfwDevice string `json:"ngfw_device"` - Rulebase string `json:"rulebase"` Vsys string `json:"vsys"` } @@ -49,12 +43,6 @@ func NewDeviceGroupLocation() *Location { }, } } -func NewFromPanoramaVsysLocation() *Location { - return &Location{FromPanoramaVsys: &FromPanoramaVsysLocation{ - Vsys: "vsys1", - }, - } -} func NewSharedLocation() *Location { return &Location{Shared: &SharedLocation{ Rulebase: "pre-rulebase", @@ -64,7 +52,6 @@ func NewSharedLocation() *Location { func NewVsysLocation() *Location { return &Location{Vsys: &VsysLocation{ NgfwDevice: "localhost.localdomain", - Rulebase: "pre-rulebase", Vsys: "vsys1", }, } @@ -85,11 +72,6 @@ func (o Location) IsValid() error { return fmt.Errorf("Rulebase is unspecified") } count++ - case o.FromPanoramaVsys != nil: - if o.FromPanoramaVsys.Vsys == "" { - return fmt.Errorf("Vsys is unspecified") - } - count++ case o.Shared != nil: if o.Shared.Rulebase == "" { return fmt.Errorf("Rulebase is unspecified") @@ -99,9 +81,6 @@ func (o Location) IsValid() error { if o.Vsys.NgfwDevice == "" { return fmt.Errorf("NgfwDevice is unspecified") } - if o.Vsys.Rulebase == "" { - return fmt.Errorf("Rulebase is unspecified") - } if o.Vsys.Vsys == "" { return fmt.Errorf("Vsys is unspecified") } @@ -142,17 +121,6 @@ func (o Location) XpathPrefix(vn version.Number) ([]string, error) { util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), o.DeviceGroup.Rulebase, } - case o.FromPanoramaVsys != nil: - if o.FromPanoramaVsys.Vsys == "" { - return nil, fmt.Errorf("Vsys is unspecified") - } - ans = []string{ - "config", - "panorama", - "vsys", - util.AsEntryXpath([]string{o.FromPanoramaVsys.Vsys}), - "rulebase", - } case o.Shared != nil: if o.Shared.Rulebase == "" { return nil, fmt.Errorf("Rulebase is unspecified") @@ -166,9 +134,6 @@ func (o Location) XpathPrefix(vn version.Number) ([]string, error) { if o.Vsys.NgfwDevice == "" { return nil, fmt.Errorf("NgfwDevice is unspecified") } - if o.Vsys.Rulebase == "" { - return nil, fmt.Errorf("Rulebase is unspecified") - } if o.Vsys.Vsys == "" { return nil, fmt.Errorf("Vsys is unspecified") } diff --git a/security/profiles/spyware/entry.go b/security/profiles/spyware/entry.go new file mode 100644 index 00000000..e33f05e6 --- /dev/null +++ b/security/profiles/spyware/entry.go @@ -0,0 +1,2544 @@ +package spyware + +import ( + "encoding/xml" + "fmt" + + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/generic" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +var ( + _ filtering.Fielder = &Entry{} +) + +var ( + Suffix = []string{"profiles", "spyware"} +) + +type Entry struct { + Name string + BotnetDomains *BotnetDomains + CloudInlineAnalysis *bool + Description *string + DisableOverride *string + InlineExceptionEdlUrl []string + InlineExceptionIpAddress []string + MicaEngineSpywareEnabled []MicaEngineSpywareEnabled + Rules []Rules + ThreatException []ThreatException + + Misc map[string][]generic.Xml +} + +type BotnetDomains struct { + DnsSecurityCategories []BotnetDomainsDnsSecurityCategories + Lists []BotnetDomainsLists + RtypeAction *BotnetDomainsRtypeAction + Sinkhole *BotnetDomainsSinkhole + ThreatException []BotnetDomainsThreatException + Whitelist []BotnetDomainsWhitelist +} +type BotnetDomainsDnsSecurityCategories struct { + Action *string + LogLevel *string + Name string + PacketCapture *string +} +type BotnetDomainsLists struct { + Action *BotnetDomainsListsAction + Name string + PacketCapture *string +} +type BotnetDomainsListsAction struct { + Alert *BotnetDomainsListsActionAlert + Allow *BotnetDomainsListsActionAllow + Block *BotnetDomainsListsActionBlock + Sinkhole *BotnetDomainsListsActionSinkhole +} +type BotnetDomainsListsActionAlert struct { +} +type BotnetDomainsListsActionAllow struct { +} +type BotnetDomainsListsActionBlock struct { +} +type BotnetDomainsListsActionSinkhole struct { +} +type BotnetDomainsRtypeAction struct { + Any *string + Https *string + Svcb *string +} +type BotnetDomainsSinkhole struct { + Ipv4Address *string + Ipv6Address *string +} +type BotnetDomainsThreatException struct { + Name string +} +type BotnetDomainsWhitelist struct { + Description *string + Name string +} +type MicaEngineSpywareEnabled struct { + InlinePolicyAction *string + Name string +} +type Rules struct { + Action *RulesAction + Category *string + Name string + PacketCapture *string + Severity []string + ThreatName *string +} +type RulesAction struct { + Alert *RulesActionAlert + Allow *RulesActionAllow + BlockIp *RulesActionBlockIp + Default *RulesActionDefault + Drop *RulesActionDrop + ResetBoth *RulesActionResetBoth + ResetClient *RulesActionResetClient + ResetServer *RulesActionResetServer +} +type RulesActionAlert struct { +} +type RulesActionAllow struct { +} +type RulesActionBlockIp struct { + Duration *int64 + TrackBy *string +} +type RulesActionDefault struct { +} +type RulesActionDrop struct { +} +type RulesActionResetBoth struct { +} +type RulesActionResetClient struct { +} +type RulesActionResetServer struct { +} +type ThreatException struct { + Action *ThreatExceptionAction + ExemptIp []ThreatExceptionExemptIp + Name string + PacketCapture *string +} +type ThreatExceptionAction struct { + Alert *ThreatExceptionActionAlert + Allow *ThreatExceptionActionAllow + BlockIp *ThreatExceptionActionBlockIp + Default *ThreatExceptionActionDefault + Drop *ThreatExceptionActionDrop + ResetBoth *ThreatExceptionActionResetBoth + ResetClient *ThreatExceptionActionResetClient + ResetServer *ThreatExceptionActionResetServer +} +type ThreatExceptionActionAlert struct { +} +type ThreatExceptionActionAllow struct { +} +type ThreatExceptionActionBlockIp struct { + Duration *int64 + TrackBy *string +} +type ThreatExceptionActionDefault struct { +} +type ThreatExceptionActionDrop struct { +} +type ThreatExceptionActionResetBoth struct { +} +type ThreatExceptionActionResetClient struct { +} +type ThreatExceptionActionResetServer struct { +} +type ThreatExceptionExemptIp struct { + Name string +} + +type entryXmlContainer struct { + Answer []entryXml `xml:"entry"` +} + +type entryXmlContainer_11_0_2 struct { + Answer []entryXml_11_0_2 `xml:"entry"` +} +type entryXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + BotnetDomains *BotnetDomainsXml `xml:"botnet-domains,omitempty"` + CloudInlineAnalysis *string `xml:"cloud-inline-analysis,omitempty"` + Description *string `xml:"description,omitempty"` + DisableOverride *string `xml:"disable-override,omitempty"` + InlineExceptionEdlUrl *util.MemberType `xml:"inline-exception-edl-url,omitempty"` + InlineExceptionIpAddress *util.MemberType `xml:"inline-exception-ip-address,omitempty"` + MicaEngineSpywareEnabled []MicaEngineSpywareEnabledXml `xml:"mica-engine-spyware-enabled>entry,omitempty"` + Rules []RulesXml `xml:"rules>entry,omitempty"` + ThreatException []ThreatExceptionXml `xml:"threat-exception>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type entryXml_11_0_2 struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + BotnetDomains *BotnetDomainsXml_11_0_2 `xml:"botnet-domains,omitempty"` + CloudInlineAnalysis *string `xml:"cloud-inline-analysis,omitempty"` + Description *string `xml:"description,omitempty"` + DisableOverride *string `xml:"disable-override,omitempty"` + InlineExceptionEdlUrl *util.MemberType `xml:"inline-exception-edl-url,omitempty"` + InlineExceptionIpAddress *util.MemberType `xml:"inline-exception-ip-address,omitempty"` + MicaEngineSpywareEnabled []MicaEngineSpywareEnabledXml_11_0_2 `xml:"mica-engine-spyware-enabled>entry,omitempty"` + Rules []RulesXml_11_0_2 `xml:"rules>entry,omitempty"` + ThreatException []ThreatExceptionXml_11_0_2 `xml:"threat-exception>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsXml struct { + DnsSecurityCategories []BotnetDomainsDnsSecurityCategoriesXml `xml:"dns-security-categories>entry,omitempty"` + Lists []BotnetDomainsListsXml `xml:"lists>entry,omitempty"` + RtypeAction *BotnetDomainsRtypeActionXml `xml:"rtype-action,omitempty"` + Sinkhole *BotnetDomainsSinkholeXml `xml:"sinkhole,omitempty"` + ThreatException []BotnetDomainsThreatExceptionXml `xml:"threat-exception>entry,omitempty"` + Whitelist []BotnetDomainsWhitelistXml `xml:"whitelist>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsDnsSecurityCategoriesXml struct { + Action *string `xml:"action,omitempty"` + LogLevel *string `xml:"log-level,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + PacketCapture *string `xml:"packet-capture,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsListsXml struct { + Action *BotnetDomainsListsActionXml `xml:"action,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + PacketCapture *string `xml:"packet-capture,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsListsActionXml struct { + Alert *BotnetDomainsListsActionAlertXml `xml:"alert,omitempty"` + Allow *BotnetDomainsListsActionAllowXml `xml:"allow,omitempty"` + Block *BotnetDomainsListsActionBlockXml `xml:"block,omitempty"` + Sinkhole *BotnetDomainsListsActionSinkholeXml `xml:"sinkhole,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsListsActionAlertXml struct { + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsListsActionAllowXml struct { + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsListsActionBlockXml struct { + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsListsActionSinkholeXml struct { + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsRtypeActionXml struct { + Any *string `xml:"any,omitempty"` + Https *string `xml:"https,omitempty"` + Svcb *string `xml:"svcb,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsSinkholeXml struct { + Ipv4Address *string `xml:"ipv4-address,omitempty"` + Ipv6Address *string `xml:"ipv6-address,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsThreatExceptionXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsWhitelistXml struct { + Description *string `xml:"description,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type MicaEngineSpywareEnabledXml struct { + InlinePolicyAction *string `xml:"inline-policy-action,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type RulesXml struct { + Action *RulesActionXml `xml:"action,omitempty"` + Category *string `xml:"category,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + PacketCapture *string `xml:"packet-capture,omitempty"` + Severity *util.MemberType `xml:"severity,omitempty"` + ThreatName *string `xml:"threat-name,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RulesActionXml struct { + Alert *RulesActionAlertXml `xml:"alert,omitempty"` + Allow *RulesActionAllowXml `xml:"allow,omitempty"` + BlockIp *RulesActionBlockIpXml `xml:"block-ip,omitempty"` + Default *RulesActionDefaultXml `xml:"default,omitempty"` + Drop *RulesActionDropXml `xml:"drop,omitempty"` + ResetBoth *RulesActionResetBothXml `xml:"reset-both,omitempty"` + ResetClient *RulesActionResetClientXml `xml:"reset-client,omitempty"` + ResetServer *RulesActionResetServerXml `xml:"reset-server,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RulesActionAlertXml struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionAllowXml struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionBlockIpXml struct { + Duration *int64 `xml:"duration,omitempty"` + TrackBy *string `xml:"track-by,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RulesActionDefaultXml struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionDropXml struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionResetBothXml struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionResetClientXml struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionResetServerXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionXml struct { + Action *ThreatExceptionActionXml `xml:"action,omitempty"` + ExemptIp []ThreatExceptionExemptIpXml `xml:"exempt-ip>entry,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + PacketCapture *string `xml:"packet-capture,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionXml struct { + Alert *ThreatExceptionActionAlertXml `xml:"alert,omitempty"` + Allow *ThreatExceptionActionAllowXml `xml:"allow,omitempty"` + BlockIp *ThreatExceptionActionBlockIpXml `xml:"block-ip,omitempty"` + Default *ThreatExceptionActionDefaultXml `xml:"default,omitempty"` + Drop *ThreatExceptionActionDropXml `xml:"drop,omitempty"` + ResetBoth *ThreatExceptionActionResetBothXml `xml:"reset-both,omitempty"` + ResetClient *ThreatExceptionActionResetClientXml `xml:"reset-client,omitempty"` + ResetServer *ThreatExceptionActionResetServerXml `xml:"reset-server,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionAlertXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionAllowXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionBlockIpXml struct { + Duration *int64 `xml:"duration,omitempty"` + TrackBy *string `xml:"track-by,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionDefaultXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionDropXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionResetBothXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionResetClientXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionResetServerXml struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionExemptIpXml struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsXml_11_0_2 struct { + DnsSecurityCategories []BotnetDomainsDnsSecurityCategoriesXml_11_0_2 `xml:"dns-security-categories>entry,omitempty"` + Lists []BotnetDomainsListsXml_11_0_2 `xml:"lists>entry,omitempty"` + RtypeAction *BotnetDomainsRtypeActionXml_11_0_2 `xml:"rtype-action,omitempty"` + Sinkhole *BotnetDomainsSinkholeXml_11_0_2 `xml:"sinkhole,omitempty"` + ThreatException []BotnetDomainsThreatExceptionXml_11_0_2 `xml:"threat-exception>entry,omitempty"` + Whitelist []BotnetDomainsWhitelistXml_11_0_2 `xml:"whitelist>entry,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsDnsSecurityCategoriesXml_11_0_2 struct { + Action *string `xml:"action,omitempty"` + LogLevel *string `xml:"log-level,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + PacketCapture *string `xml:"packet-capture,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsListsXml_11_0_2 struct { + Action *BotnetDomainsListsActionXml_11_0_2 `xml:"action,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + PacketCapture *string `xml:"packet-capture,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsListsActionXml_11_0_2 struct { + Alert *BotnetDomainsListsActionAlertXml_11_0_2 `xml:"alert,omitempty"` + Allow *BotnetDomainsListsActionAllowXml_11_0_2 `xml:"allow,omitempty"` + Block *BotnetDomainsListsActionBlockXml_11_0_2 `xml:"block,omitempty"` + Sinkhole *BotnetDomainsListsActionSinkholeXml_11_0_2 `xml:"sinkhole,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsListsActionAlertXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsListsActionAllowXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsListsActionBlockXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsListsActionSinkholeXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsRtypeActionXml_11_0_2 struct { + Any *string `xml:"any,omitempty"` + Https *string `xml:"https,omitempty"` + Svcb *string `xml:"svcb,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsSinkholeXml_11_0_2 struct { + Ipv4Address *string `xml:"ipv4-address,omitempty"` + Ipv6Address *string `xml:"ipv6-address,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsThreatExceptionXml_11_0_2 struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type BotnetDomainsWhitelistXml_11_0_2 struct { + Description *string `xml:"description,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type MicaEngineSpywareEnabledXml_11_0_2 struct { + InlinePolicyAction *string `xml:"inline-policy-action,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} +type RulesXml_11_0_2 struct { + Action *RulesActionXml_11_0_2 `xml:"action,omitempty"` + Category *string `xml:"category,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + PacketCapture *string `xml:"packet-capture,omitempty"` + Severity *util.MemberType `xml:"severity,omitempty"` + ThreatName *string `xml:"threat-name,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RulesActionXml_11_0_2 struct { + Alert *RulesActionAlertXml_11_0_2 `xml:"alert,omitempty"` + Allow *RulesActionAllowXml_11_0_2 `xml:"allow,omitempty"` + BlockIp *RulesActionBlockIpXml_11_0_2 `xml:"block-ip,omitempty"` + Default *RulesActionDefaultXml_11_0_2 `xml:"default,omitempty"` + Drop *RulesActionDropXml_11_0_2 `xml:"drop,omitempty"` + ResetBoth *RulesActionResetBothXml_11_0_2 `xml:"reset-both,omitempty"` + ResetClient *RulesActionResetClientXml_11_0_2 `xml:"reset-client,omitempty"` + ResetServer *RulesActionResetServerXml_11_0_2 `xml:"reset-server,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RulesActionAlertXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionAllowXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionBlockIpXml_11_0_2 struct { + Duration *int64 `xml:"duration,omitempty"` + TrackBy *string `xml:"track-by,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type RulesActionDefaultXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionDropXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionResetBothXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionResetClientXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type RulesActionResetServerXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionXml_11_0_2 struct { + Action *ThreatExceptionActionXml_11_0_2 `xml:"action,omitempty"` + ExemptIp []ThreatExceptionExemptIpXml_11_0_2 `xml:"exempt-ip>entry,omitempty"` + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + PacketCapture *string `xml:"packet-capture,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionXml_11_0_2 struct { + Alert *ThreatExceptionActionAlertXml_11_0_2 `xml:"alert,omitempty"` + Allow *ThreatExceptionActionAllowXml_11_0_2 `xml:"allow,omitempty"` + BlockIp *ThreatExceptionActionBlockIpXml_11_0_2 `xml:"block-ip,omitempty"` + Default *ThreatExceptionActionDefaultXml_11_0_2 `xml:"default,omitempty"` + Drop *ThreatExceptionActionDropXml_11_0_2 `xml:"drop,omitempty"` + ResetBoth *ThreatExceptionActionResetBothXml_11_0_2 `xml:"reset-both,omitempty"` + ResetClient *ThreatExceptionActionResetClientXml_11_0_2 `xml:"reset-client,omitempty"` + ResetServer *ThreatExceptionActionResetServerXml_11_0_2 `xml:"reset-server,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionAlertXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionAllowXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionBlockIpXml_11_0_2 struct { + Duration *int64 `xml:"duration,omitempty"` + TrackBy *string `xml:"track-by,omitempty"` + + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionDefaultXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionDropXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionResetBothXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionResetClientXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionActionResetServerXml_11_0_2 struct { + Misc []generic.Xml `xml:",any"` +} +type ThreatExceptionExemptIpXml_11_0_2 struct { + XMLName xml.Name `xml:"entry"` + Name string `xml:"name,attr"` + + Misc []generic.Xml `xml:",any"` +} + +func (e *Entry) Field(v string) (any, error) { + if v == "name" || v == "Name" { + return e.Name, nil + } + if v == "botnet_domains" || v == "BotnetDomains" { + return e.BotnetDomains, nil + } + if v == "cloud_inline_analysis" || v == "CloudInlineAnalysis" { + return e.CloudInlineAnalysis, nil + } + if v == "description" || v == "Description" { + return e.Description, nil + } + if v == "disable_override" || v == "DisableOverride" { + return e.DisableOverride, nil + } + if v == "inline_exception_edl_url" || v == "InlineExceptionEdlUrl" { + return e.InlineExceptionEdlUrl, nil + } + if v == "inline_exception_edl_url|LENGTH" || v == "InlineExceptionEdlUrl|LENGTH" { + return int64(len(e.InlineExceptionEdlUrl)), nil + } + if v == "inline_exception_ip_address" || v == "InlineExceptionIpAddress" { + return e.InlineExceptionIpAddress, nil + } + if v == "inline_exception_ip_address|LENGTH" || v == "InlineExceptionIpAddress|LENGTH" { + return int64(len(e.InlineExceptionIpAddress)), nil + } + if v == "mica_engine_spyware_enabled" || v == "MicaEngineSpywareEnabled" { + return e.MicaEngineSpywareEnabled, nil + } + if v == "mica_engine_spyware_enabled|LENGTH" || v == "MicaEngineSpywareEnabled|LENGTH" { + return int64(len(e.MicaEngineSpywareEnabled)), nil + } + if v == "rules" || v == "Rules" { + return e.Rules, nil + } + if v == "rules|LENGTH" || v == "Rules|LENGTH" { + return int64(len(e.Rules)), nil + } + if v == "threat_exception" || v == "ThreatException" { + return e.ThreatException, nil + } + if v == "threat_exception|LENGTH" || v == "ThreatException|LENGTH" { + return int64(len(e.ThreatException)), nil + } + + return nil, fmt.Errorf("unknown field") +} + +func Versioning(vn version.Number) (Specifier, Normalizer, error) { + version_11_0_2, _ := version.New("11.0.2") + version_11_1_0, _ := version.New("11.1.0") + if vn.Gte(version_11_0_2) && vn.Lt(version_11_1_0) { + return specifyEntry_11_0_2, &entryXmlContainer_11_0_2{}, nil + } + + return specifyEntry, &entryXmlContainer{}, nil +} +func specifyEntry(o *Entry) (any, error) { + entry := entryXml{} + entry.Name = o.Name + var nestedBotnetDomains *BotnetDomainsXml + if o.BotnetDomains != nil { + nestedBotnetDomains = &BotnetDomainsXml{} + if _, ok := o.Misc["BotnetDomains"]; ok { + nestedBotnetDomains.Misc = o.Misc["BotnetDomains"] + } + if o.BotnetDomains.Sinkhole != nil { + nestedBotnetDomains.Sinkhole = &BotnetDomainsSinkholeXml{} + if _, ok := o.Misc["BotnetDomainsSinkhole"]; ok { + nestedBotnetDomains.Sinkhole.Misc = o.Misc["BotnetDomainsSinkhole"] + } + if o.BotnetDomains.Sinkhole.Ipv4Address != nil { + nestedBotnetDomains.Sinkhole.Ipv4Address = o.BotnetDomains.Sinkhole.Ipv4Address + } + if o.BotnetDomains.Sinkhole.Ipv6Address != nil { + nestedBotnetDomains.Sinkhole.Ipv6Address = o.BotnetDomains.Sinkhole.Ipv6Address + } + } + if o.BotnetDomains.ThreatException != nil { + nestedBotnetDomains.ThreatException = []BotnetDomainsThreatExceptionXml{} + for _, oBotnetDomainsThreatException := range o.BotnetDomains.ThreatException { + nestedBotnetDomainsThreatException := BotnetDomainsThreatExceptionXml{} + if _, ok := o.Misc["BotnetDomainsThreatException"]; ok { + nestedBotnetDomainsThreatException.Misc = o.Misc["BotnetDomainsThreatException"] + } + if oBotnetDomainsThreatException.Name != "" { + nestedBotnetDomainsThreatException.Name = oBotnetDomainsThreatException.Name + } + nestedBotnetDomains.ThreatException = append(nestedBotnetDomains.ThreatException, nestedBotnetDomainsThreatException) + } + } + if o.BotnetDomains.Whitelist != nil { + nestedBotnetDomains.Whitelist = []BotnetDomainsWhitelistXml{} + for _, oBotnetDomainsWhitelist := range o.BotnetDomains.Whitelist { + nestedBotnetDomainsWhitelist := BotnetDomainsWhitelistXml{} + if _, ok := o.Misc["BotnetDomainsWhitelist"]; ok { + nestedBotnetDomainsWhitelist.Misc = o.Misc["BotnetDomainsWhitelist"] + } + if oBotnetDomainsWhitelist.Description != nil { + nestedBotnetDomainsWhitelist.Description = oBotnetDomainsWhitelist.Description + } + if oBotnetDomainsWhitelist.Name != "" { + nestedBotnetDomainsWhitelist.Name = oBotnetDomainsWhitelist.Name + } + nestedBotnetDomains.Whitelist = append(nestedBotnetDomains.Whitelist, nestedBotnetDomainsWhitelist) + } + } + if o.BotnetDomains.RtypeAction != nil { + nestedBotnetDomains.RtypeAction = &BotnetDomainsRtypeActionXml{} + if _, ok := o.Misc["BotnetDomainsRtypeAction"]; ok { + nestedBotnetDomains.RtypeAction.Misc = o.Misc["BotnetDomainsRtypeAction"] + } + if o.BotnetDomains.RtypeAction.Any != nil { + nestedBotnetDomains.RtypeAction.Any = o.BotnetDomains.RtypeAction.Any + } + if o.BotnetDomains.RtypeAction.Https != nil { + nestedBotnetDomains.RtypeAction.Https = o.BotnetDomains.RtypeAction.Https + } + if o.BotnetDomains.RtypeAction.Svcb != nil { + nestedBotnetDomains.RtypeAction.Svcb = o.BotnetDomains.RtypeAction.Svcb + } + } + if o.BotnetDomains.DnsSecurityCategories != nil { + nestedBotnetDomains.DnsSecurityCategories = []BotnetDomainsDnsSecurityCategoriesXml{} + for _, oBotnetDomainsDnsSecurityCategories := range o.BotnetDomains.DnsSecurityCategories { + nestedBotnetDomainsDnsSecurityCategories := BotnetDomainsDnsSecurityCategoriesXml{} + if _, ok := o.Misc["BotnetDomainsDnsSecurityCategories"]; ok { + nestedBotnetDomainsDnsSecurityCategories.Misc = o.Misc["BotnetDomainsDnsSecurityCategories"] + } + if oBotnetDomainsDnsSecurityCategories.Action != nil { + nestedBotnetDomainsDnsSecurityCategories.Action = oBotnetDomainsDnsSecurityCategories.Action + } + if oBotnetDomainsDnsSecurityCategories.LogLevel != nil { + nestedBotnetDomainsDnsSecurityCategories.LogLevel = oBotnetDomainsDnsSecurityCategories.LogLevel + } + if oBotnetDomainsDnsSecurityCategories.PacketCapture != nil { + nestedBotnetDomainsDnsSecurityCategories.PacketCapture = oBotnetDomainsDnsSecurityCategories.PacketCapture + } + if oBotnetDomainsDnsSecurityCategories.Name != "" { + nestedBotnetDomainsDnsSecurityCategories.Name = oBotnetDomainsDnsSecurityCategories.Name + } + nestedBotnetDomains.DnsSecurityCategories = append(nestedBotnetDomains.DnsSecurityCategories, nestedBotnetDomainsDnsSecurityCategories) + } + } + if o.BotnetDomains.Lists != nil { + nestedBotnetDomains.Lists = []BotnetDomainsListsXml{} + for _, oBotnetDomainsLists := range o.BotnetDomains.Lists { + nestedBotnetDomainsLists := BotnetDomainsListsXml{} + if _, ok := o.Misc["BotnetDomainsLists"]; ok { + nestedBotnetDomainsLists.Misc = o.Misc["BotnetDomainsLists"] + } + if oBotnetDomainsLists.Action != nil { + nestedBotnetDomainsLists.Action = &BotnetDomainsListsActionXml{} + if _, ok := o.Misc["BotnetDomainsListsAction"]; ok { + nestedBotnetDomainsLists.Action.Misc = o.Misc["BotnetDomainsListsAction"] + } + if oBotnetDomainsLists.Action.Alert != nil { + nestedBotnetDomainsLists.Action.Alert = &BotnetDomainsListsActionAlertXml{} + if _, ok := o.Misc["BotnetDomainsListsActionAlert"]; ok { + nestedBotnetDomainsLists.Action.Alert.Misc = o.Misc["BotnetDomainsListsActionAlert"] + } + } + if oBotnetDomainsLists.Action.Allow != nil { + nestedBotnetDomainsLists.Action.Allow = &BotnetDomainsListsActionAllowXml{} + if _, ok := o.Misc["BotnetDomainsListsActionAllow"]; ok { + nestedBotnetDomainsLists.Action.Allow.Misc = o.Misc["BotnetDomainsListsActionAllow"] + } + } + if oBotnetDomainsLists.Action.Block != nil { + nestedBotnetDomainsLists.Action.Block = &BotnetDomainsListsActionBlockXml{} + if _, ok := o.Misc["BotnetDomainsListsActionBlock"]; ok { + nestedBotnetDomainsLists.Action.Block.Misc = o.Misc["BotnetDomainsListsActionBlock"] + } + } + if oBotnetDomainsLists.Action.Sinkhole != nil { + nestedBotnetDomainsLists.Action.Sinkhole = &BotnetDomainsListsActionSinkholeXml{} + if _, ok := o.Misc["BotnetDomainsListsActionSinkhole"]; ok { + nestedBotnetDomainsLists.Action.Sinkhole.Misc = o.Misc["BotnetDomainsListsActionSinkhole"] + } + } + } + if oBotnetDomainsLists.PacketCapture != nil { + nestedBotnetDomainsLists.PacketCapture = oBotnetDomainsLists.PacketCapture + } + if oBotnetDomainsLists.Name != "" { + nestedBotnetDomainsLists.Name = oBotnetDomainsLists.Name + } + nestedBotnetDomains.Lists = append(nestedBotnetDomains.Lists, nestedBotnetDomainsLists) + } + } + } + entry.BotnetDomains = nestedBotnetDomains + + entry.CloudInlineAnalysis = util.YesNo(o.CloudInlineAnalysis, nil) + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + entry.InlineExceptionEdlUrl = util.StrToMem(o.InlineExceptionEdlUrl) + entry.InlineExceptionIpAddress = util.StrToMem(o.InlineExceptionIpAddress) + var nestedMicaEngineSpywareEnabledCol []MicaEngineSpywareEnabledXml + if o.MicaEngineSpywareEnabled != nil { + nestedMicaEngineSpywareEnabledCol = []MicaEngineSpywareEnabledXml{} + for _, oMicaEngineSpywareEnabled := range o.MicaEngineSpywareEnabled { + nestedMicaEngineSpywareEnabled := MicaEngineSpywareEnabledXml{} + if _, ok := o.Misc["MicaEngineSpywareEnabled"]; ok { + nestedMicaEngineSpywareEnabled.Misc = o.Misc["MicaEngineSpywareEnabled"] + } + if oMicaEngineSpywareEnabled.InlinePolicyAction != nil { + nestedMicaEngineSpywareEnabled.InlinePolicyAction = oMicaEngineSpywareEnabled.InlinePolicyAction + } + if oMicaEngineSpywareEnabled.Name != "" { + nestedMicaEngineSpywareEnabled.Name = oMicaEngineSpywareEnabled.Name + } + nestedMicaEngineSpywareEnabledCol = append(nestedMicaEngineSpywareEnabledCol, nestedMicaEngineSpywareEnabled) + } + entry.MicaEngineSpywareEnabled = nestedMicaEngineSpywareEnabledCol + } + + var nestedRulesCol []RulesXml + if o.Rules != nil { + nestedRulesCol = []RulesXml{} + for _, oRules := range o.Rules { + nestedRules := RulesXml{} + if _, ok := o.Misc["Rules"]; ok { + nestedRules.Misc = o.Misc["Rules"] + } + if oRules.Action != nil { + nestedRules.Action = &RulesActionXml{} + if _, ok := o.Misc["RulesAction"]; ok { + nestedRules.Action.Misc = o.Misc["RulesAction"] + } + if oRules.Action.Alert != nil { + nestedRules.Action.Alert = &RulesActionAlertXml{} + if _, ok := o.Misc["RulesActionAlert"]; ok { + nestedRules.Action.Alert.Misc = o.Misc["RulesActionAlert"] + } + } + if oRules.Action.Drop != nil { + nestedRules.Action.Drop = &RulesActionDropXml{} + if _, ok := o.Misc["RulesActionDrop"]; ok { + nestedRules.Action.Drop.Misc = o.Misc["RulesActionDrop"] + } + } + if oRules.Action.ResetClient != nil { + nestedRules.Action.ResetClient = &RulesActionResetClientXml{} + if _, ok := o.Misc["RulesActionResetClient"]; ok { + nestedRules.Action.ResetClient.Misc = o.Misc["RulesActionResetClient"] + } + } + if oRules.Action.ResetServer != nil { + nestedRules.Action.ResetServer = &RulesActionResetServerXml{} + if _, ok := o.Misc["RulesActionResetServer"]; ok { + nestedRules.Action.ResetServer.Misc = o.Misc["RulesActionResetServer"] + } + } + if oRules.Action.ResetBoth != nil { + nestedRules.Action.ResetBoth = &RulesActionResetBothXml{} + if _, ok := o.Misc["RulesActionResetBoth"]; ok { + nestedRules.Action.ResetBoth.Misc = o.Misc["RulesActionResetBoth"] + } + } + if oRules.Action.BlockIp != nil { + nestedRules.Action.BlockIp = &RulesActionBlockIpXml{} + if _, ok := o.Misc["RulesActionBlockIp"]; ok { + nestedRules.Action.BlockIp.Misc = o.Misc["RulesActionBlockIp"] + } + if oRules.Action.BlockIp.TrackBy != nil { + nestedRules.Action.BlockIp.TrackBy = oRules.Action.BlockIp.TrackBy + } + if oRules.Action.BlockIp.Duration != nil { + nestedRules.Action.BlockIp.Duration = oRules.Action.BlockIp.Duration + } + } + if oRules.Action.Default != nil { + nestedRules.Action.Default = &RulesActionDefaultXml{} + if _, ok := o.Misc["RulesActionDefault"]; ok { + nestedRules.Action.Default.Misc = o.Misc["RulesActionDefault"] + } + } + if oRules.Action.Allow != nil { + nestedRules.Action.Allow = &RulesActionAllowXml{} + if _, ok := o.Misc["RulesActionAllow"]; ok { + nestedRules.Action.Allow.Misc = o.Misc["RulesActionAllow"] + } + } + } + if oRules.Name != "" { + nestedRules.Name = oRules.Name + } + if oRules.ThreatName != nil { + nestedRules.ThreatName = oRules.ThreatName + } + if oRules.Category != nil { + nestedRules.Category = oRules.Category + } + if oRules.PacketCapture != nil { + nestedRules.PacketCapture = oRules.PacketCapture + } + if oRules.Severity != nil { + nestedRules.Severity = util.StrToMem(oRules.Severity) + } + nestedRulesCol = append(nestedRulesCol, nestedRules) + } + entry.Rules = nestedRulesCol + } + + var nestedThreatExceptionCol []ThreatExceptionXml + if o.ThreatException != nil { + nestedThreatExceptionCol = []ThreatExceptionXml{} + for _, oThreatException := range o.ThreatException { + nestedThreatException := ThreatExceptionXml{} + if _, ok := o.Misc["ThreatException"]; ok { + nestedThreatException.Misc = o.Misc["ThreatException"] + } + if oThreatException.ExemptIp != nil { + nestedThreatException.ExemptIp = []ThreatExceptionExemptIpXml{} + for _, oThreatExceptionExemptIp := range oThreatException.ExemptIp { + nestedThreatExceptionExemptIp := ThreatExceptionExemptIpXml{} + if _, ok := o.Misc["ThreatExceptionExemptIp"]; ok { + nestedThreatExceptionExemptIp.Misc = o.Misc["ThreatExceptionExemptIp"] + } + if oThreatExceptionExemptIp.Name != "" { + nestedThreatExceptionExemptIp.Name = oThreatExceptionExemptIp.Name + } + nestedThreatException.ExemptIp = append(nestedThreatException.ExemptIp, nestedThreatExceptionExemptIp) + } + } + if oThreatException.Name != "" { + nestedThreatException.Name = oThreatException.Name + } + if oThreatException.PacketCapture != nil { + nestedThreatException.PacketCapture = oThreatException.PacketCapture + } + if oThreatException.Action != nil { + nestedThreatException.Action = &ThreatExceptionActionXml{} + if _, ok := o.Misc["ThreatExceptionAction"]; ok { + nestedThreatException.Action.Misc = o.Misc["ThreatExceptionAction"] + } + if oThreatException.Action.ResetServer != nil { + nestedThreatException.Action.ResetServer = &ThreatExceptionActionResetServerXml{} + if _, ok := o.Misc["ThreatExceptionActionResetServer"]; ok { + nestedThreatException.Action.ResetServer.Misc = o.Misc["ThreatExceptionActionResetServer"] + } + } + if oThreatException.Action.BlockIp != nil { + nestedThreatException.Action.BlockIp = &ThreatExceptionActionBlockIpXml{} + if _, ok := o.Misc["ThreatExceptionActionBlockIp"]; ok { + nestedThreatException.Action.BlockIp.Misc = o.Misc["ThreatExceptionActionBlockIp"] + } + if oThreatException.Action.BlockIp.TrackBy != nil { + nestedThreatException.Action.BlockIp.TrackBy = oThreatException.Action.BlockIp.TrackBy + } + if oThreatException.Action.BlockIp.Duration != nil { + nestedThreatException.Action.BlockIp.Duration = oThreatException.Action.BlockIp.Duration + } + } + if oThreatException.Action.Default != nil { + nestedThreatException.Action.Default = &ThreatExceptionActionDefaultXml{} + if _, ok := o.Misc["ThreatExceptionActionDefault"]; ok { + nestedThreatException.Action.Default.Misc = o.Misc["ThreatExceptionActionDefault"] + } + } + if oThreatException.Action.Allow != nil { + nestedThreatException.Action.Allow = &ThreatExceptionActionAllowXml{} + if _, ok := o.Misc["ThreatExceptionActionAllow"]; ok { + nestedThreatException.Action.Allow.Misc = o.Misc["ThreatExceptionActionAllow"] + } + } + if oThreatException.Action.Alert != nil { + nestedThreatException.Action.Alert = &ThreatExceptionActionAlertXml{} + if _, ok := o.Misc["ThreatExceptionActionAlert"]; ok { + nestedThreatException.Action.Alert.Misc = o.Misc["ThreatExceptionActionAlert"] + } + } + if oThreatException.Action.Drop != nil { + nestedThreatException.Action.Drop = &ThreatExceptionActionDropXml{} + if _, ok := o.Misc["ThreatExceptionActionDrop"]; ok { + nestedThreatException.Action.Drop.Misc = o.Misc["ThreatExceptionActionDrop"] + } + } + if oThreatException.Action.ResetBoth != nil { + nestedThreatException.Action.ResetBoth = &ThreatExceptionActionResetBothXml{} + if _, ok := o.Misc["ThreatExceptionActionResetBoth"]; ok { + nestedThreatException.Action.ResetBoth.Misc = o.Misc["ThreatExceptionActionResetBoth"] + } + } + if oThreatException.Action.ResetClient != nil { + nestedThreatException.Action.ResetClient = &ThreatExceptionActionResetClientXml{} + if _, ok := o.Misc["ThreatExceptionActionResetClient"]; ok { + nestedThreatException.Action.ResetClient.Misc = o.Misc["ThreatExceptionActionResetClient"] + } + } + } + nestedThreatExceptionCol = append(nestedThreatExceptionCol, nestedThreatException) + } + entry.ThreatException = nestedThreatExceptionCol + } + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} + +func specifyEntry_11_0_2(o *Entry) (any, error) { + entry := entryXml_11_0_2{} + entry.Name = o.Name + var nestedBotnetDomains *BotnetDomainsXml_11_0_2 + if o.BotnetDomains != nil { + nestedBotnetDomains = &BotnetDomainsXml_11_0_2{} + if _, ok := o.Misc["BotnetDomains"]; ok { + nestedBotnetDomains.Misc = o.Misc["BotnetDomains"] + } + if o.BotnetDomains.DnsSecurityCategories != nil { + nestedBotnetDomains.DnsSecurityCategories = []BotnetDomainsDnsSecurityCategoriesXml_11_0_2{} + for _, oBotnetDomainsDnsSecurityCategories := range o.BotnetDomains.DnsSecurityCategories { + nestedBotnetDomainsDnsSecurityCategories := BotnetDomainsDnsSecurityCategoriesXml_11_0_2{} + if _, ok := o.Misc["BotnetDomainsDnsSecurityCategories"]; ok { + nestedBotnetDomainsDnsSecurityCategories.Misc = o.Misc["BotnetDomainsDnsSecurityCategories"] + } + if oBotnetDomainsDnsSecurityCategories.Action != nil { + nestedBotnetDomainsDnsSecurityCategories.Action = oBotnetDomainsDnsSecurityCategories.Action + } + if oBotnetDomainsDnsSecurityCategories.LogLevel != nil { + nestedBotnetDomainsDnsSecurityCategories.LogLevel = oBotnetDomainsDnsSecurityCategories.LogLevel + } + if oBotnetDomainsDnsSecurityCategories.PacketCapture != nil { + nestedBotnetDomainsDnsSecurityCategories.PacketCapture = oBotnetDomainsDnsSecurityCategories.PacketCapture + } + if oBotnetDomainsDnsSecurityCategories.Name != "" { + nestedBotnetDomainsDnsSecurityCategories.Name = oBotnetDomainsDnsSecurityCategories.Name + } + nestedBotnetDomains.DnsSecurityCategories = append(nestedBotnetDomains.DnsSecurityCategories, nestedBotnetDomainsDnsSecurityCategories) + } + } + if o.BotnetDomains.Lists != nil { + nestedBotnetDomains.Lists = []BotnetDomainsListsXml_11_0_2{} + for _, oBotnetDomainsLists := range o.BotnetDomains.Lists { + nestedBotnetDomainsLists := BotnetDomainsListsXml_11_0_2{} + if _, ok := o.Misc["BotnetDomainsLists"]; ok { + nestedBotnetDomainsLists.Misc = o.Misc["BotnetDomainsLists"] + } + if oBotnetDomainsLists.Name != "" { + nestedBotnetDomainsLists.Name = oBotnetDomainsLists.Name + } + if oBotnetDomainsLists.Action != nil { + nestedBotnetDomainsLists.Action = &BotnetDomainsListsActionXml_11_0_2{} + if _, ok := o.Misc["BotnetDomainsListsAction"]; ok { + nestedBotnetDomainsLists.Action.Misc = o.Misc["BotnetDomainsListsAction"] + } + if oBotnetDomainsLists.Action.Sinkhole != nil { + nestedBotnetDomainsLists.Action.Sinkhole = &BotnetDomainsListsActionSinkholeXml_11_0_2{} + if _, ok := o.Misc["BotnetDomainsListsActionSinkhole"]; ok { + nestedBotnetDomainsLists.Action.Sinkhole.Misc = o.Misc["BotnetDomainsListsActionSinkhole"] + } + } + if oBotnetDomainsLists.Action.Alert != nil { + nestedBotnetDomainsLists.Action.Alert = &BotnetDomainsListsActionAlertXml_11_0_2{} + if _, ok := o.Misc["BotnetDomainsListsActionAlert"]; ok { + nestedBotnetDomainsLists.Action.Alert.Misc = o.Misc["BotnetDomainsListsActionAlert"] + } + } + if oBotnetDomainsLists.Action.Allow != nil { + nestedBotnetDomainsLists.Action.Allow = &BotnetDomainsListsActionAllowXml_11_0_2{} + if _, ok := o.Misc["BotnetDomainsListsActionAllow"]; ok { + nestedBotnetDomainsLists.Action.Allow.Misc = o.Misc["BotnetDomainsListsActionAllow"] + } + } + if oBotnetDomainsLists.Action.Block != nil { + nestedBotnetDomainsLists.Action.Block = &BotnetDomainsListsActionBlockXml_11_0_2{} + if _, ok := o.Misc["BotnetDomainsListsActionBlock"]; ok { + nestedBotnetDomainsLists.Action.Block.Misc = o.Misc["BotnetDomainsListsActionBlock"] + } + } + } + if oBotnetDomainsLists.PacketCapture != nil { + nestedBotnetDomainsLists.PacketCapture = oBotnetDomainsLists.PacketCapture + } + nestedBotnetDomains.Lists = append(nestedBotnetDomains.Lists, nestedBotnetDomainsLists) + } + } + if o.BotnetDomains.Sinkhole != nil { + nestedBotnetDomains.Sinkhole = &BotnetDomainsSinkholeXml_11_0_2{} + if _, ok := o.Misc["BotnetDomainsSinkhole"]; ok { + nestedBotnetDomains.Sinkhole.Misc = o.Misc["BotnetDomainsSinkhole"] + } + if o.BotnetDomains.Sinkhole.Ipv6Address != nil { + nestedBotnetDomains.Sinkhole.Ipv6Address = o.BotnetDomains.Sinkhole.Ipv6Address + } + if o.BotnetDomains.Sinkhole.Ipv4Address != nil { + nestedBotnetDomains.Sinkhole.Ipv4Address = o.BotnetDomains.Sinkhole.Ipv4Address + } + } + if o.BotnetDomains.ThreatException != nil { + nestedBotnetDomains.ThreatException = []BotnetDomainsThreatExceptionXml_11_0_2{} + for _, oBotnetDomainsThreatException := range o.BotnetDomains.ThreatException { + nestedBotnetDomainsThreatException := BotnetDomainsThreatExceptionXml_11_0_2{} + if _, ok := o.Misc["BotnetDomainsThreatException"]; ok { + nestedBotnetDomainsThreatException.Misc = o.Misc["BotnetDomainsThreatException"] + } + if oBotnetDomainsThreatException.Name != "" { + nestedBotnetDomainsThreatException.Name = oBotnetDomainsThreatException.Name + } + nestedBotnetDomains.ThreatException = append(nestedBotnetDomains.ThreatException, nestedBotnetDomainsThreatException) + } + } + if o.BotnetDomains.Whitelist != nil { + nestedBotnetDomains.Whitelist = []BotnetDomainsWhitelistXml_11_0_2{} + for _, oBotnetDomainsWhitelist := range o.BotnetDomains.Whitelist { + nestedBotnetDomainsWhitelist := BotnetDomainsWhitelistXml_11_0_2{} + if _, ok := o.Misc["BotnetDomainsWhitelist"]; ok { + nestedBotnetDomainsWhitelist.Misc = o.Misc["BotnetDomainsWhitelist"] + } + if oBotnetDomainsWhitelist.Description != nil { + nestedBotnetDomainsWhitelist.Description = oBotnetDomainsWhitelist.Description + } + if oBotnetDomainsWhitelist.Name != "" { + nestedBotnetDomainsWhitelist.Name = oBotnetDomainsWhitelist.Name + } + nestedBotnetDomains.Whitelist = append(nestedBotnetDomains.Whitelist, nestedBotnetDomainsWhitelist) + } + } + if o.BotnetDomains.RtypeAction != nil { + nestedBotnetDomains.RtypeAction = &BotnetDomainsRtypeActionXml_11_0_2{} + if _, ok := o.Misc["BotnetDomainsRtypeAction"]; ok { + nestedBotnetDomains.RtypeAction.Misc = o.Misc["BotnetDomainsRtypeAction"] + } + if o.BotnetDomains.RtypeAction.Svcb != nil { + nestedBotnetDomains.RtypeAction.Svcb = o.BotnetDomains.RtypeAction.Svcb + } + if o.BotnetDomains.RtypeAction.Any != nil { + nestedBotnetDomains.RtypeAction.Any = o.BotnetDomains.RtypeAction.Any + } + if o.BotnetDomains.RtypeAction.Https != nil { + nestedBotnetDomains.RtypeAction.Https = o.BotnetDomains.RtypeAction.Https + } + } + } + entry.BotnetDomains = nestedBotnetDomains + + entry.CloudInlineAnalysis = util.YesNo(o.CloudInlineAnalysis, nil) + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + entry.InlineExceptionEdlUrl = util.StrToMem(o.InlineExceptionEdlUrl) + entry.InlineExceptionIpAddress = util.StrToMem(o.InlineExceptionIpAddress) + var nestedMicaEngineSpywareEnabledCol []MicaEngineSpywareEnabledXml_11_0_2 + if o.MicaEngineSpywareEnabled != nil { + nestedMicaEngineSpywareEnabledCol = []MicaEngineSpywareEnabledXml_11_0_2{} + for _, oMicaEngineSpywareEnabled := range o.MicaEngineSpywareEnabled { + nestedMicaEngineSpywareEnabled := MicaEngineSpywareEnabledXml_11_0_2{} + if _, ok := o.Misc["MicaEngineSpywareEnabled"]; ok { + nestedMicaEngineSpywareEnabled.Misc = o.Misc["MicaEngineSpywareEnabled"] + } + if oMicaEngineSpywareEnabled.InlinePolicyAction != nil { + nestedMicaEngineSpywareEnabled.InlinePolicyAction = oMicaEngineSpywareEnabled.InlinePolicyAction + } + if oMicaEngineSpywareEnabled.Name != "" { + nestedMicaEngineSpywareEnabled.Name = oMicaEngineSpywareEnabled.Name + } + nestedMicaEngineSpywareEnabledCol = append(nestedMicaEngineSpywareEnabledCol, nestedMicaEngineSpywareEnabled) + } + entry.MicaEngineSpywareEnabled = nestedMicaEngineSpywareEnabledCol + } + + var nestedRulesCol []RulesXml_11_0_2 + if o.Rules != nil { + nestedRulesCol = []RulesXml_11_0_2{} + for _, oRules := range o.Rules { + nestedRules := RulesXml_11_0_2{} + if _, ok := o.Misc["Rules"]; ok { + nestedRules.Misc = o.Misc["Rules"] + } + if oRules.Severity != nil { + nestedRules.Severity = util.StrToMem(oRules.Severity) + } + if oRules.Action != nil { + nestedRules.Action = &RulesActionXml_11_0_2{} + if _, ok := o.Misc["RulesAction"]; ok { + nestedRules.Action.Misc = o.Misc["RulesAction"] + } + if oRules.Action.Alert != nil { + nestedRules.Action.Alert = &RulesActionAlertXml_11_0_2{} + if _, ok := o.Misc["RulesActionAlert"]; ok { + nestedRules.Action.Alert.Misc = o.Misc["RulesActionAlert"] + } + } + if oRules.Action.Drop != nil { + nestedRules.Action.Drop = &RulesActionDropXml_11_0_2{} + if _, ok := o.Misc["RulesActionDrop"]; ok { + nestedRules.Action.Drop.Misc = o.Misc["RulesActionDrop"] + } + } + if oRules.Action.ResetClient != nil { + nestedRules.Action.ResetClient = &RulesActionResetClientXml_11_0_2{} + if _, ok := o.Misc["RulesActionResetClient"]; ok { + nestedRules.Action.ResetClient.Misc = o.Misc["RulesActionResetClient"] + } + } + if oRules.Action.ResetServer != nil { + nestedRules.Action.ResetServer = &RulesActionResetServerXml_11_0_2{} + if _, ok := o.Misc["RulesActionResetServer"]; ok { + nestedRules.Action.ResetServer.Misc = o.Misc["RulesActionResetServer"] + } + } + if oRules.Action.ResetBoth != nil { + nestedRules.Action.ResetBoth = &RulesActionResetBothXml_11_0_2{} + if _, ok := o.Misc["RulesActionResetBoth"]; ok { + nestedRules.Action.ResetBoth.Misc = o.Misc["RulesActionResetBoth"] + } + } + if oRules.Action.BlockIp != nil { + nestedRules.Action.BlockIp = &RulesActionBlockIpXml_11_0_2{} + if _, ok := o.Misc["RulesActionBlockIp"]; ok { + nestedRules.Action.BlockIp.Misc = o.Misc["RulesActionBlockIp"] + } + if oRules.Action.BlockIp.TrackBy != nil { + nestedRules.Action.BlockIp.TrackBy = oRules.Action.BlockIp.TrackBy + } + if oRules.Action.BlockIp.Duration != nil { + nestedRules.Action.BlockIp.Duration = oRules.Action.BlockIp.Duration + } + } + if oRules.Action.Default != nil { + nestedRules.Action.Default = &RulesActionDefaultXml_11_0_2{} + if _, ok := o.Misc["RulesActionDefault"]; ok { + nestedRules.Action.Default.Misc = o.Misc["RulesActionDefault"] + } + } + if oRules.Action.Allow != nil { + nestedRules.Action.Allow = &RulesActionAllowXml_11_0_2{} + if _, ok := o.Misc["RulesActionAllow"]; ok { + nestedRules.Action.Allow.Misc = o.Misc["RulesActionAllow"] + } + } + } + if oRules.Name != "" { + nestedRules.Name = oRules.Name + } + if oRules.ThreatName != nil { + nestedRules.ThreatName = oRules.ThreatName + } + if oRules.Category != nil { + nestedRules.Category = oRules.Category + } + if oRules.PacketCapture != nil { + nestedRules.PacketCapture = oRules.PacketCapture + } + nestedRulesCol = append(nestedRulesCol, nestedRules) + } + entry.Rules = nestedRulesCol + } + + var nestedThreatExceptionCol []ThreatExceptionXml_11_0_2 + if o.ThreatException != nil { + nestedThreatExceptionCol = []ThreatExceptionXml_11_0_2{} + for _, oThreatException := range o.ThreatException { + nestedThreatException := ThreatExceptionXml_11_0_2{} + if _, ok := o.Misc["ThreatException"]; ok { + nestedThreatException.Misc = o.Misc["ThreatException"] + } + if oThreatException.PacketCapture != nil { + nestedThreatException.PacketCapture = oThreatException.PacketCapture + } + if oThreatException.Action != nil { + nestedThreatException.Action = &ThreatExceptionActionXml_11_0_2{} + if _, ok := o.Misc["ThreatExceptionAction"]; ok { + nestedThreatException.Action.Misc = o.Misc["ThreatExceptionAction"] + } + if oThreatException.Action.BlockIp != nil { + nestedThreatException.Action.BlockIp = &ThreatExceptionActionBlockIpXml_11_0_2{} + if _, ok := o.Misc["ThreatExceptionActionBlockIp"]; ok { + nestedThreatException.Action.BlockIp.Misc = o.Misc["ThreatExceptionActionBlockIp"] + } + if oThreatException.Action.BlockIp.TrackBy != nil { + nestedThreatException.Action.BlockIp.TrackBy = oThreatException.Action.BlockIp.TrackBy + } + if oThreatException.Action.BlockIp.Duration != nil { + nestedThreatException.Action.BlockIp.Duration = oThreatException.Action.BlockIp.Duration + } + } + if oThreatException.Action.Default != nil { + nestedThreatException.Action.Default = &ThreatExceptionActionDefaultXml_11_0_2{} + if _, ok := o.Misc["ThreatExceptionActionDefault"]; ok { + nestedThreatException.Action.Default.Misc = o.Misc["ThreatExceptionActionDefault"] + } + } + if oThreatException.Action.Allow != nil { + nestedThreatException.Action.Allow = &ThreatExceptionActionAllowXml_11_0_2{} + if _, ok := o.Misc["ThreatExceptionActionAllow"]; ok { + nestedThreatException.Action.Allow.Misc = o.Misc["ThreatExceptionActionAllow"] + } + } + if oThreatException.Action.Alert != nil { + nestedThreatException.Action.Alert = &ThreatExceptionActionAlertXml_11_0_2{} + if _, ok := o.Misc["ThreatExceptionActionAlert"]; ok { + nestedThreatException.Action.Alert.Misc = o.Misc["ThreatExceptionActionAlert"] + } + } + if oThreatException.Action.Drop != nil { + nestedThreatException.Action.Drop = &ThreatExceptionActionDropXml_11_0_2{} + if _, ok := o.Misc["ThreatExceptionActionDrop"]; ok { + nestedThreatException.Action.Drop.Misc = o.Misc["ThreatExceptionActionDrop"] + } + } + if oThreatException.Action.ResetBoth != nil { + nestedThreatException.Action.ResetBoth = &ThreatExceptionActionResetBothXml_11_0_2{} + if _, ok := o.Misc["ThreatExceptionActionResetBoth"]; ok { + nestedThreatException.Action.ResetBoth.Misc = o.Misc["ThreatExceptionActionResetBoth"] + } + } + if oThreatException.Action.ResetClient != nil { + nestedThreatException.Action.ResetClient = &ThreatExceptionActionResetClientXml_11_0_2{} + if _, ok := o.Misc["ThreatExceptionActionResetClient"]; ok { + nestedThreatException.Action.ResetClient.Misc = o.Misc["ThreatExceptionActionResetClient"] + } + } + if oThreatException.Action.ResetServer != nil { + nestedThreatException.Action.ResetServer = &ThreatExceptionActionResetServerXml_11_0_2{} + if _, ok := o.Misc["ThreatExceptionActionResetServer"]; ok { + nestedThreatException.Action.ResetServer.Misc = o.Misc["ThreatExceptionActionResetServer"] + } + } + } + if oThreatException.ExemptIp != nil { + nestedThreatException.ExemptIp = []ThreatExceptionExemptIpXml_11_0_2{} + for _, oThreatExceptionExemptIp := range oThreatException.ExemptIp { + nestedThreatExceptionExemptIp := ThreatExceptionExemptIpXml_11_0_2{} + if _, ok := o.Misc["ThreatExceptionExemptIp"]; ok { + nestedThreatExceptionExemptIp.Misc = o.Misc["ThreatExceptionExemptIp"] + } + if oThreatExceptionExemptIp.Name != "" { + nestedThreatExceptionExemptIp.Name = oThreatExceptionExemptIp.Name + } + nestedThreatException.ExemptIp = append(nestedThreatException.ExemptIp, nestedThreatExceptionExemptIp) + } + } + if oThreatException.Name != "" { + nestedThreatException.Name = oThreatException.Name + } + nestedThreatExceptionCol = append(nestedThreatExceptionCol, nestedThreatException) + } + entry.ThreatException = nestedThreatExceptionCol + } + + entry.Misc = o.Misc["Entry"] + + return entry, nil +} +func (c *entryXmlContainer) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + var nestedBotnetDomains *BotnetDomains + if o.BotnetDomains != nil { + nestedBotnetDomains = &BotnetDomains{} + if o.BotnetDomains.Misc != nil { + entry.Misc["BotnetDomains"] = o.BotnetDomains.Misc + } + if o.BotnetDomains.ThreatException != nil { + nestedBotnetDomains.ThreatException = []BotnetDomainsThreatException{} + for _, oBotnetDomainsThreatException := range o.BotnetDomains.ThreatException { + nestedBotnetDomainsThreatException := BotnetDomainsThreatException{} + if oBotnetDomainsThreatException.Misc != nil { + entry.Misc["BotnetDomainsThreatException"] = oBotnetDomainsThreatException.Misc + } + if oBotnetDomainsThreatException.Name != "" { + nestedBotnetDomainsThreatException.Name = oBotnetDomainsThreatException.Name + } + nestedBotnetDomains.ThreatException = append(nestedBotnetDomains.ThreatException, nestedBotnetDomainsThreatException) + } + } + if o.BotnetDomains.Whitelist != nil { + nestedBotnetDomains.Whitelist = []BotnetDomainsWhitelist{} + for _, oBotnetDomainsWhitelist := range o.BotnetDomains.Whitelist { + nestedBotnetDomainsWhitelist := BotnetDomainsWhitelist{} + if oBotnetDomainsWhitelist.Misc != nil { + entry.Misc["BotnetDomainsWhitelist"] = oBotnetDomainsWhitelist.Misc + } + if oBotnetDomainsWhitelist.Description != nil { + nestedBotnetDomainsWhitelist.Description = oBotnetDomainsWhitelist.Description + } + if oBotnetDomainsWhitelist.Name != "" { + nestedBotnetDomainsWhitelist.Name = oBotnetDomainsWhitelist.Name + } + nestedBotnetDomains.Whitelist = append(nestedBotnetDomains.Whitelist, nestedBotnetDomainsWhitelist) + } + } + if o.BotnetDomains.RtypeAction != nil { + nestedBotnetDomains.RtypeAction = &BotnetDomainsRtypeAction{} + if o.BotnetDomains.RtypeAction.Misc != nil { + entry.Misc["BotnetDomainsRtypeAction"] = o.BotnetDomains.RtypeAction.Misc + } + if o.BotnetDomains.RtypeAction.Any != nil { + nestedBotnetDomains.RtypeAction.Any = o.BotnetDomains.RtypeAction.Any + } + if o.BotnetDomains.RtypeAction.Https != nil { + nestedBotnetDomains.RtypeAction.Https = o.BotnetDomains.RtypeAction.Https + } + if o.BotnetDomains.RtypeAction.Svcb != nil { + nestedBotnetDomains.RtypeAction.Svcb = o.BotnetDomains.RtypeAction.Svcb + } + } + if o.BotnetDomains.DnsSecurityCategories != nil { + nestedBotnetDomains.DnsSecurityCategories = []BotnetDomainsDnsSecurityCategories{} + for _, oBotnetDomainsDnsSecurityCategories := range o.BotnetDomains.DnsSecurityCategories { + nestedBotnetDomainsDnsSecurityCategories := BotnetDomainsDnsSecurityCategories{} + if oBotnetDomainsDnsSecurityCategories.Misc != nil { + entry.Misc["BotnetDomainsDnsSecurityCategories"] = oBotnetDomainsDnsSecurityCategories.Misc + } + if oBotnetDomainsDnsSecurityCategories.Action != nil { + nestedBotnetDomainsDnsSecurityCategories.Action = oBotnetDomainsDnsSecurityCategories.Action + } + if oBotnetDomainsDnsSecurityCategories.LogLevel != nil { + nestedBotnetDomainsDnsSecurityCategories.LogLevel = oBotnetDomainsDnsSecurityCategories.LogLevel + } + if oBotnetDomainsDnsSecurityCategories.PacketCapture != nil { + nestedBotnetDomainsDnsSecurityCategories.PacketCapture = oBotnetDomainsDnsSecurityCategories.PacketCapture + } + if oBotnetDomainsDnsSecurityCategories.Name != "" { + nestedBotnetDomainsDnsSecurityCategories.Name = oBotnetDomainsDnsSecurityCategories.Name + } + nestedBotnetDomains.DnsSecurityCategories = append(nestedBotnetDomains.DnsSecurityCategories, nestedBotnetDomainsDnsSecurityCategories) + } + } + if o.BotnetDomains.Lists != nil { + nestedBotnetDomains.Lists = []BotnetDomainsLists{} + for _, oBotnetDomainsLists := range o.BotnetDomains.Lists { + nestedBotnetDomainsLists := BotnetDomainsLists{} + if oBotnetDomainsLists.Misc != nil { + entry.Misc["BotnetDomainsLists"] = oBotnetDomainsLists.Misc + } + if oBotnetDomainsLists.Name != "" { + nestedBotnetDomainsLists.Name = oBotnetDomainsLists.Name + } + if oBotnetDomainsLists.Action != nil { + nestedBotnetDomainsLists.Action = &BotnetDomainsListsAction{} + if oBotnetDomainsLists.Action.Misc != nil { + entry.Misc["BotnetDomainsListsAction"] = oBotnetDomainsLists.Action.Misc + } + if oBotnetDomainsLists.Action.Allow != nil { + nestedBotnetDomainsLists.Action.Allow = &BotnetDomainsListsActionAllow{} + if oBotnetDomainsLists.Action.Allow.Misc != nil { + entry.Misc["BotnetDomainsListsActionAllow"] = oBotnetDomainsLists.Action.Allow.Misc + } + } + if oBotnetDomainsLists.Action.Block != nil { + nestedBotnetDomainsLists.Action.Block = &BotnetDomainsListsActionBlock{} + if oBotnetDomainsLists.Action.Block.Misc != nil { + entry.Misc["BotnetDomainsListsActionBlock"] = oBotnetDomainsLists.Action.Block.Misc + } + } + if oBotnetDomainsLists.Action.Sinkhole != nil { + nestedBotnetDomainsLists.Action.Sinkhole = &BotnetDomainsListsActionSinkhole{} + if oBotnetDomainsLists.Action.Sinkhole.Misc != nil { + entry.Misc["BotnetDomainsListsActionSinkhole"] = oBotnetDomainsLists.Action.Sinkhole.Misc + } + } + if oBotnetDomainsLists.Action.Alert != nil { + nestedBotnetDomainsLists.Action.Alert = &BotnetDomainsListsActionAlert{} + if oBotnetDomainsLists.Action.Alert.Misc != nil { + entry.Misc["BotnetDomainsListsActionAlert"] = oBotnetDomainsLists.Action.Alert.Misc + } + } + } + if oBotnetDomainsLists.PacketCapture != nil { + nestedBotnetDomainsLists.PacketCapture = oBotnetDomainsLists.PacketCapture + } + nestedBotnetDomains.Lists = append(nestedBotnetDomains.Lists, nestedBotnetDomainsLists) + } + } + if o.BotnetDomains.Sinkhole != nil { + nestedBotnetDomains.Sinkhole = &BotnetDomainsSinkhole{} + if o.BotnetDomains.Sinkhole.Misc != nil { + entry.Misc["BotnetDomainsSinkhole"] = o.BotnetDomains.Sinkhole.Misc + } + if o.BotnetDomains.Sinkhole.Ipv4Address != nil { + nestedBotnetDomains.Sinkhole.Ipv4Address = o.BotnetDomains.Sinkhole.Ipv4Address + } + if o.BotnetDomains.Sinkhole.Ipv6Address != nil { + nestedBotnetDomains.Sinkhole.Ipv6Address = o.BotnetDomains.Sinkhole.Ipv6Address + } + } + } + entry.BotnetDomains = nestedBotnetDomains + + entry.CloudInlineAnalysis = util.AsBool(o.CloudInlineAnalysis, nil) + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + entry.InlineExceptionEdlUrl = util.MemToStr(o.InlineExceptionEdlUrl) + entry.InlineExceptionIpAddress = util.MemToStr(o.InlineExceptionIpAddress) + var nestedMicaEngineSpywareEnabledCol []MicaEngineSpywareEnabled + if o.MicaEngineSpywareEnabled != nil { + nestedMicaEngineSpywareEnabledCol = []MicaEngineSpywareEnabled{} + for _, oMicaEngineSpywareEnabled := range o.MicaEngineSpywareEnabled { + nestedMicaEngineSpywareEnabled := MicaEngineSpywareEnabled{} + if oMicaEngineSpywareEnabled.Misc != nil { + entry.Misc["MicaEngineSpywareEnabled"] = oMicaEngineSpywareEnabled.Misc + } + if oMicaEngineSpywareEnabled.InlinePolicyAction != nil { + nestedMicaEngineSpywareEnabled.InlinePolicyAction = oMicaEngineSpywareEnabled.InlinePolicyAction + } + if oMicaEngineSpywareEnabled.Name != "" { + nestedMicaEngineSpywareEnabled.Name = oMicaEngineSpywareEnabled.Name + } + nestedMicaEngineSpywareEnabledCol = append(nestedMicaEngineSpywareEnabledCol, nestedMicaEngineSpywareEnabled) + } + entry.MicaEngineSpywareEnabled = nestedMicaEngineSpywareEnabledCol + } + + var nestedRulesCol []Rules + if o.Rules != nil { + nestedRulesCol = []Rules{} + for _, oRules := range o.Rules { + nestedRules := Rules{} + if oRules.Misc != nil { + entry.Misc["Rules"] = oRules.Misc + } + if oRules.Category != nil { + nestedRules.Category = oRules.Category + } + if oRules.PacketCapture != nil { + nestedRules.PacketCapture = oRules.PacketCapture + } + if oRules.Severity != nil { + nestedRules.Severity = util.MemToStr(oRules.Severity) + } + if oRules.Action != nil { + nestedRules.Action = &RulesAction{} + if oRules.Action.Misc != nil { + entry.Misc["RulesAction"] = oRules.Action.Misc + } + if oRules.Action.BlockIp != nil { + nestedRules.Action.BlockIp = &RulesActionBlockIp{} + if oRules.Action.BlockIp.Misc != nil { + entry.Misc["RulesActionBlockIp"] = oRules.Action.BlockIp.Misc + } + if oRules.Action.BlockIp.TrackBy != nil { + nestedRules.Action.BlockIp.TrackBy = oRules.Action.BlockIp.TrackBy + } + if oRules.Action.BlockIp.Duration != nil { + nestedRules.Action.BlockIp.Duration = oRules.Action.BlockIp.Duration + } + } + if oRules.Action.Default != nil { + nestedRules.Action.Default = &RulesActionDefault{} + if oRules.Action.Default.Misc != nil { + entry.Misc["RulesActionDefault"] = oRules.Action.Default.Misc + } + } + if oRules.Action.Allow != nil { + nestedRules.Action.Allow = &RulesActionAllow{} + if oRules.Action.Allow.Misc != nil { + entry.Misc["RulesActionAllow"] = oRules.Action.Allow.Misc + } + } + if oRules.Action.Alert != nil { + nestedRules.Action.Alert = &RulesActionAlert{} + if oRules.Action.Alert.Misc != nil { + entry.Misc["RulesActionAlert"] = oRules.Action.Alert.Misc + } + } + if oRules.Action.Drop != nil { + nestedRules.Action.Drop = &RulesActionDrop{} + if oRules.Action.Drop.Misc != nil { + entry.Misc["RulesActionDrop"] = oRules.Action.Drop.Misc + } + } + if oRules.Action.ResetClient != nil { + nestedRules.Action.ResetClient = &RulesActionResetClient{} + if oRules.Action.ResetClient.Misc != nil { + entry.Misc["RulesActionResetClient"] = oRules.Action.ResetClient.Misc + } + } + if oRules.Action.ResetServer != nil { + nestedRules.Action.ResetServer = &RulesActionResetServer{} + if oRules.Action.ResetServer.Misc != nil { + entry.Misc["RulesActionResetServer"] = oRules.Action.ResetServer.Misc + } + } + if oRules.Action.ResetBoth != nil { + nestedRules.Action.ResetBoth = &RulesActionResetBoth{} + if oRules.Action.ResetBoth.Misc != nil { + entry.Misc["RulesActionResetBoth"] = oRules.Action.ResetBoth.Misc + } + } + } + if oRules.Name != "" { + nestedRules.Name = oRules.Name + } + if oRules.ThreatName != nil { + nestedRules.ThreatName = oRules.ThreatName + } + nestedRulesCol = append(nestedRulesCol, nestedRules) + } + entry.Rules = nestedRulesCol + } + + var nestedThreatExceptionCol []ThreatException + if o.ThreatException != nil { + nestedThreatExceptionCol = []ThreatException{} + for _, oThreatException := range o.ThreatException { + nestedThreatException := ThreatException{} + if oThreatException.Misc != nil { + entry.Misc["ThreatException"] = oThreatException.Misc + } + if oThreatException.PacketCapture != nil { + nestedThreatException.PacketCapture = oThreatException.PacketCapture + } + if oThreatException.Action != nil { + nestedThreatException.Action = &ThreatExceptionAction{} + if oThreatException.Action.Misc != nil { + entry.Misc["ThreatExceptionAction"] = oThreatException.Action.Misc + } + if oThreatException.Action.ResetClient != nil { + nestedThreatException.Action.ResetClient = &ThreatExceptionActionResetClient{} + if oThreatException.Action.ResetClient.Misc != nil { + entry.Misc["ThreatExceptionActionResetClient"] = oThreatException.Action.ResetClient.Misc + } + } + if oThreatException.Action.ResetServer != nil { + nestedThreatException.Action.ResetServer = &ThreatExceptionActionResetServer{} + if oThreatException.Action.ResetServer.Misc != nil { + entry.Misc["ThreatExceptionActionResetServer"] = oThreatException.Action.ResetServer.Misc + } + } + if oThreatException.Action.BlockIp != nil { + nestedThreatException.Action.BlockIp = &ThreatExceptionActionBlockIp{} + if oThreatException.Action.BlockIp.Misc != nil { + entry.Misc["ThreatExceptionActionBlockIp"] = oThreatException.Action.BlockIp.Misc + } + if oThreatException.Action.BlockIp.Duration != nil { + nestedThreatException.Action.BlockIp.Duration = oThreatException.Action.BlockIp.Duration + } + if oThreatException.Action.BlockIp.TrackBy != nil { + nestedThreatException.Action.BlockIp.TrackBy = oThreatException.Action.BlockIp.TrackBy + } + } + if oThreatException.Action.Default != nil { + nestedThreatException.Action.Default = &ThreatExceptionActionDefault{} + if oThreatException.Action.Default.Misc != nil { + entry.Misc["ThreatExceptionActionDefault"] = oThreatException.Action.Default.Misc + } + } + if oThreatException.Action.Allow != nil { + nestedThreatException.Action.Allow = &ThreatExceptionActionAllow{} + if oThreatException.Action.Allow.Misc != nil { + entry.Misc["ThreatExceptionActionAllow"] = oThreatException.Action.Allow.Misc + } + } + if oThreatException.Action.Alert != nil { + nestedThreatException.Action.Alert = &ThreatExceptionActionAlert{} + if oThreatException.Action.Alert.Misc != nil { + entry.Misc["ThreatExceptionActionAlert"] = oThreatException.Action.Alert.Misc + } + } + if oThreatException.Action.Drop != nil { + nestedThreatException.Action.Drop = &ThreatExceptionActionDrop{} + if oThreatException.Action.Drop.Misc != nil { + entry.Misc["ThreatExceptionActionDrop"] = oThreatException.Action.Drop.Misc + } + } + if oThreatException.Action.ResetBoth != nil { + nestedThreatException.Action.ResetBoth = &ThreatExceptionActionResetBoth{} + if oThreatException.Action.ResetBoth.Misc != nil { + entry.Misc["ThreatExceptionActionResetBoth"] = oThreatException.Action.ResetBoth.Misc + } + } + } + if oThreatException.ExemptIp != nil { + nestedThreatException.ExemptIp = []ThreatExceptionExemptIp{} + for _, oThreatExceptionExemptIp := range oThreatException.ExemptIp { + nestedThreatExceptionExemptIp := ThreatExceptionExemptIp{} + if oThreatExceptionExemptIp.Misc != nil { + entry.Misc["ThreatExceptionExemptIp"] = oThreatExceptionExemptIp.Misc + } + if oThreatExceptionExemptIp.Name != "" { + nestedThreatExceptionExemptIp.Name = oThreatExceptionExemptIp.Name + } + nestedThreatException.ExemptIp = append(nestedThreatException.ExemptIp, nestedThreatExceptionExemptIp) + } + } + if oThreatException.Name != "" { + nestedThreatException.Name = oThreatException.Name + } + nestedThreatExceptionCol = append(nestedThreatExceptionCol, nestedThreatException) + } + entry.ThreatException = nestedThreatExceptionCol + } + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} +func (c *entryXmlContainer_11_0_2) Normalize() ([]*Entry, error) { + entryList := make([]*Entry, 0, len(c.Answer)) + for _, o := range c.Answer { + entry := &Entry{ + Misc: make(map[string][]generic.Xml), + } + entry.Name = o.Name + var nestedBotnetDomains *BotnetDomains + if o.BotnetDomains != nil { + nestedBotnetDomains = &BotnetDomains{} + if o.BotnetDomains.Misc != nil { + entry.Misc["BotnetDomains"] = o.BotnetDomains.Misc + } + if o.BotnetDomains.DnsSecurityCategories != nil { + nestedBotnetDomains.DnsSecurityCategories = []BotnetDomainsDnsSecurityCategories{} + for _, oBotnetDomainsDnsSecurityCategories := range o.BotnetDomains.DnsSecurityCategories { + nestedBotnetDomainsDnsSecurityCategories := BotnetDomainsDnsSecurityCategories{} + if oBotnetDomainsDnsSecurityCategories.Misc != nil { + entry.Misc["BotnetDomainsDnsSecurityCategories"] = oBotnetDomainsDnsSecurityCategories.Misc + } + if oBotnetDomainsDnsSecurityCategories.Name != "" { + nestedBotnetDomainsDnsSecurityCategories.Name = oBotnetDomainsDnsSecurityCategories.Name + } + if oBotnetDomainsDnsSecurityCategories.Action != nil { + nestedBotnetDomainsDnsSecurityCategories.Action = oBotnetDomainsDnsSecurityCategories.Action + } + if oBotnetDomainsDnsSecurityCategories.LogLevel != nil { + nestedBotnetDomainsDnsSecurityCategories.LogLevel = oBotnetDomainsDnsSecurityCategories.LogLevel + } + if oBotnetDomainsDnsSecurityCategories.PacketCapture != nil { + nestedBotnetDomainsDnsSecurityCategories.PacketCapture = oBotnetDomainsDnsSecurityCategories.PacketCapture + } + nestedBotnetDomains.DnsSecurityCategories = append(nestedBotnetDomains.DnsSecurityCategories, nestedBotnetDomainsDnsSecurityCategories) + } + } + if o.BotnetDomains.Lists != nil { + nestedBotnetDomains.Lists = []BotnetDomainsLists{} + for _, oBotnetDomainsLists := range o.BotnetDomains.Lists { + nestedBotnetDomainsLists := BotnetDomainsLists{} + if oBotnetDomainsLists.Misc != nil { + entry.Misc["BotnetDomainsLists"] = oBotnetDomainsLists.Misc + } + if oBotnetDomainsLists.Name != "" { + nestedBotnetDomainsLists.Name = oBotnetDomainsLists.Name + } + if oBotnetDomainsLists.Action != nil { + nestedBotnetDomainsLists.Action = &BotnetDomainsListsAction{} + if oBotnetDomainsLists.Action.Misc != nil { + entry.Misc["BotnetDomainsListsAction"] = oBotnetDomainsLists.Action.Misc + } + if oBotnetDomainsLists.Action.Alert != nil { + nestedBotnetDomainsLists.Action.Alert = &BotnetDomainsListsActionAlert{} + if oBotnetDomainsLists.Action.Alert.Misc != nil { + entry.Misc["BotnetDomainsListsActionAlert"] = oBotnetDomainsLists.Action.Alert.Misc + } + } + if oBotnetDomainsLists.Action.Allow != nil { + nestedBotnetDomainsLists.Action.Allow = &BotnetDomainsListsActionAllow{} + if oBotnetDomainsLists.Action.Allow.Misc != nil { + entry.Misc["BotnetDomainsListsActionAllow"] = oBotnetDomainsLists.Action.Allow.Misc + } + } + if oBotnetDomainsLists.Action.Block != nil { + nestedBotnetDomainsLists.Action.Block = &BotnetDomainsListsActionBlock{} + if oBotnetDomainsLists.Action.Block.Misc != nil { + entry.Misc["BotnetDomainsListsActionBlock"] = oBotnetDomainsLists.Action.Block.Misc + } + } + if oBotnetDomainsLists.Action.Sinkhole != nil { + nestedBotnetDomainsLists.Action.Sinkhole = &BotnetDomainsListsActionSinkhole{} + if oBotnetDomainsLists.Action.Sinkhole.Misc != nil { + entry.Misc["BotnetDomainsListsActionSinkhole"] = oBotnetDomainsLists.Action.Sinkhole.Misc + } + } + } + if oBotnetDomainsLists.PacketCapture != nil { + nestedBotnetDomainsLists.PacketCapture = oBotnetDomainsLists.PacketCapture + } + nestedBotnetDomains.Lists = append(nestedBotnetDomains.Lists, nestedBotnetDomainsLists) + } + } + if o.BotnetDomains.Sinkhole != nil { + nestedBotnetDomains.Sinkhole = &BotnetDomainsSinkhole{} + if o.BotnetDomains.Sinkhole.Misc != nil { + entry.Misc["BotnetDomainsSinkhole"] = o.BotnetDomains.Sinkhole.Misc + } + if o.BotnetDomains.Sinkhole.Ipv4Address != nil { + nestedBotnetDomains.Sinkhole.Ipv4Address = o.BotnetDomains.Sinkhole.Ipv4Address + } + if o.BotnetDomains.Sinkhole.Ipv6Address != nil { + nestedBotnetDomains.Sinkhole.Ipv6Address = o.BotnetDomains.Sinkhole.Ipv6Address + } + } + if o.BotnetDomains.ThreatException != nil { + nestedBotnetDomains.ThreatException = []BotnetDomainsThreatException{} + for _, oBotnetDomainsThreatException := range o.BotnetDomains.ThreatException { + nestedBotnetDomainsThreatException := BotnetDomainsThreatException{} + if oBotnetDomainsThreatException.Misc != nil { + entry.Misc["BotnetDomainsThreatException"] = oBotnetDomainsThreatException.Misc + } + if oBotnetDomainsThreatException.Name != "" { + nestedBotnetDomainsThreatException.Name = oBotnetDomainsThreatException.Name + } + nestedBotnetDomains.ThreatException = append(nestedBotnetDomains.ThreatException, nestedBotnetDomainsThreatException) + } + } + if o.BotnetDomains.Whitelist != nil { + nestedBotnetDomains.Whitelist = []BotnetDomainsWhitelist{} + for _, oBotnetDomainsWhitelist := range o.BotnetDomains.Whitelist { + nestedBotnetDomainsWhitelist := BotnetDomainsWhitelist{} + if oBotnetDomainsWhitelist.Misc != nil { + entry.Misc["BotnetDomainsWhitelist"] = oBotnetDomainsWhitelist.Misc + } + if oBotnetDomainsWhitelist.Description != nil { + nestedBotnetDomainsWhitelist.Description = oBotnetDomainsWhitelist.Description + } + if oBotnetDomainsWhitelist.Name != "" { + nestedBotnetDomainsWhitelist.Name = oBotnetDomainsWhitelist.Name + } + nestedBotnetDomains.Whitelist = append(nestedBotnetDomains.Whitelist, nestedBotnetDomainsWhitelist) + } + } + if o.BotnetDomains.RtypeAction != nil { + nestedBotnetDomains.RtypeAction = &BotnetDomainsRtypeAction{} + if o.BotnetDomains.RtypeAction.Misc != nil { + entry.Misc["BotnetDomainsRtypeAction"] = o.BotnetDomains.RtypeAction.Misc + } + if o.BotnetDomains.RtypeAction.Any != nil { + nestedBotnetDomains.RtypeAction.Any = o.BotnetDomains.RtypeAction.Any + } + if o.BotnetDomains.RtypeAction.Https != nil { + nestedBotnetDomains.RtypeAction.Https = o.BotnetDomains.RtypeAction.Https + } + if o.BotnetDomains.RtypeAction.Svcb != nil { + nestedBotnetDomains.RtypeAction.Svcb = o.BotnetDomains.RtypeAction.Svcb + } + } + } + entry.BotnetDomains = nestedBotnetDomains + + entry.CloudInlineAnalysis = util.AsBool(o.CloudInlineAnalysis, nil) + entry.Description = o.Description + entry.DisableOverride = o.DisableOverride + entry.InlineExceptionEdlUrl = util.MemToStr(o.InlineExceptionEdlUrl) + entry.InlineExceptionIpAddress = util.MemToStr(o.InlineExceptionIpAddress) + var nestedMicaEngineSpywareEnabledCol []MicaEngineSpywareEnabled + if o.MicaEngineSpywareEnabled != nil { + nestedMicaEngineSpywareEnabledCol = []MicaEngineSpywareEnabled{} + for _, oMicaEngineSpywareEnabled := range o.MicaEngineSpywareEnabled { + nestedMicaEngineSpywareEnabled := MicaEngineSpywareEnabled{} + if oMicaEngineSpywareEnabled.Misc != nil { + entry.Misc["MicaEngineSpywareEnabled"] = oMicaEngineSpywareEnabled.Misc + } + if oMicaEngineSpywareEnabled.InlinePolicyAction != nil { + nestedMicaEngineSpywareEnabled.InlinePolicyAction = oMicaEngineSpywareEnabled.InlinePolicyAction + } + if oMicaEngineSpywareEnabled.Name != "" { + nestedMicaEngineSpywareEnabled.Name = oMicaEngineSpywareEnabled.Name + } + nestedMicaEngineSpywareEnabledCol = append(nestedMicaEngineSpywareEnabledCol, nestedMicaEngineSpywareEnabled) + } + entry.MicaEngineSpywareEnabled = nestedMicaEngineSpywareEnabledCol + } + + var nestedRulesCol []Rules + if o.Rules != nil { + nestedRulesCol = []Rules{} + for _, oRules := range o.Rules { + nestedRules := Rules{} + if oRules.Misc != nil { + entry.Misc["Rules"] = oRules.Misc + } + if oRules.PacketCapture != nil { + nestedRules.PacketCapture = oRules.PacketCapture + } + if oRules.Severity != nil { + nestedRules.Severity = util.MemToStr(oRules.Severity) + } + if oRules.Action != nil { + nestedRules.Action = &RulesAction{} + if oRules.Action.Misc != nil { + entry.Misc["RulesAction"] = oRules.Action.Misc + } + if oRules.Action.Default != nil { + nestedRules.Action.Default = &RulesActionDefault{} + if oRules.Action.Default.Misc != nil { + entry.Misc["RulesActionDefault"] = oRules.Action.Default.Misc + } + } + if oRules.Action.Allow != nil { + nestedRules.Action.Allow = &RulesActionAllow{} + if oRules.Action.Allow.Misc != nil { + entry.Misc["RulesActionAllow"] = oRules.Action.Allow.Misc + } + } + if oRules.Action.Alert != nil { + nestedRules.Action.Alert = &RulesActionAlert{} + if oRules.Action.Alert.Misc != nil { + entry.Misc["RulesActionAlert"] = oRules.Action.Alert.Misc + } + } + if oRules.Action.Drop != nil { + nestedRules.Action.Drop = &RulesActionDrop{} + if oRules.Action.Drop.Misc != nil { + entry.Misc["RulesActionDrop"] = oRules.Action.Drop.Misc + } + } + if oRules.Action.ResetClient != nil { + nestedRules.Action.ResetClient = &RulesActionResetClient{} + if oRules.Action.ResetClient.Misc != nil { + entry.Misc["RulesActionResetClient"] = oRules.Action.ResetClient.Misc + } + } + if oRules.Action.ResetServer != nil { + nestedRules.Action.ResetServer = &RulesActionResetServer{} + if oRules.Action.ResetServer.Misc != nil { + entry.Misc["RulesActionResetServer"] = oRules.Action.ResetServer.Misc + } + } + if oRules.Action.ResetBoth != nil { + nestedRules.Action.ResetBoth = &RulesActionResetBoth{} + if oRules.Action.ResetBoth.Misc != nil { + entry.Misc["RulesActionResetBoth"] = oRules.Action.ResetBoth.Misc + } + } + if oRules.Action.BlockIp != nil { + nestedRules.Action.BlockIp = &RulesActionBlockIp{} + if oRules.Action.BlockIp.Misc != nil { + entry.Misc["RulesActionBlockIp"] = oRules.Action.BlockIp.Misc + } + if oRules.Action.BlockIp.TrackBy != nil { + nestedRules.Action.BlockIp.TrackBy = oRules.Action.BlockIp.TrackBy + } + if oRules.Action.BlockIp.Duration != nil { + nestedRules.Action.BlockIp.Duration = oRules.Action.BlockIp.Duration + } + } + } + if oRules.Name != "" { + nestedRules.Name = oRules.Name + } + if oRules.ThreatName != nil { + nestedRules.ThreatName = oRules.ThreatName + } + if oRules.Category != nil { + nestedRules.Category = oRules.Category + } + nestedRulesCol = append(nestedRulesCol, nestedRules) + } + entry.Rules = nestedRulesCol + } + + var nestedThreatExceptionCol []ThreatException + if o.ThreatException != nil { + nestedThreatExceptionCol = []ThreatException{} + for _, oThreatException := range o.ThreatException { + nestedThreatException := ThreatException{} + if oThreatException.Misc != nil { + entry.Misc["ThreatException"] = oThreatException.Misc + } + if oThreatException.ExemptIp != nil { + nestedThreatException.ExemptIp = []ThreatExceptionExemptIp{} + for _, oThreatExceptionExemptIp := range oThreatException.ExemptIp { + nestedThreatExceptionExemptIp := ThreatExceptionExemptIp{} + if oThreatExceptionExemptIp.Misc != nil { + entry.Misc["ThreatExceptionExemptIp"] = oThreatExceptionExemptIp.Misc + } + if oThreatExceptionExemptIp.Name != "" { + nestedThreatExceptionExemptIp.Name = oThreatExceptionExemptIp.Name + } + nestedThreatException.ExemptIp = append(nestedThreatException.ExemptIp, nestedThreatExceptionExemptIp) + } + } + if oThreatException.Name != "" { + nestedThreatException.Name = oThreatException.Name + } + if oThreatException.PacketCapture != nil { + nestedThreatException.PacketCapture = oThreatException.PacketCapture + } + if oThreatException.Action != nil { + nestedThreatException.Action = &ThreatExceptionAction{} + if oThreatException.Action.Misc != nil { + entry.Misc["ThreatExceptionAction"] = oThreatException.Action.Misc + } + if oThreatException.Action.ResetBoth != nil { + nestedThreatException.Action.ResetBoth = &ThreatExceptionActionResetBoth{} + if oThreatException.Action.ResetBoth.Misc != nil { + entry.Misc["ThreatExceptionActionResetBoth"] = oThreatException.Action.ResetBoth.Misc + } + } + if oThreatException.Action.ResetClient != nil { + nestedThreatException.Action.ResetClient = &ThreatExceptionActionResetClient{} + if oThreatException.Action.ResetClient.Misc != nil { + entry.Misc["ThreatExceptionActionResetClient"] = oThreatException.Action.ResetClient.Misc + } + } + if oThreatException.Action.ResetServer != nil { + nestedThreatException.Action.ResetServer = &ThreatExceptionActionResetServer{} + if oThreatException.Action.ResetServer.Misc != nil { + entry.Misc["ThreatExceptionActionResetServer"] = oThreatException.Action.ResetServer.Misc + } + } + if oThreatException.Action.BlockIp != nil { + nestedThreatException.Action.BlockIp = &ThreatExceptionActionBlockIp{} + if oThreatException.Action.BlockIp.Misc != nil { + entry.Misc["ThreatExceptionActionBlockIp"] = oThreatException.Action.BlockIp.Misc + } + if oThreatException.Action.BlockIp.Duration != nil { + nestedThreatException.Action.BlockIp.Duration = oThreatException.Action.BlockIp.Duration + } + if oThreatException.Action.BlockIp.TrackBy != nil { + nestedThreatException.Action.BlockIp.TrackBy = oThreatException.Action.BlockIp.TrackBy + } + } + if oThreatException.Action.Default != nil { + nestedThreatException.Action.Default = &ThreatExceptionActionDefault{} + if oThreatException.Action.Default.Misc != nil { + entry.Misc["ThreatExceptionActionDefault"] = oThreatException.Action.Default.Misc + } + } + if oThreatException.Action.Allow != nil { + nestedThreatException.Action.Allow = &ThreatExceptionActionAllow{} + if oThreatException.Action.Allow.Misc != nil { + entry.Misc["ThreatExceptionActionAllow"] = oThreatException.Action.Allow.Misc + } + } + if oThreatException.Action.Alert != nil { + nestedThreatException.Action.Alert = &ThreatExceptionActionAlert{} + if oThreatException.Action.Alert.Misc != nil { + entry.Misc["ThreatExceptionActionAlert"] = oThreatException.Action.Alert.Misc + } + } + if oThreatException.Action.Drop != nil { + nestedThreatException.Action.Drop = &ThreatExceptionActionDrop{} + if oThreatException.Action.Drop.Misc != nil { + entry.Misc["ThreatExceptionActionDrop"] = oThreatException.Action.Drop.Misc + } + } + } + nestedThreatExceptionCol = append(nestedThreatExceptionCol, nestedThreatException) + } + entry.ThreatException = nestedThreatExceptionCol + } + + entry.Misc["Entry"] = o.Misc + + entryList = append(entryList, entry) + } + + return entryList, nil +} + +func SpecMatches(a, b *Entry) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + + // Don't compare Name. + if !matchBotnetDomains(a.BotnetDomains, b.BotnetDomains) { + return false + } + if !util.BoolsMatch(a.CloudInlineAnalysis, b.CloudInlineAnalysis) { + return false + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + if !util.StringsMatch(a.DisableOverride, b.DisableOverride) { + return false + } + if !util.OrderedListsMatch(a.InlineExceptionEdlUrl, b.InlineExceptionEdlUrl) { + return false + } + if !util.OrderedListsMatch(a.InlineExceptionIpAddress, b.InlineExceptionIpAddress) { + return false + } + if !matchMicaEngineSpywareEnabled(a.MicaEngineSpywareEnabled, b.MicaEngineSpywareEnabled) { + return false + } + if !matchRules(a.Rules, b.Rules) { + return false + } + if !matchThreatException(a.ThreatException, b.ThreatException) { + return false + } + + return true +} + +func matchMicaEngineSpywareEnabled(a []MicaEngineSpywareEnabled, b []MicaEngineSpywareEnabled) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.InlinePolicyAction, b.InlinePolicyAction) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchRulesActionResetBoth(a *RulesActionResetBoth, b *RulesActionResetBoth) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRulesActionBlockIp(a *RulesActionBlockIp, b *RulesActionBlockIp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.TrackBy, b.TrackBy) { + return false + } + if !util.Ints64Match(a.Duration, b.Duration) { + return false + } + return true +} +func matchRulesActionDefault(a *RulesActionDefault, b *RulesActionDefault) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRulesActionAllow(a *RulesActionAllow, b *RulesActionAllow) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRulesActionAlert(a *RulesActionAlert, b *RulesActionAlert) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRulesActionDrop(a *RulesActionDrop, b *RulesActionDrop) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRulesActionResetClient(a *RulesActionResetClient, b *RulesActionResetClient) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRulesActionResetServer(a *RulesActionResetServer, b *RulesActionResetServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchRulesAction(a *RulesAction, b *RulesAction) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchRulesActionResetClient(a.ResetClient, b.ResetClient) { + return false + } + if !matchRulesActionResetServer(a.ResetServer, b.ResetServer) { + return false + } + if !matchRulesActionResetBoth(a.ResetBoth, b.ResetBoth) { + return false + } + if !matchRulesActionBlockIp(a.BlockIp, b.BlockIp) { + return false + } + if !matchRulesActionDefault(a.Default, b.Default) { + return false + } + if !matchRulesActionAllow(a.Allow, b.Allow) { + return false + } + if !matchRulesActionAlert(a.Alert, b.Alert) { + return false + } + if !matchRulesActionDrop(a.Drop, b.Drop) { + return false + } + return true +} +func matchRules(a []Rules, b []Rules) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.ThreatName, b.ThreatName) { + return false + } + if !util.StringsMatch(a.Category, b.Category) { + return false + } + if !util.StringsMatch(a.PacketCapture, b.PacketCapture) { + return false + } + if !util.OrderedListsMatch(a.Severity, b.Severity) { + return false + } + if !matchRulesAction(a.Action, b.Action) { + return false + } + } + } + return true +} +func matchBotnetDomainsRtypeAction(a *BotnetDomainsRtypeAction, b *BotnetDomainsRtypeAction) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Any, b.Any) { + return false + } + if !util.StringsMatch(a.Https, b.Https) { + return false + } + if !util.StringsMatch(a.Svcb, b.Svcb) { + return false + } + return true +} +func matchBotnetDomainsDnsSecurityCategories(a []BotnetDomainsDnsSecurityCategories, b []BotnetDomainsDnsSecurityCategories) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.Action, b.Action) { + return false + } + if !util.StringsMatch(a.LogLevel, b.LogLevel) { + return false + } + if !util.StringsMatch(a.PacketCapture, b.PacketCapture) { + return false + } + } + } + return true +} +func matchBotnetDomainsListsActionBlock(a *BotnetDomainsListsActionBlock, b *BotnetDomainsListsActionBlock) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchBotnetDomainsListsActionSinkhole(a *BotnetDomainsListsActionSinkhole, b *BotnetDomainsListsActionSinkhole) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchBotnetDomainsListsActionAlert(a *BotnetDomainsListsActionAlert, b *BotnetDomainsListsActionAlert) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchBotnetDomainsListsActionAllow(a *BotnetDomainsListsActionAllow, b *BotnetDomainsListsActionAllow) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchBotnetDomainsListsAction(a *BotnetDomainsListsAction, b *BotnetDomainsListsAction) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchBotnetDomainsListsActionAlert(a.Alert, b.Alert) { + return false + } + if !matchBotnetDomainsListsActionAllow(a.Allow, b.Allow) { + return false + } + if !matchBotnetDomainsListsActionBlock(a.Block, b.Block) { + return false + } + if !matchBotnetDomainsListsActionSinkhole(a.Sinkhole, b.Sinkhole) { + return false + } + return true +} +func matchBotnetDomainsLists(a []BotnetDomainsLists, b []BotnetDomainsLists) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !matchBotnetDomainsListsAction(a.Action, b.Action) { + return false + } + if !util.StringsMatch(a.PacketCapture, b.PacketCapture) { + return false + } + } + } + return true +} +func matchBotnetDomainsSinkhole(a *BotnetDomainsSinkhole, b *BotnetDomainsSinkhole) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.Ipv4Address, b.Ipv4Address) { + return false + } + if !util.StringsMatch(a.Ipv6Address, b.Ipv6Address) { + return false + } + return true +} +func matchBotnetDomainsThreatException(a []BotnetDomainsThreatException, b []BotnetDomainsThreatException) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchBotnetDomainsWhitelist(a []BotnetDomainsWhitelist, b []BotnetDomainsWhitelist) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + if !util.StringsMatch(a.Description, b.Description) { + return false + } + } + } + return true +} +func matchBotnetDomains(a *BotnetDomains, b *BotnetDomains) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchBotnetDomainsDnsSecurityCategories(a.DnsSecurityCategories, b.DnsSecurityCategories) { + return false + } + if !matchBotnetDomainsLists(a.Lists, b.Lists) { + return false + } + if !matchBotnetDomainsSinkhole(a.Sinkhole, b.Sinkhole) { + return false + } + if !matchBotnetDomainsThreatException(a.ThreatException, b.ThreatException) { + return false + } + if !matchBotnetDomainsWhitelist(a.Whitelist, b.Whitelist) { + return false + } + if !matchBotnetDomainsRtypeAction(a.RtypeAction, b.RtypeAction) { + return false + } + return true +} +func matchThreatExceptionActionResetServer(a *ThreatExceptionActionResetServer, b *ThreatExceptionActionResetServer) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchThreatExceptionActionBlockIp(a *ThreatExceptionActionBlockIp, b *ThreatExceptionActionBlockIp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !util.StringsMatch(a.TrackBy, b.TrackBy) { + return false + } + if !util.Ints64Match(a.Duration, b.Duration) { + return false + } + return true +} +func matchThreatExceptionActionDefault(a *ThreatExceptionActionDefault, b *ThreatExceptionActionDefault) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchThreatExceptionActionAllow(a *ThreatExceptionActionAllow, b *ThreatExceptionActionAllow) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchThreatExceptionActionAlert(a *ThreatExceptionActionAlert, b *ThreatExceptionActionAlert) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchThreatExceptionActionDrop(a *ThreatExceptionActionDrop, b *ThreatExceptionActionDrop) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchThreatExceptionActionResetBoth(a *ThreatExceptionActionResetBoth, b *ThreatExceptionActionResetBoth) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchThreatExceptionActionResetClient(a *ThreatExceptionActionResetClient, b *ThreatExceptionActionResetClient) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + return true +} +func matchThreatExceptionAction(a *ThreatExceptionAction, b *ThreatExceptionAction) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + if !matchThreatExceptionActionAllow(a.Allow, b.Allow) { + return false + } + if !matchThreatExceptionActionAlert(a.Alert, b.Alert) { + return false + } + if !matchThreatExceptionActionDrop(a.Drop, b.Drop) { + return false + } + if !matchThreatExceptionActionResetBoth(a.ResetBoth, b.ResetBoth) { + return false + } + if !matchThreatExceptionActionResetClient(a.ResetClient, b.ResetClient) { + return false + } + if !matchThreatExceptionActionResetServer(a.ResetServer, b.ResetServer) { + return false + } + if !matchThreatExceptionActionBlockIp(a.BlockIp, b.BlockIp) { + return false + } + if !matchThreatExceptionActionDefault(a.Default, b.Default) { + return false + } + return true +} +func matchThreatExceptionExemptIp(a []ThreatExceptionExemptIp, b []ThreatExceptionExemptIp) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} +func matchThreatException(a []ThreatException, b []ThreatException) bool { + if a == nil && b != nil || a != nil && b == nil { + return false + } else if a == nil && b == nil { + return true + } + for _, a := range a { + for _, b := range b { + if !util.StringsMatch(a.PacketCapture, b.PacketCapture) { + return false + } + if !matchThreatExceptionAction(a.Action, b.Action) { + return false + } + if !matchThreatExceptionExemptIp(a.ExemptIp, b.ExemptIp) { + return false + } + if !util.StringsEqual(a.Name, b.Name) { + return false + } + } + } + return true +} + +func (o *Entry) EntryName() string { + return o.Name +} + +func (o *Entry) SetEntryName(name string) { + o.Name = name +} diff --git a/security/profiles/spyware/interfaces.go b/security/profiles/spyware/interfaces.go new file mode 100644 index 00000000..7ee4b102 --- /dev/null +++ b/security/profiles/spyware/interfaces.go @@ -0,0 +1,7 @@ +package spyware + +type Specifier func(*Entry) (any, error) + +type Normalizer interface { + Normalize() ([]*Entry, error) +} diff --git a/security/profiles/spyware/location.go b/security/profiles/spyware/location.go new file mode 100644 index 00000000..efefdef0 --- /dev/null +++ b/security/profiles/spyware/location.go @@ -0,0 +1,118 @@ +package spyware + +import ( + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/version" +) + +type ImportLocation interface { + XpathForLocation(version.Number, util.ILocation) ([]string, error) + MarshalPangoXML([]string) (string, error) + UnmarshalPangoXML([]byte) ([]string, error) +} + +type Location struct { + DeviceGroup *DeviceGroupLocation `json:"device_group,omitempty"` + Shared bool `json:"shared"` +} + +type DeviceGroupLocation struct { + DeviceGroup string `json:"device_group"` + PanoramaDevice string `json:"panorama_device"` +} + +func NewDeviceGroupLocation() *Location { + return &Location{DeviceGroup: &DeviceGroupLocation{ + DeviceGroup: "", + PanoramaDevice: "localhost.localdomain", + }, + } +} +func NewSharedLocation() *Location { + return &Location{ + Shared: true, + } +} + +func (o Location) IsValid() error { + count := 0 + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return fmt.Errorf("PanoramaDevice is unspecified") + } + count++ + case o.Shared: + count++ + } + + if count == 0 { + return fmt.Errorf("no path specified") + } + + if count > 1 { + return fmt.Errorf("multiple paths specified: only one should be specified") + } + + return nil +} + +func (o Location) XpathPrefix(vn version.Number) ([]string, error) { + + var ans []string + + switch { + case o.DeviceGroup != nil: + if o.DeviceGroup.DeviceGroup == "" { + return nil, fmt.Errorf("DeviceGroup is unspecified") + } + if o.DeviceGroup.PanoramaDevice == "" { + return nil, fmt.Errorf("PanoramaDevice is unspecified") + } + ans = []string{ + "config", + "devices", + util.AsEntryXpath([]string{o.DeviceGroup.PanoramaDevice}), + "device-group", + util.AsEntryXpath([]string{o.DeviceGroup.DeviceGroup}), + } + case o.Shared: + ans = []string{ + "config", + "shared", + } + default: + return nil, errors.NoLocationSpecifiedError + } + + return ans, nil +} +func (o Location) XpathWithEntryName(vn version.Number, name string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsEntryXpath([]string{name})) + + return ans, nil +} +func (o Location) XpathWithUuid(vn version.Number, uuid string) ([]string, error) { + + ans, err := o.XpathPrefix(vn) + if err != nil { + return nil, err + } + ans = append(ans, Suffix...) + ans = append(ans, util.AsUuidXpath(uuid)) + + return ans, nil +} diff --git a/security/profiles/spyware/service.go b/security/profiles/spyware/service.go new file mode 100644 index 00000000..ebcc46cf --- /dev/null +++ b/security/profiles/spyware/service.go @@ -0,0 +1,281 @@ +package spyware + +import ( + "context" + "fmt" + + "github.com/PaloAltoNetworks/pango/errors" + "github.com/PaloAltoNetworks/pango/filtering" + "github.com/PaloAltoNetworks/pango/util" + "github.com/PaloAltoNetworks/pango/xmlapi" +) + +type Service struct { + client util.PangoClient +} + +func NewService(client util.PangoClient) *Service { + return &Service{ + client: client, + } +} + +// Create adds new item, then returns the result. +func (s *Service) Create(ctx context.Context, loc Location, entry *Entry) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + createSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + cmd := &xmlapi.Config{ + Action: "set", + Xpath: util.AsXpath(path[:len(path)-1]), + Element: createSpec, + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, false, nil); err != nil { + return nil, err + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Read returns the given config object, using the specified action ("get" or "show"). +func (s *Service) Read(ctx context.Context, loc Location, name, action string) (*Entry, error) { + return s.read(ctx, loc, name, action, false) +} + +// ReadFromConfig returns the given config object from the loaded XML config. +// Requires that client.LoadPanosConfig() has been invoked. +func (s *Service) ReadFromConfig(ctx context.Context, loc Location, name string) (*Entry, error) { + return s.read(ctx, loc, name, "", true) +} + +func (s *Service) read(ctx context.Context, loc Location, value, action string, usePanosConfig bool) (*Entry, error) { + if value == "" { + return nil, errors.NameNotSpecifiedError + } + vn := s.client.Versioning() + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, true, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, errors.ObjectNotFound() + } + return nil, err + } + } + + list, err := normalizer.Normalize() + if err != nil { + return nil, err + } else if len(list) != 1 { + return nil, fmt.Errorf("expected to %q 1 entry, got %d", action, len(list)) + } + + return list[0], nil +} + +// Update updates the given config object, then returns the result. +func (s *Service) Update(ctx context.Context, loc Location, entry *Entry, name string) (*Entry, error) { + return s.update(ctx, loc, entry, name) +} +func (s *Service) update(ctx context.Context, loc Location, entry *Entry, value string) (*Entry, error) { + if entry.Name == "" { + return nil, errors.NameNotSpecifiedError + } + + vn := s.client.Versioning() + updates := xmlapi.NewMultiConfig(2) + specifier, _, err := Versioning(vn) + if err != nil { + return nil, err + } + var old *Entry + if value != "" && value != entry.Name { + path, err := loc.XpathWithEntryName(vn, value) + if err != nil { + return nil, err + } + + old, err = s.Read(ctx, loc, value, "get") + + updates.Add(&xmlapi.Config{ + Action: "rename", + Xpath: util.AsXpath(path), + NewName: entry.Name, + Target: s.client.GetTarget(), + }) + } else { + old, err = s.Read(ctx, loc, entry.Name, "get") + } + if err != nil { + return nil, err + } else if old == nil { + return nil, fmt.Errorf("previous object doesn't exist for update") + } + if !SpecMatches(entry, old) { + path, err := loc.XpathWithEntryName(vn, entry.Name) + if err != nil { + return nil, err + } + + updateSpec, err := specifier(entry) + if err != nil { + return nil, err + } + + updates.Add(&xmlapi.Config{ + Action: "edit", + Xpath: util.AsXpath(path), + Element: updateSpec, + Target: s.client.GetTarget(), + }) + } + + if len(updates.Operations) != 0 { + if _, _, _, err = s.client.MultiConfig(ctx, updates, false, nil); err != nil { + return nil, err + } + } + return s.Read(ctx, loc, entry.Name, "get") +} + +// Delete deletes the given item. +func (s *Service) Delete(ctx context.Context, loc Location, name ...string) error { + return s.delete(ctx, loc, name) +} +func (s *Service) delete(ctx context.Context, loc Location, values []string) error { + for _, value := range values { + if value == "" { + return errors.NameNotSpecifiedError + } + } + + vn := s.client.Versioning() + var err error + deletes := xmlapi.NewMultiConfig(len(values)) + for _, value := range values { + var path []string + path, err = loc.XpathWithEntryName(vn, value) + if err != nil { + return err + } + deletes.Add(&xmlapi.Config{ + Action: "delete", + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + }) + } + + _, _, _, err = s.client.MultiConfig(ctx, deletes, false, nil) + + return err +} + +// List returns a list of objects using the given action ("get" or "show"). +// Params filter and quote are for client side filtering. +func (s *Service) List(ctx context.Context, loc Location, action, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, action, filter, quote, false) +} + +// ListFromConfig returns a list of objects at the given location. +// Requires that client.LoadPanosConfig() has been invoked. +// Params filter and quote are for client side filtering. +func (s *Service) ListFromConfig(ctx context.Context, loc Location, filter, quote string) ([]*Entry, error) { + return s.list(ctx, loc, "", filter, quote, true) +} + +func (s *Service) list(ctx context.Context, loc Location, action, filter, quote string, usePanosConfig bool) ([]*Entry, error) { + var err error + + var logic *filtering.Group + if filter != "" { + logic, err = filtering.Parse(filter, quote) + if err != nil { + return nil, err + } + } + + vn := s.client.Versioning() + + _, normalizer, err := Versioning(vn) + if err != nil { + return nil, err + } + + path, err := loc.XpathWithEntryName(vn, "") + if err != nil { + return nil, err + } + + if usePanosConfig { + if _, err = s.client.ReadFromConfig(ctx, path, false, normalizer); err != nil { + return nil, err + } + } else { + cmd := &xmlapi.Config{ + Action: action, + Xpath: util.AsXpath(path), + Target: s.client.GetTarget(), + } + + if _, _, err = s.client.Communicate(ctx, cmd, true, normalizer); err != nil { + if err.Error() == "No such node" && action == "show" { + return nil, nil + } + return nil, err + } + } + + listing, err := normalizer.Normalize() + if err != nil || logic == nil { + return listing, err + } + + filtered := make([]*Entry, 0, len(listing)) + for _, x := range listing { + ok, err := logic.Matches(x) + if err != nil { + return nil, err + } + if ok { + filtered = append(filtered, x) + } + } + + return filtered, nil +} diff --git a/util/pangoclient.go b/util/pangoclient.go index eeff7c32..f0ee26e7 100644 --- a/util/pangoclient.go +++ b/util/pangoclient.go @@ -15,7 +15,7 @@ import ( type PangoClient interface { // Basics. Versioning() version.Number - Plugins() []plugin.Info + Plugins(context.Context) ([]plugin.Info, error) GetTarget() string IsPanorama() (bool, error) IsFirewall() (bool, error) diff --git a/version/version.go b/version/version.go index b982d9d1..105e91a9 100644 --- a/version/version.go +++ b/version/version.go @@ -28,6 +28,19 @@ func (v Number) Gte(o Number) bool { return v.Patch >= o.Patch } +// Lt tests if this version number is lesser than to the argument. +func (v Number) Lt(o Number) bool { + if v.Major != o.Major { + return v.Major < o.Major + } + + if v.Minor != o.Minor { + return v.Minor < o.Minor + } + + return v.Patch < o.Patch +} + // String returns the version number as a string. func (v Number) String() string { if v.Suffix == "" {