def METHOD_NAME(self, endpoint):
    if self.host_link_latency is None:
        self.host_link_latency = self.link_latency
    # get some local variables from the parameters
    local_ports = int(self.local_ports)
    num_dims = len(self._dim_size)
    # Calculate number of routers and endpoints
    num_routers = 1
    for x in self._dim_size:
        num_routers = num_routers * x
    num_peers = num_routers * local_ports
    radix = local_ports
    for x in range(num_dims):
        radix += (self._dim_width[x] * (self._dim_size[x]-1))
    links = dict()
    def getLink(name1, name2, num):
        # Sort name1 and name2 so order doesn't matter
        if str(name1) < str(name2):
            name = "link_%s_%s_%d"%(name1, name2, num)
        else:
            name = "link_%s_%s_%d"%(name2, name1, num)
        if name not in links:
            links[name] = sst.Link(name)
        #print("Getting link with name: %s"%name)
        return links[name]
    # loop through the routers to hook up links
    for i in range(num_routers):
        # set up 'mydims'
        mydims = self._idToLoc(i)
        mylocstr = self._formatShape(mydims)
        #print("Creating router %s (%d)"%(mylocstr,i))
        rtr = self._instanceRouter(radix,i)
        topology = rtr.setSubComponent(self.router.getTopologySlotName(),"merlin.hyperx")
        self._applyStatisticsSettings(topology)
        topology.addParams(self._getGroupParams("main"))
        port = 0
        # Connect to all routers that only differ in one location index
        for dim in range(num_dims):
            theirdims = mydims[:]
            # We have links to every other router in each dimension
            for router in range(self._dim_size[dim]):
                if router != mydims[dim]: # no link to ourselves
                    theirdims[dim] = router
                    theirlocstr = self._formatShape(theirdims)
                    # Hook up "width" number of links for this dimension
                    for num in range(self._dim_width[dim]):
                        rtr.addLink(getLink(mylocstr, theirlocstr, num), "port%d"%port, self.link_latency)
                        #print("Wired up port %d"%port)
                        port = port + 1
        for n in range(local_ports):
            nodeID = local_ports * i + n
            (ep, port_name) = endpoint.METHOD_NAME(nodeID, {})
            if ep:
                nicLink = sst.Link("nic_%d_%d"%(i, n))
                if self.bundleEndpoints:
                   nicLink.setNoCut()
                nicLink.connect( (ep, port_name, self.host_link_latency), (rtr, "port%d"%port, self.host_link_latency) )
            port = port+1