Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
Allocated interface IDs for each link in network

>>> network = ank.example_multi_as()
>>> alloc_interfaces(network)
>>> print ank.debug_edges(network.graph, "id")
{('1a.AS1', '1b.AS1'): 0,
 ('1a.AS1', '1c.AS1'): 1,
 ('1b.AS1', '1a.AS1'): 0,
 ('1b.AS1', '1c.AS1'): 1,
 ('1b.AS1', '3a.AS3'): 2,(more...)

        def alloc_interfaces(network):
    """Allocated interface IDs for each link in network

    >>> network = ank.example_multi_as()
    >>> alloc_interfaces(network)
    >>> print ank.debug_edges(network.graph, "id")
    {('1a.AS1', '1b.AS1'): 0,
     ('1a.AS1', '1c.AS1'): 1,
     ('1b.AS1', '1a.AS1'): 0,
     ('1b.AS1', '1c.AS1'): 1,
     ('1b.AS1', '3a.AS3'): 2,
     ('1c.AS1', '1a.AS1'): 0,
     ('1c.AS1', '1b.AS1'): 1,
     ('1c.AS1', '2a.AS2'): 2,
     ('2a.AS2', '1c.AS1'): 0,
     ('2a.AS2', '2b.AS2'): 1,
     ('2a.AS2', '2d.AS2'): 2,
     ('2b.AS2', '2a.AS2'): 0,
     ('2b.AS2', '2c.AS2'): 1,
     ('2c.AS2', '2b.AS2'): 0,
     ('2c.AS2', '2d.AS2'): 1,
     ('2d.AS2', '2a.AS2'): 0,
     ('2d.AS2', '2c.AS2'): 1,
     ('2d.AS2', '3a.AS3'): 2,
     ('3a.AS3', '1b.AS1'): 0,
     ('3a.AS3', '2d.AS2'): 1}
    
    """
    LOG.debug("Allocating interfaces")
    for rtr in sorted(network.graph):
        for index, (src, dst) in enumerate(sorted(network.graph.edges(rtr))):
            network.graph[src][dst]['id'] = index
        


src/a/n/ank_le-HEAD/AutoNetkit/internet.py   ank_le(Download)
        # Allocations  
        ank.allocate_subnets(self.network, IPNetwork("10.0.0.0/8")) 
        ank.alloc_interfaces(self.network)
 
        ank.alloc_tap_hosts(self.network, self.tapsn)