---
name: "TnmMap"
section: "3tnm"
platform: "linux"
package: "scotty"
version: "4:00-02-21-2"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/TnmMap"
---

# TnmMap(3tnm)

A Tcl/Tk package for manipulating network maps.

```

```

## NAME

TnmMap - A Tcl/Tk package for manipulating network maps.

```

```

## DESCRIPTION

The Tnm map(n) command provides a common infrastructure used to build simple but powerful network management tools which can easily exchange their configuration databases. This package extends the map(n) command with a library of Tcl procedures that are used to implement common functions used within different applications.

## USING THE PACKAGE

The TnmMap package is loaded into a Tcl interpreter by using the following sequence of Tcl commands:

```
package require Tnm
package require TnmInet $tnm(version)
package require TnmMap $tnm(version)
```

All the TnmMap commands live in the TnmMap namespace. You can import these commands into the current namespace by using the following Tcl command:

```
namespace import TnmMap::*
```

It is however suggested to import commands explicitely or to use the full name in scripts to avoid name clashes.

## COMMANDS

- **TnmMap::GetIpAddress *node***

  The **TnmMap::GetIpAddress** procedure returns the IP address of a map item. It first checks whether the first element of the value of the -address option contains a valid IP address. If not, it tries to lookup an IP address by using the value of the -address option as an argument to TnmInet::GetIpAddress. The next attempt is to call TnmInet::GetIpAddress with the value of the -name option. An error is generated if all lookup attempts fail. The **TnmMap::GetIpAddress** procedure saves the IP address in the -address option if the lookup was successful and the option has been empty to ensure that future lookups are faster.

- **TnmMap::GetIpName *node***

  The **TnmMap::GetIpName** procedure returns the IP name of a map item. It first checks whether the -name option contains a suitable value. If this test fails, an attempt is made to convert the value in the -address option into a name. The -name option will be updated if the conversion is successful and the -name option is currently empty. An error is thrown if all attempts to retrieve an IP name fail.

- **TnmMap::GetSnmpSession *node***

  The **TnmMap::GetSnmpSession** procedure returns an SNMP session handle which can be used to send SNMP requests to a map item. This procedure first checks whether the Tnm:Snmp:Alias attribute is defined. It tries to create an SNMP session using the value of Tnm:Snmp:Alias as an alias name if it is not empty. The procedure looks at the attribute Tnm:Snmp:Config if the attribute Tnm:Snmp:Alias is not defined. It tries to create an SNMP session using the value of Tnm:Snmp:Config as a list of configuration options if it is not empty. Finally, the procedure tries to get the IP address using the **TnmMap::GetIpAddress** procedure and it initializes an SNMP session with this IP address and the default parameters. Errors are generated if the attempts to create a session fail.

- **TnmMap::TraceRoute *node* \[*maxlength* \[*retries*\]\]**

  The **TnmMap::TraceRoute** procedure traces an IP route using the van Jacobsen algorithm. The procedure creates one or more events while tracing the route to *node*. The *maxlength* parameter defines the maximum route length and the *retries* parameter the number of retries per hop. The default values are a maximum length of 32 hops and 3 retries per hop.

  The procedure generates a series of *TnmMap:TraceRoute:Value* events to report the result of each tracing step. The end of the routing trace is signalled by a *TnmMap:TraceRoute:Done* event. The node should have appropriate event bindings to handle these events.

  The **TnmMap::TraceRoute** procedure will throw an error if it fails to retrieve an IP address for the node or there is an error while sending and receiving ICMP messages.

## SEE ALSO

[scotty(1)](/scotty/1.md), Tnm(n), [Tcl(n)](/Tcl/n.md), map(n)

## AUTHORS

Juergen Schoenwaelder \<schoenw@ibr.cs.tu-bs.de\>\
