proc StartStopPortProtocolNgpf { portList action protocol } { # NOTE: # This API will start/stop a protocol on all Device Groups # that the port belongs to. # # If you want to start/stop a specific Device Group, then # call StartStopDeviceGroupProtocolNgpf. # # portList = One or more ports in a list. Port format = 1/1. Not 1/1/1. # action = start or stop # protocol = Only one protocol # ::ixNet::OBJ-/topology:1/deviceGroup:1/ethernet:1/ipv4:1/igmpHost:1 # ixNet execute igmpStartHost|igmpStopHost $igmp # # protocol: # ethernet, ipv4, ipv6, bgpIpv4Peer, dhcpv4relayAgent, dhcpv4server, greoipv4, igmpHost, igmpQuerier # lac, ldpBasicRouter, ldpConnectedInterface, lns, ospfv2, pimV4Interface, port # ptp, rsvpteIf, vsvpteLsps, staticMPLS, tag, vxlan set supportedProtocols "ethernet, ipv4, ipv6, bgpIpv4Peer, dhcpv4relayAgent, dhcpv4server, greoipv4, igmpHost, igmpQuerier lac, ldpBasicRouter, ldpConnectedInterface, lns, ospfv2, pimV4Interface, port, ptp, rsvpteIf, vsvpteLsps, staticMPLS, tag, vxlan" if {$action == "start" && $protocol == "igmpHost"} { set action igmpStartHost } if {$action == "stop" && $protocol == "igmpHost"} { set action igmpStopHost } set root [ixNet getRoot] foreach port $portList { set portDiscoveredFlag 0 foreach topology [ixNet getList $root topology] { foreach portObj [ixNet getList $topology port] { set vport [ixNet getAttribute $portObj -vport] # ::ixNet::OBJ-/availableHardware/chassis:"10.10.10.2"/card:1/port:1 set connectedTo [ixNet getAttribute $vport -connectedTo] set chassis [lindex [split $connectedTo /] 3] set cardNum [lindex [split [lindex [split $connectedTo /] 3] :] end] set portNum [lindex [split [lindex [split $connectedTo /] 4] :] end] if {$port == "$cardNum/$portNum"} { set portDiscoveredFlag 1 if {$protocol == "ethernet"} { foreach deviceGroup [ixNet getList $topology deviceGroup] { foreach ethernet [ixNet getList $deviceGroup ethernet] { catch {ixNet execute $action $ethernet} errMsg if {$errMsg != "::ixNet::OK"} { puts "\nError StartStopPortProtocolNgpf: Failed to $action $protocol NGPF protocol on port $port\n" return 1 } else { puts "\nStartStopPortProtocolNgpf: Successfully $action NGPF $protocol protocol on port $port\n" puts "\tOn $ethernet" } } } } if {$protocol == "ipv4" || $protocol == "ipv6"} { foreach deviceGroup [ixNet getList $topology deviceGroup] { foreach ethernet [ixNet getList $deviceGroup ethernet] { foreach ipVersion [ixNet getList $ethernet $protocol] { catch {ixNet execute $action $ipVersion} errMsg if {$errMsg != "::ixNet::OK"} { puts "\nError StartStopPortProtocolNgpf: Failed to $action $protocol NGPF protocol on port $port\n" return 1 } else { puts "\nStartStopPortProtocolNgpf: Successfully $action NGPF $protocol protocol on port $port" puts "\tOn $ipVersion" } } } } } if {$protocol != "ethernet" && $protocol != "ipv4" && $protocol != "ipv6"} { foreach deviceGroup [ixNet getList $topology deviceGroup] { foreach ethernet [ixNet getList $deviceGroup ethernet] { foreach ipv4 [ixNet getList $ethernet ipv4] { set protocolObjDiscovered [ixNet getList $ipv4 $protocol] if {$protocolObjDiscovered != ""} { foreach protocolObj $protocolObjDiscovered { catch {ixNet execute $action $protocolObj} errMsg if {$errMsg != "::ixNet::OK"} { puts "\nError StartStopPortProtocolNgpf: Failed to $action NGPF $port $protocol\n" return 1 } else { puts "\nStartStopPortProtocolNgpf: Successfully $action NGPF $protocol protocol on port $port" puts "\tOn $protocolObj" } } } else { puts "Error StartStopPortProtocolNgpf: $protocol is not configured on $port. If $protocol is configured on $port, verify correct protocol spelling:\n\n$supportedProtocols\n" return 1 } } } } } } } } if {$portDiscoveredFlag == 0} { puts "Error StartStopPortProtocolNgpf: No such port configured: $port" return 1 } } return 0 }