How to use String method of cdp Package

Best Rod code snippet using cdp.String

cdp_oper.go

Source:cdp_oper.go Github

copy

Full Screen

1// This module contains a collection of YANG definitions2// for Cisco IOS-XR cdp package operational data.3// 4// This module contains definitions5// for the following management objects:6// cdp: CDP operational data7// 8// Copyright (c) 2013-2018 by Cisco Systems, Inc.9// All rights reserved.10package cdp_oper11import (12 "fmt"13 "github.com/CiscoDevNet/ydk-go/ydk"14 "github.com/CiscoDevNet/ydk-go/ydk/types"15 "github.com/CiscoDevNet/ydk-go/ydk/types/yfilter"16 "github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xr"17 "reflect"18)19func init() {20 ydk.YLogDebug(fmt.Sprintf("Registering top level entities for package cdp_oper"))21 ydk.RegisterEntity("{http://cisco.com/ns/yang/Cisco-IOS-XR-cdp-oper cdp}", reflect.TypeOf(Cdp{}))22 ydk.RegisterEntity("Cisco-IOS-XR-cdp-oper:cdp", reflect.TypeOf(Cdp{}))23}24// CdpDuplex represents Cdp duplex25type CdpDuplex string26const (27 // cdp dplx none28 CdpDuplex_cdp_dplx_none CdpDuplex = "cdp-dplx-none"29 // cdp dplx half30 CdpDuplex_cdp_dplx_half CdpDuplex = "cdp-dplx-half"31 // cdp dplx full32 CdpDuplex_cdp_dplx_full CdpDuplex = "cdp-dplx-full"33)34// CdpL3AddrProtocol represents Cdp l3 addr protocol35type CdpL3AddrProtocol string36const (37 // IPv438 CdpL3AddrProtocol_ipv4 CdpL3AddrProtocol = "ipv4"39 // IPv640 CdpL3AddrProtocol_ipv6 CdpL3AddrProtocol = "ipv6"41)42// Cdp43// CDP operational data44type Cdp struct {45 EntityData types.CommonEntityData46 YFilter yfilter.YFilter47 // Per node CDP operational data.48 Nodes Cdp_Nodes49}50func (cdp *Cdp) GetEntityData() *types.CommonEntityData {51 cdp.EntityData.YFilter = cdp.YFilter52 cdp.EntityData.YangName = "cdp"53 cdp.EntityData.BundleName = "cisco_ios_xr"54 cdp.EntityData.ParentYangName = "Cisco-IOS-XR-cdp-oper"55 cdp.EntityData.SegmentPath = "Cisco-IOS-XR-cdp-oper:cdp"56 cdp.EntityData.AbsolutePath = cdp.EntityData.SegmentPath57 cdp.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()58 cdp.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()59 cdp.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()60 cdp.EntityData.Children = types.NewOrderedMap()61 cdp.EntityData.Children.Append("nodes", types.YChild{"Nodes", &cdp.Nodes})62 cdp.EntityData.Leafs = types.NewOrderedMap()63 cdp.EntityData.YListKeys = []string {}64 return &(cdp.EntityData)65}66// Cdp_Nodes67// Per node CDP operational data68type Cdp_Nodes struct {69 EntityData types.CommonEntityData70 YFilter yfilter.YFilter71 // The CDP operational data for a particular node. The type is slice of72 // Cdp_Nodes_Node.73 Node []*Cdp_Nodes_Node74}75func (nodes *Cdp_Nodes) GetEntityData() *types.CommonEntityData {76 nodes.EntityData.YFilter = nodes.YFilter77 nodes.EntityData.YangName = "nodes"78 nodes.EntityData.BundleName = "cisco_ios_xr"79 nodes.EntityData.ParentYangName = "cdp"80 nodes.EntityData.SegmentPath = "nodes"81 nodes.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/" + nodes.EntityData.SegmentPath82 nodes.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()83 nodes.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()84 nodes.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()85 nodes.EntityData.Children = types.NewOrderedMap()86 nodes.EntityData.Children.Append("node", types.YChild{"Node", nil})87 for i := range nodes.Node {88 nodes.EntityData.Children.Append(types.GetSegmentPath(nodes.Node[i]), types.YChild{"Node", nodes.Node[i]})89 }90 nodes.EntityData.Leafs = types.NewOrderedMap()91 nodes.EntityData.YListKeys = []string {}92 return &(nodes.EntityData)93}94// Cdp_Nodes_Node95// The CDP operational data for a particular node96type Cdp_Nodes_Node struct {97 EntityData types.CommonEntityData98 YFilter yfilter.YFilter99 YListKey string100 // This attribute is a key. The identifier for the node. The type is string101 // with pattern: ([a-zA-Z0-9_]*\d+/){1,2}([a-zA-Z0-9_]*\d+).102 NodeName interface{}103 // The CDP neighbor tables on this node.104 Neighbors Cdp_Nodes_Node_Neighbors105 // The CDP traffic statistics for this node.106 Statistics Cdp_Nodes_Node_Statistics107 // The table of interfaces on which CDP is running on this node.108 Interfaces Cdp_Nodes_Node_Interfaces109}110func (node *Cdp_Nodes_Node) GetEntityData() *types.CommonEntityData {111 node.EntityData.YFilter = node.YFilter112 node.EntityData.YangName = "node"113 node.EntityData.BundleName = "cisco_ios_xr"114 node.EntityData.ParentYangName = "nodes"115 node.EntityData.SegmentPath = "node" + types.AddKeyToken(node.NodeName, "node-name")116 node.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/" + node.EntityData.SegmentPath117 node.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()118 node.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()119 node.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()120 node.EntityData.Children = types.NewOrderedMap()121 node.EntityData.Children.Append("neighbors", types.YChild{"Neighbors", &node.Neighbors})122 node.EntityData.Children.Append("statistics", types.YChild{"Statistics", &node.Statistics})123 node.EntityData.Children.Append("interfaces", types.YChild{"Interfaces", &node.Interfaces})124 node.EntityData.Leafs = types.NewOrderedMap()125 node.EntityData.Leafs.Append("node-name", types.YLeaf{"NodeName", node.NodeName})126 node.EntityData.YListKeys = []string {"NodeName"}127 return &(node.EntityData)128}129// Cdp_Nodes_Node_Neighbors130// The CDP neighbor tables on this node131type Cdp_Nodes_Node_Neighbors struct {132 EntityData types.CommonEntityData133 YFilter yfilter.YFilter134 // The detailed CDP neighbor table.135 Details Cdp_Nodes_Node_Neighbors_Details136 // The detailed CDP neighbor table.137 Devices Cdp_Nodes_Node_Neighbors_Devices138 // The CDP neighbor summary table.139 Summaries Cdp_Nodes_Node_Neighbors_Summaries140}141func (neighbors *Cdp_Nodes_Node_Neighbors) GetEntityData() *types.CommonEntityData {142 neighbors.EntityData.YFilter = neighbors.YFilter143 neighbors.EntityData.YangName = "neighbors"144 neighbors.EntityData.BundleName = "cisco_ios_xr"145 neighbors.EntityData.ParentYangName = "node"146 neighbors.EntityData.SegmentPath = "neighbors"147 neighbors.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/" + neighbors.EntityData.SegmentPath148 neighbors.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()149 neighbors.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()150 neighbors.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()151 neighbors.EntityData.Children = types.NewOrderedMap()152 neighbors.EntityData.Children.Append("details", types.YChild{"Details", &neighbors.Details})153 neighbors.EntityData.Children.Append("devices", types.YChild{"Devices", &neighbors.Devices})154 neighbors.EntityData.Children.Append("summaries", types.YChild{"Summaries", &neighbors.Summaries})155 neighbors.EntityData.Leafs = types.NewOrderedMap()156 neighbors.EntityData.YListKeys = []string {}157 return &(neighbors.EntityData)158}159// Cdp_Nodes_Node_Neighbors_Details160// The detailed CDP neighbor table161type Cdp_Nodes_Node_Neighbors_Details struct {162 EntityData types.CommonEntityData163 YFilter yfilter.YFilter164 // Detailed information about a CDP neighbor entry. The type is slice of165 // Cdp_Nodes_Node_Neighbors_Details_Detail.166 Detail []*Cdp_Nodes_Node_Neighbors_Details_Detail167}168func (details *Cdp_Nodes_Node_Neighbors_Details) GetEntityData() *types.CommonEntityData {169 details.EntityData.YFilter = details.YFilter170 details.EntityData.YangName = "details"171 details.EntityData.BundleName = "cisco_ios_xr"172 details.EntityData.ParentYangName = "neighbors"173 details.EntityData.SegmentPath = "details"174 details.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/" + details.EntityData.SegmentPath175 details.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()176 details.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()177 details.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()178 details.EntityData.Children = types.NewOrderedMap()179 details.EntityData.Children.Append("detail", types.YChild{"Detail", nil})180 for i := range details.Detail {181 types.SetYListKey(details.Detail[i], i)182 details.EntityData.Children.Append(types.GetSegmentPath(details.Detail[i]), types.YChild{"Detail", details.Detail[i]})183 }184 details.EntityData.Leafs = types.NewOrderedMap()185 details.EntityData.YListKeys = []string {}186 return &(details.EntityData)187}188// Cdp_Nodes_Node_Neighbors_Details_Detail189// Detailed information about a CDP neighbor190// entry191type Cdp_Nodes_Node_Neighbors_Details_Detail struct {192 EntityData types.CommonEntityData193 YFilter yfilter.YFilter194 YListKey string195 // The interface name. The type is string with pattern: [a-zA-Z0-9._/-]+.196 InterfaceName interface{}197 // The neighboring device identifier. The type is string.198 DeviceId interface{}199 // cdp neighbor. The type is slice of200 // Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor.201 CdpNeighbor []*Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor202}203func (detail *Cdp_Nodes_Node_Neighbors_Details_Detail) GetEntityData() *types.CommonEntityData {204 detail.EntityData.YFilter = detail.YFilter205 detail.EntityData.YangName = "detail"206 detail.EntityData.BundleName = "cisco_ios_xr"207 detail.EntityData.ParentYangName = "details"208 detail.EntityData.SegmentPath = "detail" + types.AddNoKeyToken(detail)209 detail.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/details/" + detail.EntityData.SegmentPath210 detail.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()211 detail.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()212 detail.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()213 detail.EntityData.Children = types.NewOrderedMap()214 detail.EntityData.Children.Append("cdp-neighbor", types.YChild{"CdpNeighbor", nil})215 for i := range detail.CdpNeighbor {216 types.SetYListKey(detail.CdpNeighbor[i], i)217 detail.EntityData.Children.Append(types.GetSegmentPath(detail.CdpNeighbor[i]), types.YChild{"CdpNeighbor", detail.CdpNeighbor[i]})218 }219 detail.EntityData.Leafs = types.NewOrderedMap()220 detail.EntityData.Leafs.Append("interface-name", types.YLeaf{"InterfaceName", detail.InterfaceName})221 detail.EntityData.Leafs.Append("device-id", types.YLeaf{"DeviceId", detail.DeviceId})222 detail.EntityData.YListKeys = []string {}223 return &(detail.EntityData)224}225// Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor226// cdp neighbor227type Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor struct {228 EntityData types.CommonEntityData229 YFilter yfilter.YFilter230 YListKey string231 // Interface the neighbor entry was received on . The type is string with232 // pattern: [a-zA-Z0-9._/-]+.233 ReceivingInterfaceName interface{}234 // Device identifier. The type is string.235 DeviceId interface{}236 // Outgoing port identifier. The type is string.237 PortId interface{}238 // Version number. The type is interface{} with range: 0..255.239 HeaderVersion interface{}240 // Remaining hold time. The type is interface{} with range: 0..65535.241 HoldTime interface{}242 // Capabilities. The type is string.243 Capabilities interface{}244 // Platform type. The type is string.245 Platform interface{}246 // Detailed neighbor info.247 Detail Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail248}249func (cdpNeighbor *Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor) GetEntityData() *types.CommonEntityData {250 cdpNeighbor.EntityData.YFilter = cdpNeighbor.YFilter251 cdpNeighbor.EntityData.YangName = "cdp-neighbor"252 cdpNeighbor.EntityData.BundleName = "cisco_ios_xr"253 cdpNeighbor.EntityData.ParentYangName = "detail"254 cdpNeighbor.EntityData.SegmentPath = "cdp-neighbor" + types.AddNoKeyToken(cdpNeighbor)255 cdpNeighbor.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/details/detail/" + cdpNeighbor.EntityData.SegmentPath256 cdpNeighbor.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()257 cdpNeighbor.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()258 cdpNeighbor.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()259 cdpNeighbor.EntityData.Children = types.NewOrderedMap()260 cdpNeighbor.EntityData.Children.Append("detail", types.YChild{"Detail", &cdpNeighbor.Detail})261 cdpNeighbor.EntityData.Leafs = types.NewOrderedMap()262 cdpNeighbor.EntityData.Leafs.Append("receiving-interface-name", types.YLeaf{"ReceivingInterfaceName", cdpNeighbor.ReceivingInterfaceName})263 cdpNeighbor.EntityData.Leafs.Append("device-id", types.YLeaf{"DeviceId", cdpNeighbor.DeviceId})264 cdpNeighbor.EntityData.Leafs.Append("port-id", types.YLeaf{"PortId", cdpNeighbor.PortId})265 cdpNeighbor.EntityData.Leafs.Append("header-version", types.YLeaf{"HeaderVersion", cdpNeighbor.HeaderVersion})266 cdpNeighbor.EntityData.Leafs.Append("hold-time", types.YLeaf{"HoldTime", cdpNeighbor.HoldTime})267 cdpNeighbor.EntityData.Leafs.Append("capabilities", types.YLeaf{"Capabilities", cdpNeighbor.Capabilities})268 cdpNeighbor.EntityData.Leafs.Append("platform", types.YLeaf{"Platform", cdpNeighbor.Platform})269 cdpNeighbor.EntityData.YListKeys = []string {}270 return &(cdpNeighbor.EntityData)271}272// Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail273// Detailed neighbor info274type Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail struct {275 EntityData types.CommonEntityData276 YFilter yfilter.YFilter277 // Version TLV. The type is string.278 Version interface{}279 // VTP domain. The type is string.280 VtpDomain interface{}281 // Native VLAN. The type is interface{} with range: 0..4294967295.282 NativeVlan interface{}283 // Duplex setting. The type is CdpDuplex.284 Duplex interface{}285 // SysName. The type is string.286 SystemName interface{}287 // List of network addresses .288 NetworkAddresses Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_NetworkAddresses289 // List of protocol hello entries.290 ProtocolHelloList Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_ProtocolHelloList291}292func (detail *Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail) GetEntityData() *types.CommonEntityData {293 detail.EntityData.YFilter = detail.YFilter294 detail.EntityData.YangName = "detail"295 detail.EntityData.BundleName = "cisco_ios_xr"296 detail.EntityData.ParentYangName = "cdp-neighbor"297 detail.EntityData.SegmentPath = "detail"298 detail.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/details/detail/cdp-neighbor/" + detail.EntityData.SegmentPath299 detail.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()300 detail.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()301 detail.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()302 detail.EntityData.Children = types.NewOrderedMap()303 detail.EntityData.Children.Append("network-addresses", types.YChild{"NetworkAddresses", &detail.NetworkAddresses})304 detail.EntityData.Children.Append("protocol-hello-list", types.YChild{"ProtocolHelloList", &detail.ProtocolHelloList})305 detail.EntityData.Leafs = types.NewOrderedMap()306 detail.EntityData.Leafs.Append("version", types.YLeaf{"Version", detail.Version})307 detail.EntityData.Leafs.Append("vtp-domain", types.YLeaf{"VtpDomain", detail.VtpDomain})308 detail.EntityData.Leafs.Append("native-vlan", types.YLeaf{"NativeVlan", detail.NativeVlan})309 detail.EntityData.Leafs.Append("duplex", types.YLeaf{"Duplex", detail.Duplex})310 detail.EntityData.Leafs.Append("system-name", types.YLeaf{"SystemName", detail.SystemName})311 detail.EntityData.YListKeys = []string {}312 return &(detail.EntityData)313}314// Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_NetworkAddresses315// List of network addresses 316type Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_NetworkAddresses struct {317 EntityData types.CommonEntityData318 YFilter yfilter.YFilter319 // cdp addr entry. The type is slice of320 // Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry.321 CdpAddrEntry []*Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry322}323func (networkAddresses *Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_NetworkAddresses) GetEntityData() *types.CommonEntityData {324 networkAddresses.EntityData.YFilter = networkAddresses.YFilter325 networkAddresses.EntityData.YangName = "network-addresses"326 networkAddresses.EntityData.BundleName = "cisco_ios_xr"327 networkAddresses.EntityData.ParentYangName = "detail"328 networkAddresses.EntityData.SegmentPath = "network-addresses"329 networkAddresses.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/details/detail/cdp-neighbor/detail/" + networkAddresses.EntityData.SegmentPath330 networkAddresses.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()331 networkAddresses.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()332 networkAddresses.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()333 networkAddresses.EntityData.Children = types.NewOrderedMap()334 networkAddresses.EntityData.Children.Append("cdp-addr-entry", types.YChild{"CdpAddrEntry", nil})335 for i := range networkAddresses.CdpAddrEntry {336 types.SetYListKey(networkAddresses.CdpAddrEntry[i], i)337 networkAddresses.EntityData.Children.Append(types.GetSegmentPath(networkAddresses.CdpAddrEntry[i]), types.YChild{"CdpAddrEntry", networkAddresses.CdpAddrEntry[i]})338 }339 networkAddresses.EntityData.Leafs = types.NewOrderedMap()340 networkAddresses.EntityData.YListKeys = []string {}341 return &(networkAddresses.EntityData)342}343// Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry344// cdp addr entry345type Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry struct {346 EntityData types.CommonEntityData347 YFilter yfilter.YFilter348 YListKey string349 // Network layer address.350 Address Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry_Address351}352func (cdpAddrEntry *Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry) GetEntityData() *types.CommonEntityData {353 cdpAddrEntry.EntityData.YFilter = cdpAddrEntry.YFilter354 cdpAddrEntry.EntityData.YangName = "cdp-addr-entry"355 cdpAddrEntry.EntityData.BundleName = "cisco_ios_xr"356 cdpAddrEntry.EntityData.ParentYangName = "network-addresses"357 cdpAddrEntry.EntityData.SegmentPath = "cdp-addr-entry" + types.AddNoKeyToken(cdpAddrEntry)358 cdpAddrEntry.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/details/detail/cdp-neighbor/detail/network-addresses/" + cdpAddrEntry.EntityData.SegmentPath359 cdpAddrEntry.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()360 cdpAddrEntry.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()361 cdpAddrEntry.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()362 cdpAddrEntry.EntityData.Children = types.NewOrderedMap()363 cdpAddrEntry.EntityData.Children.Append("address", types.YChild{"Address", &cdpAddrEntry.Address})364 cdpAddrEntry.EntityData.Leafs = types.NewOrderedMap()365 cdpAddrEntry.EntityData.YListKeys = []string {}366 return &(cdpAddrEntry.EntityData)367}368// Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry_Address369// Network layer address370type Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry_Address struct {371 EntityData types.CommonEntityData372 YFilter yfilter.YFilter373 // AddressType. The type is CdpL3AddrProtocol.374 AddressType interface{}375 // IPv4 address. The type is string with pattern:376 // (([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?.377 Ipv4Address interface{}378 // IPv6 address. The type is string with pattern:379 // ((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\p{N}\p{L}]+)?.380 Ipv6Address interface{}381}382func (address *Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry_Address) GetEntityData() *types.CommonEntityData {383 address.EntityData.YFilter = address.YFilter384 address.EntityData.YangName = "address"385 address.EntityData.BundleName = "cisco_ios_xr"386 address.EntityData.ParentYangName = "cdp-addr-entry"387 address.EntityData.SegmentPath = "address"388 address.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/details/detail/cdp-neighbor/detail/network-addresses/cdp-addr-entry/" + address.EntityData.SegmentPath389 address.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()390 address.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()391 address.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()392 address.EntityData.Children = types.NewOrderedMap()393 address.EntityData.Leafs = types.NewOrderedMap()394 address.EntityData.Leafs.Append("address-type", types.YLeaf{"AddressType", address.AddressType})395 address.EntityData.Leafs.Append("ipv4-address", types.YLeaf{"Ipv4Address", address.Ipv4Address})396 address.EntityData.Leafs.Append("ipv6-address", types.YLeaf{"Ipv6Address", address.Ipv6Address})397 address.EntityData.YListKeys = []string {}398 return &(address.EntityData)399}400// Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_ProtocolHelloList401// List of protocol hello entries402type Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_ProtocolHelloList struct {403 EntityData types.CommonEntityData404 YFilter yfilter.YFilter405 // cdp prot hello entry. The type is slice of406 // Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_ProtocolHelloList_CdpProtHelloEntry.407 CdpProtHelloEntry []*Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_ProtocolHelloList_CdpProtHelloEntry408}409func (protocolHelloList *Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_ProtocolHelloList) GetEntityData() *types.CommonEntityData {410 protocolHelloList.EntityData.YFilter = protocolHelloList.YFilter411 protocolHelloList.EntityData.YangName = "protocol-hello-list"412 protocolHelloList.EntityData.BundleName = "cisco_ios_xr"413 protocolHelloList.EntityData.ParentYangName = "detail"414 protocolHelloList.EntityData.SegmentPath = "protocol-hello-list"415 protocolHelloList.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/details/detail/cdp-neighbor/detail/" + protocolHelloList.EntityData.SegmentPath416 protocolHelloList.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()417 protocolHelloList.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()418 protocolHelloList.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()419 protocolHelloList.EntityData.Children = types.NewOrderedMap()420 protocolHelloList.EntityData.Children.Append("cdp-prot-hello-entry", types.YChild{"CdpProtHelloEntry", nil})421 for i := range protocolHelloList.CdpProtHelloEntry {422 types.SetYListKey(protocolHelloList.CdpProtHelloEntry[i], i)423 protocolHelloList.EntityData.Children.Append(types.GetSegmentPath(protocolHelloList.CdpProtHelloEntry[i]), types.YChild{"CdpProtHelloEntry", protocolHelloList.CdpProtHelloEntry[i]})424 }425 protocolHelloList.EntityData.Leafs = types.NewOrderedMap()426 protocolHelloList.EntityData.YListKeys = []string {}427 return &(protocolHelloList.EntityData)428}429// Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_ProtocolHelloList_CdpProtHelloEntry430// cdp prot hello entry431type Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_ProtocolHelloList_CdpProtHelloEntry struct {432 EntityData types.CommonEntityData433 YFilter yfilter.YFilter434 YListKey string435 // Protocol Hello msg. The type is string with pattern:436 // ([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?.437 HelloMessage interface{}438}439func (cdpProtHelloEntry *Cdp_Nodes_Node_Neighbors_Details_Detail_CdpNeighbor_Detail_ProtocolHelloList_CdpProtHelloEntry) GetEntityData() *types.CommonEntityData {440 cdpProtHelloEntry.EntityData.YFilter = cdpProtHelloEntry.YFilter441 cdpProtHelloEntry.EntityData.YangName = "cdp-prot-hello-entry"442 cdpProtHelloEntry.EntityData.BundleName = "cisco_ios_xr"443 cdpProtHelloEntry.EntityData.ParentYangName = "protocol-hello-list"444 cdpProtHelloEntry.EntityData.SegmentPath = "cdp-prot-hello-entry" + types.AddNoKeyToken(cdpProtHelloEntry)445 cdpProtHelloEntry.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/details/detail/cdp-neighbor/detail/protocol-hello-list/" + cdpProtHelloEntry.EntityData.SegmentPath446 cdpProtHelloEntry.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()447 cdpProtHelloEntry.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()448 cdpProtHelloEntry.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()449 cdpProtHelloEntry.EntityData.Children = types.NewOrderedMap()450 cdpProtHelloEntry.EntityData.Leafs = types.NewOrderedMap()451 cdpProtHelloEntry.EntityData.Leafs.Append("hello-message", types.YLeaf{"HelloMessage", cdpProtHelloEntry.HelloMessage})452 cdpProtHelloEntry.EntityData.YListKeys = []string {}453 return &(cdpProtHelloEntry.EntityData)454}455// Cdp_Nodes_Node_Neighbors_Devices456// The detailed CDP neighbor table457type Cdp_Nodes_Node_Neighbors_Devices struct {458 EntityData types.CommonEntityData459 YFilter yfilter.YFilter460 // Detailed information about a CDP neighbor entry. The type is slice of461 // Cdp_Nodes_Node_Neighbors_Devices_Device.462 Device []*Cdp_Nodes_Node_Neighbors_Devices_Device463}464func (devices *Cdp_Nodes_Node_Neighbors_Devices) GetEntityData() *types.CommonEntityData {465 devices.EntityData.YFilter = devices.YFilter466 devices.EntityData.YangName = "devices"467 devices.EntityData.BundleName = "cisco_ios_xr"468 devices.EntityData.ParentYangName = "neighbors"469 devices.EntityData.SegmentPath = "devices"470 devices.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/" + devices.EntityData.SegmentPath471 devices.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()472 devices.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()473 devices.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()474 devices.EntityData.Children = types.NewOrderedMap()475 devices.EntityData.Children.Append("device", types.YChild{"Device", nil})476 for i := range devices.Device {477 devices.EntityData.Children.Append(types.GetSegmentPath(devices.Device[i]), types.YChild{"Device", devices.Device[i]})478 }479 devices.EntityData.Leafs = types.NewOrderedMap()480 devices.EntityData.YListKeys = []string {}481 return &(devices.EntityData)482}483// Cdp_Nodes_Node_Neighbors_Devices_Device484// Detailed information about a CDP neighbor485// entry486type Cdp_Nodes_Node_Neighbors_Devices_Device struct {487 EntityData types.CommonEntityData488 YFilter yfilter.YFilter489 YListKey string490 // This attribute is a key. The neighboring device identifier. The type is491 // string.492 DeviceId interface{}493 // cdp neighbor. The type is slice of494 // Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor.495 CdpNeighbor []*Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor496}497func (device *Cdp_Nodes_Node_Neighbors_Devices_Device) GetEntityData() *types.CommonEntityData {498 device.EntityData.YFilter = device.YFilter499 device.EntityData.YangName = "device"500 device.EntityData.BundleName = "cisco_ios_xr"501 device.EntityData.ParentYangName = "devices"502 device.EntityData.SegmentPath = "device" + types.AddKeyToken(device.DeviceId, "device-id")503 device.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/devices/" + device.EntityData.SegmentPath504 device.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()505 device.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()506 device.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()507 device.EntityData.Children = types.NewOrderedMap()508 device.EntityData.Children.Append("cdp-neighbor", types.YChild{"CdpNeighbor", nil})509 for i := range device.CdpNeighbor {510 types.SetYListKey(device.CdpNeighbor[i], i)511 device.EntityData.Children.Append(types.GetSegmentPath(device.CdpNeighbor[i]), types.YChild{"CdpNeighbor", device.CdpNeighbor[i]})512 }513 device.EntityData.Leafs = types.NewOrderedMap()514 device.EntityData.Leafs.Append("device-id", types.YLeaf{"DeviceId", device.DeviceId})515 device.EntityData.YListKeys = []string {"DeviceId"}516 return &(device.EntityData)517}518// Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor519// cdp neighbor520type Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor struct {521 EntityData types.CommonEntityData522 YFilter yfilter.YFilter523 YListKey string524 // Interface the neighbor entry was received on . The type is string with525 // pattern: [a-zA-Z0-9._/-]+.526 ReceivingInterfaceName interface{}527 // Device identifier. The type is string.528 DeviceId interface{}529 // Outgoing port identifier. The type is string.530 PortId interface{}531 // Version number. The type is interface{} with range: 0..255.532 HeaderVersion interface{}533 // Remaining hold time. The type is interface{} with range: 0..65535.534 HoldTime interface{}535 // Capabilities. The type is string.536 Capabilities interface{}537 // Platform type. The type is string.538 Platform interface{}539 // Detailed neighbor info.540 Detail Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail541}542func (cdpNeighbor *Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor) GetEntityData() *types.CommonEntityData {543 cdpNeighbor.EntityData.YFilter = cdpNeighbor.YFilter544 cdpNeighbor.EntityData.YangName = "cdp-neighbor"545 cdpNeighbor.EntityData.BundleName = "cisco_ios_xr"546 cdpNeighbor.EntityData.ParentYangName = "device"547 cdpNeighbor.EntityData.SegmentPath = "cdp-neighbor" + types.AddNoKeyToken(cdpNeighbor)548 cdpNeighbor.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/devices/device/" + cdpNeighbor.EntityData.SegmentPath549 cdpNeighbor.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()550 cdpNeighbor.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()551 cdpNeighbor.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()552 cdpNeighbor.EntityData.Children = types.NewOrderedMap()553 cdpNeighbor.EntityData.Children.Append("detail", types.YChild{"Detail", &cdpNeighbor.Detail})554 cdpNeighbor.EntityData.Leafs = types.NewOrderedMap()555 cdpNeighbor.EntityData.Leafs.Append("receiving-interface-name", types.YLeaf{"ReceivingInterfaceName", cdpNeighbor.ReceivingInterfaceName})556 cdpNeighbor.EntityData.Leafs.Append("device-id", types.YLeaf{"DeviceId", cdpNeighbor.DeviceId})557 cdpNeighbor.EntityData.Leafs.Append("port-id", types.YLeaf{"PortId", cdpNeighbor.PortId})558 cdpNeighbor.EntityData.Leafs.Append("header-version", types.YLeaf{"HeaderVersion", cdpNeighbor.HeaderVersion})559 cdpNeighbor.EntityData.Leafs.Append("hold-time", types.YLeaf{"HoldTime", cdpNeighbor.HoldTime})560 cdpNeighbor.EntityData.Leafs.Append("capabilities", types.YLeaf{"Capabilities", cdpNeighbor.Capabilities})561 cdpNeighbor.EntityData.Leafs.Append("platform", types.YLeaf{"Platform", cdpNeighbor.Platform})562 cdpNeighbor.EntityData.YListKeys = []string {}563 return &(cdpNeighbor.EntityData)564}565// Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail566// Detailed neighbor info567type Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail struct {568 EntityData types.CommonEntityData569 YFilter yfilter.YFilter570 // Version TLV. The type is string.571 Version interface{}572 // VTP domain. The type is string.573 VtpDomain interface{}574 // Native VLAN. The type is interface{} with range: 0..4294967295.575 NativeVlan interface{}576 // Duplex setting. The type is CdpDuplex.577 Duplex interface{}578 // SysName. The type is string.579 SystemName interface{}580 // List of network addresses .581 NetworkAddresses Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_NetworkAddresses582 // List of protocol hello entries.583 ProtocolHelloList Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_ProtocolHelloList584}585func (detail *Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail) GetEntityData() *types.CommonEntityData {586 detail.EntityData.YFilter = detail.YFilter587 detail.EntityData.YangName = "detail"588 detail.EntityData.BundleName = "cisco_ios_xr"589 detail.EntityData.ParentYangName = "cdp-neighbor"590 detail.EntityData.SegmentPath = "detail"591 detail.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/devices/device/cdp-neighbor/" + detail.EntityData.SegmentPath592 detail.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()593 detail.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()594 detail.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()595 detail.EntityData.Children = types.NewOrderedMap()596 detail.EntityData.Children.Append("network-addresses", types.YChild{"NetworkAddresses", &detail.NetworkAddresses})597 detail.EntityData.Children.Append("protocol-hello-list", types.YChild{"ProtocolHelloList", &detail.ProtocolHelloList})598 detail.EntityData.Leafs = types.NewOrderedMap()599 detail.EntityData.Leafs.Append("version", types.YLeaf{"Version", detail.Version})600 detail.EntityData.Leafs.Append("vtp-domain", types.YLeaf{"VtpDomain", detail.VtpDomain})601 detail.EntityData.Leafs.Append("native-vlan", types.YLeaf{"NativeVlan", detail.NativeVlan})602 detail.EntityData.Leafs.Append("duplex", types.YLeaf{"Duplex", detail.Duplex})603 detail.EntityData.Leafs.Append("system-name", types.YLeaf{"SystemName", detail.SystemName})604 detail.EntityData.YListKeys = []string {}605 return &(detail.EntityData)606}607// Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_NetworkAddresses608// List of network addresses 609type Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_NetworkAddresses struct {610 EntityData types.CommonEntityData611 YFilter yfilter.YFilter612 // cdp addr entry. The type is slice of613 // Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry.614 CdpAddrEntry []*Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry615}616func (networkAddresses *Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_NetworkAddresses) GetEntityData() *types.CommonEntityData {617 networkAddresses.EntityData.YFilter = networkAddresses.YFilter618 networkAddresses.EntityData.YangName = "network-addresses"619 networkAddresses.EntityData.BundleName = "cisco_ios_xr"620 networkAddresses.EntityData.ParentYangName = "detail"621 networkAddresses.EntityData.SegmentPath = "network-addresses"622 networkAddresses.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/devices/device/cdp-neighbor/detail/" + networkAddresses.EntityData.SegmentPath623 networkAddresses.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()624 networkAddresses.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()625 networkAddresses.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()626 networkAddresses.EntityData.Children = types.NewOrderedMap()627 networkAddresses.EntityData.Children.Append("cdp-addr-entry", types.YChild{"CdpAddrEntry", nil})628 for i := range networkAddresses.CdpAddrEntry {629 types.SetYListKey(networkAddresses.CdpAddrEntry[i], i)630 networkAddresses.EntityData.Children.Append(types.GetSegmentPath(networkAddresses.CdpAddrEntry[i]), types.YChild{"CdpAddrEntry", networkAddresses.CdpAddrEntry[i]})631 }632 networkAddresses.EntityData.Leafs = types.NewOrderedMap()633 networkAddresses.EntityData.YListKeys = []string {}634 return &(networkAddresses.EntityData)635}636// Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry637// cdp addr entry638type Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry struct {639 EntityData types.CommonEntityData640 YFilter yfilter.YFilter641 YListKey string642 // Network layer address.643 Address Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry_Address644}645func (cdpAddrEntry *Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry) GetEntityData() *types.CommonEntityData {646 cdpAddrEntry.EntityData.YFilter = cdpAddrEntry.YFilter647 cdpAddrEntry.EntityData.YangName = "cdp-addr-entry"648 cdpAddrEntry.EntityData.BundleName = "cisco_ios_xr"649 cdpAddrEntry.EntityData.ParentYangName = "network-addresses"650 cdpAddrEntry.EntityData.SegmentPath = "cdp-addr-entry" + types.AddNoKeyToken(cdpAddrEntry)651 cdpAddrEntry.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/devices/device/cdp-neighbor/detail/network-addresses/" + cdpAddrEntry.EntityData.SegmentPath652 cdpAddrEntry.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()653 cdpAddrEntry.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()654 cdpAddrEntry.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()655 cdpAddrEntry.EntityData.Children = types.NewOrderedMap()656 cdpAddrEntry.EntityData.Children.Append("address", types.YChild{"Address", &cdpAddrEntry.Address})657 cdpAddrEntry.EntityData.Leafs = types.NewOrderedMap()658 cdpAddrEntry.EntityData.YListKeys = []string {}659 return &(cdpAddrEntry.EntityData)660}661// Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry_Address662// Network layer address663type Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry_Address struct {664 EntityData types.CommonEntityData665 YFilter yfilter.YFilter666 // AddressType. The type is CdpL3AddrProtocol.667 AddressType interface{}668 // IPv4 address. The type is string with pattern:669 // (([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?.670 Ipv4Address interface{}671 // IPv6 address. The type is string with pattern:672 // ((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\p{N}\p{L}]+)?.673 Ipv6Address interface{}674}675func (address *Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry_Address) GetEntityData() *types.CommonEntityData {676 address.EntityData.YFilter = address.YFilter677 address.EntityData.YangName = "address"678 address.EntityData.BundleName = "cisco_ios_xr"679 address.EntityData.ParentYangName = "cdp-addr-entry"680 address.EntityData.SegmentPath = "address"681 address.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/devices/device/cdp-neighbor/detail/network-addresses/cdp-addr-entry/" + address.EntityData.SegmentPath682 address.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()683 address.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()684 address.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()685 address.EntityData.Children = types.NewOrderedMap()686 address.EntityData.Leafs = types.NewOrderedMap()687 address.EntityData.Leafs.Append("address-type", types.YLeaf{"AddressType", address.AddressType})688 address.EntityData.Leafs.Append("ipv4-address", types.YLeaf{"Ipv4Address", address.Ipv4Address})689 address.EntityData.Leafs.Append("ipv6-address", types.YLeaf{"Ipv6Address", address.Ipv6Address})690 address.EntityData.YListKeys = []string {}691 return &(address.EntityData)692}693// Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_ProtocolHelloList694// List of protocol hello entries695type Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_ProtocolHelloList struct {696 EntityData types.CommonEntityData697 YFilter yfilter.YFilter698 // cdp prot hello entry. The type is slice of699 // Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_ProtocolHelloList_CdpProtHelloEntry.700 CdpProtHelloEntry []*Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_ProtocolHelloList_CdpProtHelloEntry701}702func (protocolHelloList *Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_ProtocolHelloList) GetEntityData() *types.CommonEntityData {703 protocolHelloList.EntityData.YFilter = protocolHelloList.YFilter704 protocolHelloList.EntityData.YangName = "protocol-hello-list"705 protocolHelloList.EntityData.BundleName = "cisco_ios_xr"706 protocolHelloList.EntityData.ParentYangName = "detail"707 protocolHelloList.EntityData.SegmentPath = "protocol-hello-list"708 protocolHelloList.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/devices/device/cdp-neighbor/detail/" + protocolHelloList.EntityData.SegmentPath709 protocolHelloList.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()710 protocolHelloList.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()711 protocolHelloList.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()712 protocolHelloList.EntityData.Children = types.NewOrderedMap()713 protocolHelloList.EntityData.Children.Append("cdp-prot-hello-entry", types.YChild{"CdpProtHelloEntry", nil})714 for i := range protocolHelloList.CdpProtHelloEntry {715 types.SetYListKey(protocolHelloList.CdpProtHelloEntry[i], i)716 protocolHelloList.EntityData.Children.Append(types.GetSegmentPath(protocolHelloList.CdpProtHelloEntry[i]), types.YChild{"CdpProtHelloEntry", protocolHelloList.CdpProtHelloEntry[i]})717 }718 protocolHelloList.EntityData.Leafs = types.NewOrderedMap()719 protocolHelloList.EntityData.YListKeys = []string {}720 return &(protocolHelloList.EntityData)721}722// Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_ProtocolHelloList_CdpProtHelloEntry723// cdp prot hello entry724type Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_ProtocolHelloList_CdpProtHelloEntry struct {725 EntityData types.CommonEntityData726 YFilter yfilter.YFilter727 YListKey string728 // Protocol Hello msg. The type is string with pattern:729 // ([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?.730 HelloMessage interface{}731}732func (cdpProtHelloEntry *Cdp_Nodes_Node_Neighbors_Devices_Device_CdpNeighbor_Detail_ProtocolHelloList_CdpProtHelloEntry) GetEntityData() *types.CommonEntityData {733 cdpProtHelloEntry.EntityData.YFilter = cdpProtHelloEntry.YFilter734 cdpProtHelloEntry.EntityData.YangName = "cdp-prot-hello-entry"735 cdpProtHelloEntry.EntityData.BundleName = "cisco_ios_xr"736 cdpProtHelloEntry.EntityData.ParentYangName = "protocol-hello-list"737 cdpProtHelloEntry.EntityData.SegmentPath = "cdp-prot-hello-entry" + types.AddNoKeyToken(cdpProtHelloEntry)738 cdpProtHelloEntry.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/devices/device/cdp-neighbor/detail/protocol-hello-list/" + cdpProtHelloEntry.EntityData.SegmentPath739 cdpProtHelloEntry.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()740 cdpProtHelloEntry.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()741 cdpProtHelloEntry.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()742 cdpProtHelloEntry.EntityData.Children = types.NewOrderedMap()743 cdpProtHelloEntry.EntityData.Leafs = types.NewOrderedMap()744 cdpProtHelloEntry.EntityData.Leafs.Append("hello-message", types.YLeaf{"HelloMessage", cdpProtHelloEntry.HelloMessage})745 cdpProtHelloEntry.EntityData.YListKeys = []string {}746 return &(cdpProtHelloEntry.EntityData)747}748// Cdp_Nodes_Node_Neighbors_Summaries749// The CDP neighbor summary table750type Cdp_Nodes_Node_Neighbors_Summaries struct {751 EntityData types.CommonEntityData752 YFilter yfilter.YFilter753 // Brief information about a CDP neighbor entry. The type is slice of754 // Cdp_Nodes_Node_Neighbors_Summaries_Summary.755 Summary []*Cdp_Nodes_Node_Neighbors_Summaries_Summary756}757func (summaries *Cdp_Nodes_Node_Neighbors_Summaries) GetEntityData() *types.CommonEntityData {758 summaries.EntityData.YFilter = summaries.YFilter759 summaries.EntityData.YangName = "summaries"760 summaries.EntityData.BundleName = "cisco_ios_xr"761 summaries.EntityData.ParentYangName = "neighbors"762 summaries.EntityData.SegmentPath = "summaries"763 summaries.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/" + summaries.EntityData.SegmentPath764 summaries.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()765 summaries.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()766 summaries.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()767 summaries.EntityData.Children = types.NewOrderedMap()768 summaries.EntityData.Children.Append("summary", types.YChild{"Summary", nil})769 for i := range summaries.Summary {770 types.SetYListKey(summaries.Summary[i], i)771 summaries.EntityData.Children.Append(types.GetSegmentPath(summaries.Summary[i]), types.YChild{"Summary", summaries.Summary[i]})772 }773 summaries.EntityData.Leafs = types.NewOrderedMap()774 summaries.EntityData.YListKeys = []string {}775 return &(summaries.EntityData)776}777// Cdp_Nodes_Node_Neighbors_Summaries_Summary778// Brief information about a CDP neighbor entry779type Cdp_Nodes_Node_Neighbors_Summaries_Summary struct {780 EntityData types.CommonEntityData781 YFilter yfilter.YFilter782 YListKey string783 // The interface name. The type is string with pattern: [a-zA-Z0-9._/-]+.784 InterfaceName interface{}785 // The neighboring device identifier. The type is string.786 DeviceId interface{}787 // cdp neighbor. The type is slice of788 // Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor.789 CdpNeighbor []*Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor790}791func (summary *Cdp_Nodes_Node_Neighbors_Summaries_Summary) GetEntityData() *types.CommonEntityData {792 summary.EntityData.YFilter = summary.YFilter793 summary.EntityData.YangName = "summary"794 summary.EntityData.BundleName = "cisco_ios_xr"795 summary.EntityData.ParentYangName = "summaries"796 summary.EntityData.SegmentPath = "summary" + types.AddNoKeyToken(summary)797 summary.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/summaries/" + summary.EntityData.SegmentPath798 summary.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()799 summary.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()800 summary.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()801 summary.EntityData.Children = types.NewOrderedMap()802 summary.EntityData.Children.Append("cdp-neighbor", types.YChild{"CdpNeighbor", nil})803 for i := range summary.CdpNeighbor {804 types.SetYListKey(summary.CdpNeighbor[i], i)805 summary.EntityData.Children.Append(types.GetSegmentPath(summary.CdpNeighbor[i]), types.YChild{"CdpNeighbor", summary.CdpNeighbor[i]})806 }807 summary.EntityData.Leafs = types.NewOrderedMap()808 summary.EntityData.Leafs.Append("interface-name", types.YLeaf{"InterfaceName", summary.InterfaceName})809 summary.EntityData.Leafs.Append("device-id", types.YLeaf{"DeviceId", summary.DeviceId})810 summary.EntityData.YListKeys = []string {}811 return &(summary.EntityData)812}813// Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor814// cdp neighbor815type Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor struct {816 EntityData types.CommonEntityData817 YFilter yfilter.YFilter818 YListKey string819 // Interface the neighbor entry was received on . The type is string with820 // pattern: [a-zA-Z0-9._/-]+.821 ReceivingInterfaceName interface{}822 // Device identifier. The type is string.823 DeviceId interface{}824 // Outgoing port identifier. The type is string.825 PortId interface{}826 // Version number. The type is interface{} with range: 0..255.827 HeaderVersion interface{}828 // Remaining hold time. The type is interface{} with range: 0..65535.829 HoldTime interface{}830 // Capabilities. The type is string.831 Capabilities interface{}832 // Platform type. The type is string.833 Platform interface{}834 // Detailed neighbor info.835 Detail Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail836}837func (cdpNeighbor *Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor) GetEntityData() *types.CommonEntityData {838 cdpNeighbor.EntityData.YFilter = cdpNeighbor.YFilter839 cdpNeighbor.EntityData.YangName = "cdp-neighbor"840 cdpNeighbor.EntityData.BundleName = "cisco_ios_xr"841 cdpNeighbor.EntityData.ParentYangName = "summary"842 cdpNeighbor.EntityData.SegmentPath = "cdp-neighbor" + types.AddNoKeyToken(cdpNeighbor)843 cdpNeighbor.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/summaries/summary/" + cdpNeighbor.EntityData.SegmentPath844 cdpNeighbor.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()845 cdpNeighbor.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()846 cdpNeighbor.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()847 cdpNeighbor.EntityData.Children = types.NewOrderedMap()848 cdpNeighbor.EntityData.Children.Append("detail", types.YChild{"Detail", &cdpNeighbor.Detail})849 cdpNeighbor.EntityData.Leafs = types.NewOrderedMap()850 cdpNeighbor.EntityData.Leafs.Append("receiving-interface-name", types.YLeaf{"ReceivingInterfaceName", cdpNeighbor.ReceivingInterfaceName})851 cdpNeighbor.EntityData.Leafs.Append("device-id", types.YLeaf{"DeviceId", cdpNeighbor.DeviceId})852 cdpNeighbor.EntityData.Leafs.Append("port-id", types.YLeaf{"PortId", cdpNeighbor.PortId})853 cdpNeighbor.EntityData.Leafs.Append("header-version", types.YLeaf{"HeaderVersion", cdpNeighbor.HeaderVersion})854 cdpNeighbor.EntityData.Leafs.Append("hold-time", types.YLeaf{"HoldTime", cdpNeighbor.HoldTime})855 cdpNeighbor.EntityData.Leafs.Append("capabilities", types.YLeaf{"Capabilities", cdpNeighbor.Capabilities})856 cdpNeighbor.EntityData.Leafs.Append("platform", types.YLeaf{"Platform", cdpNeighbor.Platform})857 cdpNeighbor.EntityData.YListKeys = []string {}858 return &(cdpNeighbor.EntityData)859}860// Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail861// Detailed neighbor info862type Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail struct {863 EntityData types.CommonEntityData864 YFilter yfilter.YFilter865 // Version TLV. The type is string.866 Version interface{}867 // VTP domain. The type is string.868 VtpDomain interface{}869 // Native VLAN. The type is interface{} with range: 0..4294967295.870 NativeVlan interface{}871 // Duplex setting. The type is CdpDuplex.872 Duplex interface{}873 // SysName. The type is string.874 SystemName interface{}875 // List of network addresses .876 NetworkAddresses Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_NetworkAddresses877 // List of protocol hello entries.878 ProtocolHelloList Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_ProtocolHelloList879}880func (detail *Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail) GetEntityData() *types.CommonEntityData {881 detail.EntityData.YFilter = detail.YFilter882 detail.EntityData.YangName = "detail"883 detail.EntityData.BundleName = "cisco_ios_xr"884 detail.EntityData.ParentYangName = "cdp-neighbor"885 detail.EntityData.SegmentPath = "detail"886 detail.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/summaries/summary/cdp-neighbor/" + detail.EntityData.SegmentPath887 detail.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()888 detail.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()889 detail.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()890 detail.EntityData.Children = types.NewOrderedMap()891 detail.EntityData.Children.Append("network-addresses", types.YChild{"NetworkAddresses", &detail.NetworkAddresses})892 detail.EntityData.Children.Append("protocol-hello-list", types.YChild{"ProtocolHelloList", &detail.ProtocolHelloList})893 detail.EntityData.Leafs = types.NewOrderedMap()894 detail.EntityData.Leafs.Append("version", types.YLeaf{"Version", detail.Version})895 detail.EntityData.Leafs.Append("vtp-domain", types.YLeaf{"VtpDomain", detail.VtpDomain})896 detail.EntityData.Leafs.Append("native-vlan", types.YLeaf{"NativeVlan", detail.NativeVlan})897 detail.EntityData.Leafs.Append("duplex", types.YLeaf{"Duplex", detail.Duplex})898 detail.EntityData.Leafs.Append("system-name", types.YLeaf{"SystemName", detail.SystemName})899 detail.EntityData.YListKeys = []string {}900 return &(detail.EntityData)901}902// Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_NetworkAddresses903// List of network addresses 904type Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_NetworkAddresses struct {905 EntityData types.CommonEntityData906 YFilter yfilter.YFilter907 // cdp addr entry. The type is slice of908 // Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry.909 CdpAddrEntry []*Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry910}911func (networkAddresses *Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_NetworkAddresses) GetEntityData() *types.CommonEntityData {912 networkAddresses.EntityData.YFilter = networkAddresses.YFilter913 networkAddresses.EntityData.YangName = "network-addresses"914 networkAddresses.EntityData.BundleName = "cisco_ios_xr"915 networkAddresses.EntityData.ParentYangName = "detail"916 networkAddresses.EntityData.SegmentPath = "network-addresses"917 networkAddresses.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/summaries/summary/cdp-neighbor/detail/" + networkAddresses.EntityData.SegmentPath918 networkAddresses.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()919 networkAddresses.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()920 networkAddresses.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()921 networkAddresses.EntityData.Children = types.NewOrderedMap()922 networkAddresses.EntityData.Children.Append("cdp-addr-entry", types.YChild{"CdpAddrEntry", nil})923 for i := range networkAddresses.CdpAddrEntry {924 types.SetYListKey(networkAddresses.CdpAddrEntry[i], i)925 networkAddresses.EntityData.Children.Append(types.GetSegmentPath(networkAddresses.CdpAddrEntry[i]), types.YChild{"CdpAddrEntry", networkAddresses.CdpAddrEntry[i]})926 }927 networkAddresses.EntityData.Leafs = types.NewOrderedMap()928 networkAddresses.EntityData.YListKeys = []string {}929 return &(networkAddresses.EntityData)930}931// Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry932// cdp addr entry933type Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry struct {934 EntityData types.CommonEntityData935 YFilter yfilter.YFilter936 YListKey string937 // Network layer address.938 Address Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry_Address939}940func (cdpAddrEntry *Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry) GetEntityData() *types.CommonEntityData {941 cdpAddrEntry.EntityData.YFilter = cdpAddrEntry.YFilter942 cdpAddrEntry.EntityData.YangName = "cdp-addr-entry"943 cdpAddrEntry.EntityData.BundleName = "cisco_ios_xr"944 cdpAddrEntry.EntityData.ParentYangName = "network-addresses"945 cdpAddrEntry.EntityData.SegmentPath = "cdp-addr-entry" + types.AddNoKeyToken(cdpAddrEntry)946 cdpAddrEntry.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/summaries/summary/cdp-neighbor/detail/network-addresses/" + cdpAddrEntry.EntityData.SegmentPath947 cdpAddrEntry.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()948 cdpAddrEntry.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()949 cdpAddrEntry.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()950 cdpAddrEntry.EntityData.Children = types.NewOrderedMap()951 cdpAddrEntry.EntityData.Children.Append("address", types.YChild{"Address", &cdpAddrEntry.Address})952 cdpAddrEntry.EntityData.Leafs = types.NewOrderedMap()953 cdpAddrEntry.EntityData.YListKeys = []string {}954 return &(cdpAddrEntry.EntityData)955}956// Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry_Address957// Network layer address958type Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry_Address struct {959 EntityData types.CommonEntityData960 YFilter yfilter.YFilter961 // AddressType. The type is CdpL3AddrProtocol.962 AddressType interface{}963 // IPv4 address. The type is string with pattern:964 // (([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?.965 Ipv4Address interface{}966 // IPv6 address. The type is string with pattern:967 // ((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\p{N}\p{L}]+)?.968 Ipv6Address interface{}969}970func (address *Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_NetworkAddresses_CdpAddrEntry_Address) GetEntityData() *types.CommonEntityData {971 address.EntityData.YFilter = address.YFilter972 address.EntityData.YangName = "address"973 address.EntityData.BundleName = "cisco_ios_xr"974 address.EntityData.ParentYangName = "cdp-addr-entry"975 address.EntityData.SegmentPath = "address"976 address.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/summaries/summary/cdp-neighbor/detail/network-addresses/cdp-addr-entry/" + address.EntityData.SegmentPath977 address.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()978 address.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()979 address.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()980 address.EntityData.Children = types.NewOrderedMap()981 address.EntityData.Leafs = types.NewOrderedMap()982 address.EntityData.Leafs.Append("address-type", types.YLeaf{"AddressType", address.AddressType})983 address.EntityData.Leafs.Append("ipv4-address", types.YLeaf{"Ipv4Address", address.Ipv4Address})984 address.EntityData.Leafs.Append("ipv6-address", types.YLeaf{"Ipv6Address", address.Ipv6Address})985 address.EntityData.YListKeys = []string {}986 return &(address.EntityData)987}988// Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_ProtocolHelloList989// List of protocol hello entries990type Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_ProtocolHelloList struct {991 EntityData types.CommonEntityData992 YFilter yfilter.YFilter993 // cdp prot hello entry. The type is slice of994 // Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_ProtocolHelloList_CdpProtHelloEntry.995 CdpProtHelloEntry []*Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_ProtocolHelloList_CdpProtHelloEntry996}997func (protocolHelloList *Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_ProtocolHelloList) GetEntityData() *types.CommonEntityData {998 protocolHelloList.EntityData.YFilter = protocolHelloList.YFilter999 protocolHelloList.EntityData.YangName = "protocol-hello-list"1000 protocolHelloList.EntityData.BundleName = "cisco_ios_xr"1001 protocolHelloList.EntityData.ParentYangName = "detail"1002 protocolHelloList.EntityData.SegmentPath = "protocol-hello-list"1003 protocolHelloList.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/summaries/summary/cdp-neighbor/detail/" + protocolHelloList.EntityData.SegmentPath1004 protocolHelloList.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()1005 protocolHelloList.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()1006 protocolHelloList.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()1007 protocolHelloList.EntityData.Children = types.NewOrderedMap()1008 protocolHelloList.EntityData.Children.Append("cdp-prot-hello-entry", types.YChild{"CdpProtHelloEntry", nil})1009 for i := range protocolHelloList.CdpProtHelloEntry {1010 types.SetYListKey(protocolHelloList.CdpProtHelloEntry[i], i)1011 protocolHelloList.EntityData.Children.Append(types.GetSegmentPath(protocolHelloList.CdpProtHelloEntry[i]), types.YChild{"CdpProtHelloEntry", protocolHelloList.CdpProtHelloEntry[i]})1012 }1013 protocolHelloList.EntityData.Leafs = types.NewOrderedMap()1014 protocolHelloList.EntityData.YListKeys = []string {}1015 return &(protocolHelloList.EntityData)1016}1017// Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_ProtocolHelloList_CdpProtHelloEntry1018// cdp prot hello entry1019type Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_ProtocolHelloList_CdpProtHelloEntry struct {1020 EntityData types.CommonEntityData1021 YFilter yfilter.YFilter1022 YListKey string1023 // Protocol Hello msg. The type is string with pattern:1024 // ([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?.1025 HelloMessage interface{}1026}1027func (cdpProtHelloEntry *Cdp_Nodes_Node_Neighbors_Summaries_Summary_CdpNeighbor_Detail_ProtocolHelloList_CdpProtHelloEntry) GetEntityData() *types.CommonEntityData {1028 cdpProtHelloEntry.EntityData.YFilter = cdpProtHelloEntry.YFilter1029 cdpProtHelloEntry.EntityData.YangName = "cdp-prot-hello-entry"1030 cdpProtHelloEntry.EntityData.BundleName = "cisco_ios_xr"1031 cdpProtHelloEntry.EntityData.ParentYangName = "protocol-hello-list"1032 cdpProtHelloEntry.EntityData.SegmentPath = "cdp-prot-hello-entry" + types.AddNoKeyToken(cdpProtHelloEntry)1033 cdpProtHelloEntry.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/neighbors/summaries/summary/cdp-neighbor/detail/protocol-hello-list/" + cdpProtHelloEntry.EntityData.SegmentPath1034 cdpProtHelloEntry.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()1035 cdpProtHelloEntry.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()1036 cdpProtHelloEntry.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()1037 cdpProtHelloEntry.EntityData.Children = types.NewOrderedMap()1038 cdpProtHelloEntry.EntityData.Leafs = types.NewOrderedMap()1039 cdpProtHelloEntry.EntityData.Leafs.Append("hello-message", types.YLeaf{"HelloMessage", cdpProtHelloEntry.HelloMessage})1040 cdpProtHelloEntry.EntityData.YListKeys = []string {}1041 return &(cdpProtHelloEntry.EntityData)1042}1043// Cdp_Nodes_Node_Statistics1044// The CDP traffic statistics for this node1045type Cdp_Nodes_Node_Statistics struct {1046 EntityData types.CommonEntityData1047 YFilter yfilter.YFilter1048 // Received packets. The type is interface{} with range: 0..4294967295.1049 ReceivedPackets interface{}1050 // Received v1 packets. The type is interface{} with range: 0..4294967295.1051 ReceivedPacketsV1 interface{}1052 // Received v2 packets. The type is interface{} with range: 0..4294967295.1053 ReceivedPacketsV2 interface{}1054 // Transmitted packets. The type is interface{} with range: 0..4294967295.1055 TransmittedPackets interface{}1056 // Transmitted v1 packets. The type is interface{} with range: 0..4294967295.1057 TransmittedPacketsV1 interface{}1058 // Transmitted v2 packets. The type is interface{} with range: 0..4294967295.1059 TransmittedPacketsV2 interface{}1060 // Header syntax errors. The type is interface{} with range: 0..4294967295.1061 HeaderErrors interface{}1062 // Checksum errors. The type is interface{} with range: 0..4294967295.1063 ChecksumErrors interface{}1064 // Transmission errors. The type is interface{} with range: 0..4294967295.1065 EncapsulationErrors interface{}1066 // Bad packet received and dropped. The type is interface{} with range:1067 // 0..4294967295.1068 BadPacketErrors interface{}1069 // Out-of-memory conditions. The type is interface{} with range:1070 // 0..4294967295.1071 OutOfMemoryErrors interface{}1072 // Truncated messages. The type is interface{} with range: 0..4294967295.1073 TruncatedPacketErrors interface{}1074 // Can't handle receive version. The type is interface{} with range:1075 // 0..4294967295.1076 HeaderVersionErrors interface{}1077 // Cannot open file. The type is interface{} with range: 0..4294967295.1078 OpenFileErrors interface{}1079}1080func (statistics *Cdp_Nodes_Node_Statistics) GetEntityData() *types.CommonEntityData {1081 statistics.EntityData.YFilter = statistics.YFilter1082 statistics.EntityData.YangName = "statistics"1083 statistics.EntityData.BundleName = "cisco_ios_xr"1084 statistics.EntityData.ParentYangName = "node"1085 statistics.EntityData.SegmentPath = "statistics"1086 statistics.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/" + statistics.EntityData.SegmentPath1087 statistics.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()1088 statistics.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()1089 statistics.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()1090 statistics.EntityData.Children = types.NewOrderedMap()1091 statistics.EntityData.Leafs = types.NewOrderedMap()1092 statistics.EntityData.Leafs.Append("received-packets", types.YLeaf{"ReceivedPackets", statistics.ReceivedPackets})1093 statistics.EntityData.Leafs.Append("received-packets-v1", types.YLeaf{"ReceivedPacketsV1", statistics.ReceivedPacketsV1})1094 statistics.EntityData.Leafs.Append("received-packets-v2", types.YLeaf{"ReceivedPacketsV2", statistics.ReceivedPacketsV2})1095 statistics.EntityData.Leafs.Append("transmitted-packets", types.YLeaf{"TransmittedPackets", statistics.TransmittedPackets})1096 statistics.EntityData.Leafs.Append("transmitted-packets-v1", types.YLeaf{"TransmittedPacketsV1", statistics.TransmittedPacketsV1})1097 statistics.EntityData.Leafs.Append("transmitted-packets-v2", types.YLeaf{"TransmittedPacketsV2", statistics.TransmittedPacketsV2})1098 statistics.EntityData.Leafs.Append("header-errors", types.YLeaf{"HeaderErrors", statistics.HeaderErrors})1099 statistics.EntityData.Leafs.Append("checksum-errors", types.YLeaf{"ChecksumErrors", statistics.ChecksumErrors})1100 statistics.EntityData.Leafs.Append("encapsulation-errors", types.YLeaf{"EncapsulationErrors", statistics.EncapsulationErrors})1101 statistics.EntityData.Leafs.Append("bad-packet-errors", types.YLeaf{"BadPacketErrors", statistics.BadPacketErrors})1102 statistics.EntityData.Leafs.Append("out-of-memory-errors", types.YLeaf{"OutOfMemoryErrors", statistics.OutOfMemoryErrors})1103 statistics.EntityData.Leafs.Append("truncated-packet-errors", types.YLeaf{"TruncatedPacketErrors", statistics.TruncatedPacketErrors})1104 statistics.EntityData.Leafs.Append("header-version-errors", types.YLeaf{"HeaderVersionErrors", statistics.HeaderVersionErrors})1105 statistics.EntityData.Leafs.Append("open-file-errors", types.YLeaf{"OpenFileErrors", statistics.OpenFileErrors})1106 statistics.EntityData.YListKeys = []string {}1107 return &(statistics.EntityData)1108}1109// Cdp_Nodes_Node_Interfaces1110// The table of interfaces on which CDP is1111// running on this node1112type Cdp_Nodes_Node_Interfaces struct {1113 EntityData types.CommonEntityData1114 YFilter yfilter.YFilter1115 // Operational data for an interface on which CDP is running. The type is1116 // slice of Cdp_Nodes_Node_Interfaces_Interface.1117 Interface []*Cdp_Nodes_Node_Interfaces_Interface1118}1119func (interfaces *Cdp_Nodes_Node_Interfaces) GetEntityData() *types.CommonEntityData {1120 interfaces.EntityData.YFilter = interfaces.YFilter1121 interfaces.EntityData.YangName = "interfaces"1122 interfaces.EntityData.BundleName = "cisco_ios_xr"1123 interfaces.EntityData.ParentYangName = "node"1124 interfaces.EntityData.SegmentPath = "interfaces"1125 interfaces.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/" + interfaces.EntityData.SegmentPath1126 interfaces.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()1127 interfaces.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()1128 interfaces.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()1129 interfaces.EntityData.Children = types.NewOrderedMap()1130 interfaces.EntityData.Children.Append("interface", types.YChild{"Interface", nil})1131 for i := range interfaces.Interface {1132 interfaces.EntityData.Children.Append(types.GetSegmentPath(interfaces.Interface[i]), types.YChild{"Interface", interfaces.Interface[i]})1133 }1134 interfaces.EntityData.Leafs = types.NewOrderedMap()1135 interfaces.EntityData.YListKeys = []string {}1136 return &(interfaces.EntityData)1137}1138// Cdp_Nodes_Node_Interfaces_Interface1139// Operational data for an interface on which1140// CDP is running1141type Cdp_Nodes_Node_Interfaces_Interface struct {1142 EntityData types.CommonEntityData1143 YFilter yfilter.YFilter1144 YListKey string1145 // This attribute is a key. The interface name. The type is string with1146 // pattern: [a-zA-Z0-9._/-]+.1147 InterfaceName interface{}1148 // Interface. The type is string with pattern: [a-zA-Z0-9._/-]+.1149 InterfaceHandle interface{}1150 // Interface basecaps state. The type is interface{} with range:1151 // 0..4294967295.1152 BasecapsState interface{}1153 // CDP protocol state. The type is interface{} with range: 0..4294967295.1154 CdpProtocolState interface{}1155 // Interface encapsulation. The type is string.1156 InterfaceEncaps interface{}1157}1158func (self *Cdp_Nodes_Node_Interfaces_Interface) GetEntityData() *types.CommonEntityData {1159 self.EntityData.YFilter = self.YFilter1160 self.EntityData.YangName = "interface"1161 self.EntityData.BundleName = "cisco_ios_xr"1162 self.EntityData.ParentYangName = "interfaces"1163 self.EntityData.SegmentPath = "interface" + types.AddKeyToken(self.InterfaceName, "interface-name")1164 self.EntityData.AbsolutePath = "Cisco-IOS-XR-cdp-oper:cdp/nodes/node/interfaces/" + self.EntityData.SegmentPath1165 self.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()1166 self.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()1167 self.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()1168 self.EntityData.Children = types.NewOrderedMap()1169 self.EntityData.Leafs = types.NewOrderedMap()1170 self.EntityData.Leafs.Append("interface-name", types.YLeaf{"InterfaceName", self.InterfaceName})1171 self.EntityData.Leafs.Append("interface-handle", types.YLeaf{"InterfaceHandle", self.InterfaceHandle})1172 self.EntityData.Leafs.Append("basecaps-state", types.YLeaf{"BasecapsState", self.BasecapsState})1173 self.EntityData.Leafs.Append("cdp-protocol-state", types.YLeaf{"CdpProtocolState", self.CdpProtocolState})1174 self.EntityData.Leafs.Append("interface-encaps", types.YLeaf{"InterfaceEncaps", self.InterfaceEncaps})1175 self.EntityData.YListKeys = []string {"InterfaceName"}1176 return &(self.EntityData)1177}...

Full Screen

Full Screen

chromedp.go

Source:chromedp.go Github

copy

Full Screen

1// Package chromedp is a high level Chrome DevTools Protocol client that2// simplifies driving browsers for scraping, unit testing, or profiling web3// pages using the CDP.4//5// chromedp requires no third-party dependencies, implementing the async Chrome6// DevTools Protocol entirely in Go.7package chromedp8import (9 "context"10 "errors"11 "fmt"12 "log"13 "sync"14 "time"15 "github.com/chromedp/cdproto/cdp"16 "github.com/incognito-core-libs/chromedp/client"17 "github.com/incognito-core-libs/chromedp/runner"18)19const (20 // DefaultNewTargetTimeout is the default time to wait for a new target to21 // be started.22 DefaultNewTargetTimeout = 3 * time.Second23 // DefaultCheckDuration is the default time to sleep between a check.24 DefaultCheckDuration = 50 * time.Millisecond25 // DefaultPoolStartPort is the default start port number.26 DefaultPoolStartPort = 900027 // DefaultPoolEndPort is the default end port number.28 DefaultPoolEndPort = 1000029)30// CDP is the high-level Chrome DevTools Protocol browser manager, handling the31// browser process runner, WebSocket clients, associated targets, and network,32// page, and DOM events.33type CDP struct {34 // r is the chrome runner.35 r *runner.Runner36 // opts are command line options to pass to a created runner.37 opts []runner.CommandLineOption38 // watch is the channel for new client targets.39 watch <-chan client.Target40 // cur is the current active target's handler.41 cur cdp.Executor42 // handlers is the active handlers.43 handlers []*TargetHandler44 // handlerMap is the map of target IDs to its active handler.45 handlerMap map[string]int46 // logging funcs47 logf, debugf, errf func(string, ...interface{})48 sync.RWMutex49}50// New creates and starts a new CDP instance.51func New(ctxt context.Context, opts ...Option) (*CDP, error) {52 c := &CDP{53 handlers: make([]*TargetHandler, 0),54 handlerMap: make(map[string]int),55 logf: log.Printf,56 debugf: func(string, ...interface{}) {},57 errf: func(s string, v ...interface{}) { log.Printf("error: "+s, v...) },58 }59 // apply options60 for _, o := range opts {61 if err := o(c); err != nil {62 return nil, err63 }64 }65 // check for supplied runner, if none then create one66 if c.r == nil && c.watch == nil {67 var err error68 c.r, err = runner.Run(ctxt, c.opts...)69 if err != nil {70 return nil, err71 }72 }73 // watch handlers74 if c.watch == nil {75 c.watch = c.r.Client().WatchPageTargets(ctxt)76 }77 go func() {78 for t := range c.watch {79 if t == nil {80 return81 }82 go c.AddTarget(ctxt, t)83 }84 }()85 // TODO: fix this86 timeout := time.After(defaultNewTargetTimeout)87 // wait until at least one target active88 for {89 select {90 default:91 c.RLock()92 exists := c.cur != nil93 c.RUnlock()94 if exists {95 return c, nil96 }97 // TODO: fix this98 time.Sleep(DefaultCheckDuration)99 case <-ctxt.Done():100 return nil, ctxt.Err()101 case <-timeout:102 return nil, errors.New("timeout waiting for initial target")103 }104 }105}106// AddTarget adds a target using the supplied context.107func (c *CDP) AddTarget(ctxt context.Context, t client.Target) {108 c.Lock()109 defer c.Unlock()110 // create target manager111 h, err := NewTargetHandler(t, c.logf, c.debugf, c.errf)112 if err != nil {113 c.errf("could not create handler for %s: %v", t, err)114 return115 }116 // run117 if err := h.Run(ctxt); err != nil {118 c.errf("could not start handler for %s: %v", t, err)119 return120 }121 // add to active handlers122 c.handlers = append(c.handlers, h)123 c.handlerMap[t.GetID()] = len(c.handlers) - 1124 if c.cur == nil {125 c.cur = h126 }127}128// Wait waits for the Chrome runner to terminate.129func (c *CDP) Wait() error {130 c.RLock()131 r := c.r132 c.RUnlock()133 if r != nil {134 return r.Wait()135 }136 return nil137}138// Shutdown closes all Chrome page handlers.139func (c *CDP) Shutdown(ctxt context.Context, opts ...client.Option) error {140 c.RLock()141 defer c.RUnlock()142 if c.r != nil {143 return c.r.Shutdown(ctxt, opts...)144 }145 return nil146}147// ListTargets returns the target IDs of the managed targets.148func (c *CDP) ListTargets() []string {149 c.RLock()150 defer c.RUnlock()151 i, targets := 0, make([]string, len(c.handlers))152 for k := range c.handlerMap {153 targets[i] = k154 i++155 }156 return targets157}158// GetHandlerByIndex retrieves the domains manager for the specified index.159func (c *CDP) GetHandlerByIndex(i int) cdp.Executor {160 c.RLock()161 defer c.RUnlock()162 if i < 0 || i >= len(c.handlers) {163 return nil164 }165 return c.handlers[i]166}167// GetHandlerByID retrieves the domains manager for the specified target ID.168func (c *CDP) GetHandlerByID(id string) cdp.Executor {169 c.RLock()170 defer c.RUnlock()171 if i, ok := c.handlerMap[id]; ok {172 return c.handlers[i]173 }174 return nil175}176// SetHandler sets the active handler to the target with the specified index.177func (c *CDP) SetHandler(i int) error {178 c.Lock()179 defer c.Unlock()180 if i < 0 || i >= len(c.handlers) {181 return fmt.Errorf("no handler associated with target index %d", i)182 }183 c.cur = c.handlers[i]184 return nil185}186// SetHandlerByID sets the active target to the target with the specified id.187func (c *CDP) SetHandlerByID(id string) error {188 c.Lock()189 defer c.Unlock()190 if i, ok := c.handlerMap[id]; ok {191 c.cur = c.handlers[i]192 return nil193 }194 return fmt.Errorf("no handler associated with target id %s", id)195}196// newTarget creates a new target using supplied context and options, returning197// the id of the created target only after the target has been started for198// monitoring.199func (c *CDP) newTarget(ctxt context.Context, opts ...client.Option) (string, error) {200 c.RLock()201 cl := c.r.Client(opts...)202 c.RUnlock()203 // new page target204 t, err := cl.NewPageTarget(ctxt)205 if err != nil {206 return "", err207 }208 timeout := time.After(DefaultNewTargetTimeout)209 for {210 select {211 default:212 var ok bool213 id := t.GetID()214 c.RLock()215 _, ok = c.handlerMap[id]216 c.RUnlock()217 if ok {218 return id, nil219 }220 time.Sleep(DefaultCheckDuration)221 case <-ctxt.Done():222 return "", ctxt.Err()223 case <-timeout:224 return "", errors.New("timeout waiting for new target to be available")225 }226 }227}228// SetTarget is an action that sets the active Chrome handler to the specified229// index i.230func (c *CDP) SetTarget(i int) Action {231 return ActionFunc(func(context.Context, cdp.Executor) error {232 return c.SetHandler(i)233 })234}235// SetTargetByID is an action that sets the active Chrome handler to the handler236// associated with the specified id.237func (c *CDP) SetTargetByID(id string) Action {238 return ActionFunc(func(context.Context, cdp.Executor) error {239 return c.SetHandlerByID(id)240 })241}242// NewTarget is an action that creates a new Chrome target, and sets it as the243// active target.244func (c *CDP) NewTarget(id *string, opts ...client.Option) Action {245 return ActionFunc(func(ctxt context.Context, h cdp.Executor) error {246 n, err := c.newTarget(ctxt, opts...)247 if err != nil {248 return err249 }250 if id != nil {251 *id = n252 }253 return nil254 })255}256// CloseByIndex closes the Chrome target with specified index i.257func (c *CDP) CloseByIndex(i int) Action {258 return ActionFunc(func(ctxt context.Context, h cdp.Executor) error {259 return nil260 })261}262// CloseByID closes the Chrome target with the specified id.263func (c *CDP) CloseByID(id string) Action {264 return ActionFunc(func(ctxt context.Context, h cdp.Executor) error {265 return nil266 })267}268// Run executes the action against the current target using the supplied269// context.270func (c *CDP) Run(ctxt context.Context, a Action) error {271 c.RLock()272 cur := c.cur273 c.RUnlock()274 return a.Do(ctxt, cur)275}276// Option is a Chrome DevTools Protocol option.277type Option func(*CDP) error278// WithRunner is a CDP option to specify the underlying Chrome runner to279// monitor for page handlers.280func WithRunner(r *runner.Runner) Option {281 return func(c *CDP) error {282 c.r = r283 return nil284 }285}286// WithTargets is a CDP option to specify the incoming targets to monitor for287// page handlers.288func WithTargets(watch <-chan client.Target) Option {289 return func(c *CDP) error {290 c.watch = watch291 return nil292 }293}294// WithClient is a CDP option to use the incoming targets from a client.295func WithClient(ctxt context.Context, cl *client.Client) Option {296 return func(c *CDP) error {297 return WithTargets(cl.WatchPageTargets(ctxt))(c)298 }299}300// WithURL is a CDP option to use a client with the specified URL.301func WithURL(ctxt context.Context, urlstr string) Option {302 return func(c *CDP) error {303 return WithClient(ctxt, client.New(client.URL(urlstr)))(c)304 }305}306// WithRunnerOptions is a CDP option to specify the options to pass to a newly307// created Chrome process runner.308func WithRunnerOptions(opts ...runner.CommandLineOption) Option {309 return func(c *CDP) error {310 c.opts = opts311 return nil312 }313}314// WithLogf is a CDP option to specify a func to receive general logging.315func WithLogf(f func(string, ...interface{})) Option {316 return func(c *CDP) error {317 c.logf = f318 return nil319 }320}321// WithDebugf is a CDP option to specify a func to receive debug logging (ie,322// protocol information).323func WithDebugf(f func(string, ...interface{})) Option {324 return func(c *CDP) error {325 c.debugf = f326 return nil327 }328}329// WithErrorf is a CDP option to specify a func to receive error logging.330func WithErrorf(f func(string, ...interface{})) Option {331 return func(c *CDP) error {332 c.errf = f333 return nil334 }335}336// WithLog is a CDP option that sets the logging, debugging, and error funcs to337// f.338func WithLog(f func(string, ...interface{})) Option {339 return func(c *CDP) error {340 c.logf, c.debugf, c.errf = f, f, f341 return nil342 }343}344// WithConsolef is a CDP option to specify a func to receive chrome log events.345//346// Note: NOT YET IMPLEMENTED.347func WithConsolef(f func(string, ...interface{})) Option {348 return func(c *CDP) error {349 return nil350 }351}352var (353 // defaultNewTargetTimeout is the default target timeout -- used by354 // testing.355 defaultNewTargetTimeout = DefaultNewTargetTimeout356)...

Full Screen

Full Screen

util.go

Source:util.go Github

copy

Full Screen

1package chromedp2import (3 "github.com/chromedp/cdproto"4 "github.com/chromedp/cdproto/cdp"5)6// frameOp is a frame manipulation operation.7type frameOp func(*cdp.Frame)8/*func domContentEventFired(f *cdp.Frame) {9}10func loadEventFired(f *cdp.Frame) {11}*/12func frameAttached(id cdp.FrameID) frameOp {13 return func(f *cdp.Frame) {14 f.ParentID = id15 setFrameState(f, cdp.FrameAttached)16 }17}18/*func frameNavigated(f *cdp.Frame) {19 setFrameState(f, cdp.FrameNavigated)20}*/21func frameDetached(f *cdp.Frame) {22 f.ParentID = cdp.EmptyFrameID23 clearFrameState(f, cdp.FrameAttached)24}25func frameStartedLoading(f *cdp.Frame) {26 setFrameState(f, cdp.FrameLoading)27}28func frameStoppedLoading(f *cdp.Frame) {29 clearFrameState(f, cdp.FrameLoading)30}31func frameScheduledNavigation(f *cdp.Frame) {32 setFrameState(f, cdp.FrameScheduledNavigation)33}34func frameClearedScheduledNavigation(f *cdp.Frame) {35 clearFrameState(f, cdp.FrameScheduledNavigation)36}37/*func frameResized(f *cdp.Frame) {38 // TODO39}*/40// setFrameState sets the frame state via bitwise or (|).41func setFrameState(f *cdp.Frame, fs cdp.FrameState) {42 f.State |= fs43}44// clearFrameState clears the frame state via bit clear (&^).45func clearFrameState(f *cdp.Frame, fs cdp.FrameState) {46 f.State &^= fs47}48// nodeOp is a node manipulation operation.49type nodeOp func(*cdp.Node)50func walk(m map[cdp.NodeID]*cdp.Node, n *cdp.Node) {51 n.RLock()52 defer n.RUnlock()53 m[n.NodeID] = n54 for _, c := range n.Children {55 c.Lock()56 c.Parent = n57 c.Invalidated = n.Invalidated58 c.Unlock()59 walk(m, c)60 }61 for _, c := range n.ShadowRoots {62 c.Lock()63 c.Parent = n64 c.Invalidated = n.Invalidated65 c.Unlock()66 walk(m, c)67 }68 for _, c := range n.PseudoElements {69 c.Lock()70 c.Parent = n71 c.Invalidated = n.Invalidated72 c.Unlock()73 walk(m, c)74 }75 for _, c := range []*cdp.Node{n.ContentDocument, n.TemplateContent, n.ImportedDocument} {76 if c == nil {77 continue78 }79 c.Lock()80 c.Parent = n81 c.Invalidated = n.Invalidated82 c.Unlock()83 walk(m, c)84 }85}86func setChildNodes(m map[cdp.NodeID]*cdp.Node, nodes []*cdp.Node) nodeOp {87 return func(n *cdp.Node) {88 n.Lock()89 n.Children = nodes90 n.Unlock()91 walk(m, n)92 }93}94func attributeModified(name, value string) nodeOp {95 return func(n *cdp.Node) {96 n.Lock()97 defer n.Unlock()98 var found bool99 var i int100 for ; i < len(n.Attributes); i += 2 {101 if n.Attributes[i] == name {102 found = true103 break104 }105 }106 if found {107 n.Attributes[i] = name108 n.Attributes[i+1] = value109 } else {110 n.Attributes = append(n.Attributes, name, value)111 }112 }113}114func attributeRemoved(name string) nodeOp {115 return func(n *cdp.Node) {116 n.Lock()117 defer n.Unlock()118 var a []string119 for i := 0; i < len(n.Attributes); i += 2 {120 if n.Attributes[i] == name {121 continue122 }123 a = append(a, n.Attributes[i], n.Attributes[i+1])124 }125 n.Attributes = a126 }127}128func inlineStyleInvalidated(ids []cdp.NodeID) nodeOp {129 return func(n *cdp.Node) {130 }131}132func characterDataModified(characterData string) nodeOp {133 return func(n *cdp.Node) {134 n.Lock()135 defer n.Unlock()136 n.Value = characterData137 }138}139func childNodeCountUpdated(count int64) nodeOp {140 return func(n *cdp.Node) {141 n.Lock()142 defer n.Unlock()143 n.ChildNodeCount = count144 }145}146func childNodeInserted(m map[cdp.NodeID]*cdp.Node, prevID cdp.NodeID, c *cdp.Node) nodeOp {147 return func(n *cdp.Node) {148 n.Lock()149 n.Children = insertNode(n.Children, prevID, c)150 n.Unlock()151 walk(m, n)152 }153}154func childNodeRemoved(m map[cdp.NodeID]*cdp.Node, id cdp.NodeID) nodeOp {155 return func(n *cdp.Node) {156 n.Lock()157 defer n.Unlock()158 n.Children = removeNode(n.Children, id)159 delete(m, id)160 }161}162func shadowRootPushed(m map[cdp.NodeID]*cdp.Node, c *cdp.Node) nodeOp {163 return func(n *cdp.Node) {164 n.Lock()165 n.ShadowRoots = append(n.ShadowRoots, c)166 n.Unlock()167 walk(m, n)168 }169}170func shadowRootPopped(m map[cdp.NodeID]*cdp.Node, id cdp.NodeID) nodeOp {171 return func(n *cdp.Node) {172 n.Lock()173 defer n.Unlock()174 n.ShadowRoots = removeNode(n.ShadowRoots, id)175 delete(m, id)176 }177}178func pseudoElementAdded(m map[cdp.NodeID]*cdp.Node, c *cdp.Node) nodeOp {179 return func(n *cdp.Node) {180 n.Lock()181 n.PseudoElements = append(n.PseudoElements, c)182 n.Unlock()183 walk(m, n)184 }185}186func pseudoElementRemoved(m map[cdp.NodeID]*cdp.Node, id cdp.NodeID) nodeOp {187 return func(n *cdp.Node) {188 n.Lock()189 defer n.Unlock()190 n.PseudoElements = removeNode(n.PseudoElements, id)191 delete(m, id)192 }193}194func distributedNodesUpdated(nodes []*cdp.BackendNode) nodeOp {195 return func(n *cdp.Node) {196 n.Lock()197 defer n.Unlock()198 n.DistributedNodes = nodes199 }200}201func insertNode(n []*cdp.Node, prevID cdp.NodeID, c *cdp.Node) []*cdp.Node {202 var i int203 var found bool204 for ; i < len(n); i++ {205 if n[i].NodeID == prevID {206 found = true207 break208 }209 }210 if !found {211 return append(n, c)212 }213 i++214 n = append(n, nil)215 copy(n[i+1:], n[i:])216 n[i] = c217 return n218}219func removeNode(n []*cdp.Node, id cdp.NodeID) []*cdp.Node {220 if len(n) == 0 {221 return n222 }223 var found bool224 var i int225 for ; i < len(n); i++ {226 if n[i].NodeID == id {227 found = true228 break229 }230 }231 if !found {232 return n233 }234 return append(n[:i], n[i+1:]...)235}236// isCouldNotComputeBoxModelError unwraps err as a MessageError and determines237// if it is a compute box model error.238func isCouldNotComputeBoxModelError(err error) bool {239 e, ok := err.(*cdproto.Error)240 return ok && e.Code == -32000 && e.Message == "Could not compute box model."241}...

Full Screen

Full Screen

String

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 c1 := cdp{1, "x"}4 c2 := cdp{2, "y"}5 fmt.Println(c1, c2)6}7{1 x} {2 y}8import "fmt"9type cdp struct {10}11func (c cdp) String() string {12 return fmt.Sprintf("%d - %s", c.id, c.name)13}14func main() {15 c1 := cdp{1, "x"}16 c2 := cdp{2, "y"}17 fmt.Println(c1, c2)18}19import "fmt"20type cdp struct {21}22func (c cdp) String() string {23 return fmt.Sprintf("%d - %s", c.id, c.name)24}25func main() {26 c1 := cdp{1, "x"}27 c2 := cdp{2, "y"}28 fmt.Println(c1, c2)29}

Full Screen

Full Screen

String

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 a = cdp{1, 2, 3}4 fmt.Println(a.String())5}6{1 2 3}7import "fmt"8type cdp struct {9}10func (a cdp) String() string {11 return fmt.Sprintf("{%d %d %d}", a.x, a.y, a.z)12}13func main() {14 a = cdp{1, 2, 3}15 fmt.Println(a)16}17{1 2 3}18import "fmt"19type cdp struct {20}21func (a cdp) String() string {22 return fmt.Sprintf("{%d %d %d}", a.x, a.y, a.z)23}24func main() {25 a = cdp{1, 2, 3}26 fmt.Println(a)27}28{1 2 3}29import "fmt"30type cdp struct {31}32func (a cdp) String() string {33 return fmt.Sprintf("{%d %d %d}", a.x, a.y, a.z)34}35func main() {36 a = cdp{1, 2, 3}37 fmt.Println(a)38}39{1 2 3}40import "fmt"41type cdp struct {42}43func (a cdp) String() string {44 return fmt.Sprintf("{%d %d %d}", a.x, a.y, a.z)45}46func main() {47 a = cdp{1, 2, 3}48 fmt.Println(a)49}50{1 2 3}51import "fmt"

Full Screen

Full Screen

String

Using AI Code Generation

copy

Full Screen

1import "fmt"2import "cdp"3func main() {4 c := cdp.New(1, 2)5 fmt.Println(c)6}

Full Screen

Full Screen

String

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 c1 := cdp{"CDP1", "CDP1", 10}4 fmt.Println(c1)5}6{CDP1 CDP1 10}

Full Screen

Full Screen

String

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 c := cdp { 1, "abc", 2.5}4 fmt.Println(c)5}6{1 abc 2.5}7import "fmt"8type cdp struct {9}10func (c cdp) display() {11 fmt.Println("Display method with no parameters")12}13func (c cdp) display(a int) {14 fmt.Println("Display method with one parameter")15}16func (c cdp) display(a int, b string) {17 fmt.Println("Display method with two parameters")18}19func main() {20 c := cdp { 1, "abc", 2.5}21 c.display()22 c.display(10)23 c.display(10, "abc")24}25import "fmt"26type cdp struct {27}28func (c cdp) display()

Full Screen

Full Screen

String

Using AI Code Generation

copy

Full Screen

1func main() {2 c1 = cdp{1000, 5.5, "GOOG"}3 fmt.Println(c1.String())4}5cdp{1000, 5.5, GOOG}6func main() {7 c1 = cdp{1000, 5.5, "GOOG"}8 fmt.Println(c2.String())9}10cdp{1000, 5.5, GOOG}

Full Screen

Full Screen

String

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 cdp := cdp{title: "CDP", author: "Amit", price: 100}4 fmt.Println(cdp)5}6{CDP Amit 100}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful