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

All Samples(10)  |  Call(10)  |  Derive(0)  |  Import(0)
Returns a graph for each AS.

        def get_as_graphs(network):   
    """Returns a graph for each AS."""
    as_graphs = []
    #for asn, nodes in as_dict.items():
    for asn, nodes in network.groupby('asn'):
        # Create seperate graph otherwise all have same attributes
        """
        The graph, edge or node attributes just point to the original graph. 
        So changes to the node or edge structure will not be reflected in the
        original graph while changes to the attributes will.
        To create a subgraph with its own copy of the edge/node attributes use:
            nx.Graph(G.subgraph(nbunch))
        """
        if network.graph.is_directed():
            as_graph = nx.DiGraph(network.graph.subgraph(nodes))
        else:
            as_graph = nx.Graph(network.graph.subgraph(nodes))
        as_graph.name = as_graph.asn = int(asn)
        as_graphs.append(as_graph)
    return as_graphs
        


src/a/n/ank_le-HEAD/AutoNetkit/compiler/netkitcompiler.py   ank_le(Download)
 
        # configures IGP for each AS
        as_graphs = ank.get_as_graphs(self.network)
        for my_as in as_graphs:
            asn = my_as.asn
        physical_graph = self.network.graph
 
        for my_as in ank.get_as_graphs(self.network):
            asn = my_as.asn
            LOG.debug("Configuring IGP for AS %s " % asn)

src/a/n/ank_le-HEAD/AutoNetkit/compiler/cbgpcompiler.py   ank_le(Download)
        ibgp_graph = ank.get_ibgp_graph(self.network)
        ebgp_graph = ank.get_ebgp_graph(self.network)
        as_graphs = ank.get_as_graphs(self.network)
        ip_as_allocs = ank.get_ip_as_allocs(self.network) # Allocs for ebgp announcements
 

src/a/n/ank_le-HEAD/AutoNetkit/plotting/summary.py   ank_le(Download)
    network_stats['server_count'] = len(list(network.servers()))
    network_stats['edge_count'] = network.graph.number_of_edges()
    as_graphs = ank.get_as_graphs(network)
    network_stats['as_count'] = len(as_graphs)
 

src/a/n/ank_le-HEAD/AutoNetkit/algorithms/ip.py   ank_le(Download)
    # Put into dictionary, indexed by ASN (the name attribute of each as graph)
    # for easy appending of eBGP links
    asgraphs = dict((my_as.asn, my_as) for my_as in ank.get_as_graphs(network))
 
    # Simple method: break address_block into a /16 for each network
    network.tap_sn = address_block
 
    as_graph = ank.get_as_graphs(network)
    # Try allocating /24 to each subnet as cleaner
    # then check if this is feasible 

src/a/n/ank_le-HEAD/AutoNetkit/algorithms/dns.py   ank_le(Download)
            dns_graph.node[node]['dns_l3_cluster'] = format_asn(network.asn(node))
 
    for my_as in ank.get_as_graphs(network):
        asn = my_as.asn
        if not nx.is_strongly_connected(my_as):
# TODO: handle different levels
# in 3 level model, l3 servers advertise for AS
    for my_as in ank.get_as_graphs(network):
        devices = [ n for n in my_as]
        as_l3_servers = (n for n in my_as if level(n) == 3)

src/a/n/ank_le-HEAD/AutoNetkit/algorithms/naming.py   ank_le(Download)
def dump_identifiers(network, filename):
    with open( filename, 'w') as f_dump:
# writes out lo_ip for routers, and identifying IP for servers
        for my_as in ank.get_as_graphs(network):
            for router in sorted(network.routers(my_as.asn), key = lambda x: x.fqdn):

src/a/n/ank_le-HEAD/AutoNetkit/algorithms/bgp.py   ank_le(Download)
 
    #TODO: make "asn" eg "asn_1" as could conflict if asn=1 and ibgp_l2_cluster = 1 elsewhere and match the same
    for my_as in ank.get_as_graphs(network):
        #TODO: for neatness, look at redefining the above functions inside here setting my_as as network
        asn = my_as.name