def apply_design_rules(anm): """Applies appropriate design rules to ANM""" g_in = anm['input'] build_phy(anm) g_phy = anm['phy'] from autonetkit.design.osi_layers import (build_layer2, build_layer2_broadcast, build_layer3) build_layer2(anm) build_layer2_broadcast(anm) build_layer3(anm) build_l3_connectivity(anm) check_server_asns(anm) from autonetkit.design.mpls import build_vrf build_vrf(anm) # do before to add loopbacks before ip allocations from autonetkit.design.ip import build_ip, build_ipv4, build_ipv6 # TODO: replace this with layer2 overlay topology creation build_ip(anm) # ip infrastructure topology address_family = g_in.data.address_family or "v4" # default is v4 # TODO: can remove the infrastructure now create g_ip seperately if address_family == "None": log.info("IP addressing disabled, disabling routing protocol ", "configuration") anm['phy'].data.enable_routing = False if address_family == "None": log.info("IP addressing disabled, skipping IPv4") anm.add_overlay("ipv4") # create empty so rest of code follows g_phy.update(g_phy, use_ipv4=False) elif address_family in ("v4", "dual_stack"): build_ipv4(anm, infrastructure=True) g_phy.update(g_phy, use_ipv4=True) elif address_family == "v6": # Allocate v4 loopbacks for router ids build_ipv4(anm, infrastructure=False) g_phy.update(g_phy, use_ipv4=False) # TODO: Create collision domain overlay for ip addressing - l2 overlay? if address_family == "None": log.info("IP addressing disabled, not allocating IPv6") anm.add_overlay("ipv6") # create empty so rest of code follows g_phy.update(g_phy, use_ipv6=False) elif address_family in ("v6", "dual_stack"): build_ipv6(anm) g_phy.update(g_phy, use_ipv6=True) else: anm.add_overlay("ipv6") # placeholder for compiler logic default_igp = g_in.data.igp or "ospf" ank_utils.set_node_default(g_in, igp=default_igp) ank_utils.copy_attr_from(g_in, g_phy, "include_csr") try: from autonetkit_cisco import build_network as cisco_build_network except ImportError, e: log.debug("Unable to load autonetkit_cisco %s" % e)
def apply_design_rules(anm): """Applies appropriate design rules to ANM""" g_in = anm['input'] build_phy(anm) g_phy = anm['phy'] build_l3_connectivity(anm) check_server_asns(anm) from autonetkit.design.mpls import build_vrf build_vrf(anm) # need to do before to add loopbacks before ip allocations from autonetkit.design.ip import build_ip, build_ipv4, build_ipv6 #TODO: replace this with layer2 overlay topology creation build_ip(anm) # ip infrastructure topology #TODO: set defaults at the start, rather than inline, ie set g_in.data.address_family then use later address_family = g_in.data.address_family or "v4" # default is v4 #TODO: can remove the infrastructure now create g_ip seperately if address_family == "None": log.info( "IP addressing disabled, disabling routing protocol configuration") anm['phy'].data.enable_routing = False if address_family == "None": log.info("IP addressing disabled, skipping IPv4") anm.add_overlay("ipv4") # create empty so rest of code follows through g_phy.update(g_phy, use_ipv4=False) elif address_family in ("v4", "dual_stack"): build_ipv4(anm, infrastructure=True) g_phy.update(g_phy, use_ipv4=True) elif address_family == "v6": # Allocate v4 loopbacks for router ids build_ipv4(anm, infrastructure=False) g_phy.update(g_phy, use_ipv4=False) #TODO: Create a collision domain overlay for ip addressing - l2 overlay? if address_family == "None": log.info("IP addressing disabled, not allocating IPv6") anm.add_overlay("ipv6") # create empty so rest of code follows through g_phy.update(g_phy, use_ipv6=False) elif address_family in ("v6", "dual_stack"): build_ipv6(anm) g_phy.update(g_phy, use_ipv6=True) else: anm.add_overlay("ipv6") # placeholder for compiler logic default_igp = g_in.data.igp or "ospf" ank_utils.set_node_default(g_in, igp=default_igp) ank_utils.copy_attr_from(g_in, g_phy, "include_csr") try: from autonetkit_cisco import build_network as cisco_build_network except ImportError, e: log.debug("Unable to load autonetkit_cisco %s" % e)
# autonetkit.update_http(anm) # log.info("Building layer3") build_layer3(anm) # assign interface ip from pool # assign_interface_ip_pool(anm) # assign loopback ip from pool # assign_loopback_ip_pool(anm) check_server_asns(anm) from autonetkit.design.mpls import build_vrf build_vrf(anm) # do before to add loopbacks before ip allocations from autonetkit.design.ip import build_ip, build_ipv4, build_ipv6 # TODO: replace this with layer2 overlay topology creation # log.info("Allocating IP addresses") build_ip(anm) # ip infrastructure topology address_family = g_in.data.address_family or "v4" # default is v4 # TODO: can remove the infrastructure now create g_ip seperately if address_family == "None": log.info("IP addressing disabled, disabling routing protocol ", "configuration") anm["phy"].data.enable_routing = False if address_family == "None": log.info("IP addressing disabled, skipping IPv4") anm.add_overlay("ipv4") # create empty so rest of code follows
cisco_build_network.post_phy(anm) g_phy = anm['phy'] from autonetkit.design.osi_layers import build_layer1, build_layer2, build_layer3 # log.info("Building layer2") build_layer1(anm) build_layer2(anm) # autonetkit.update_http(anm) # log.info("Building layer3") build_layer3(anm) check_server_asns(anm) from autonetkit.design.mpls import build_vrf build_vrf(anm) # do before to add loopbacks before ip allocations from autonetkit.design.ip import build_ip, build_ipv4, build_ipv6 # TODO: replace this with layer2 overlay topology creation # log.info("Allocating IP addresses") build_ip(anm) # ip infrastructure topology address_family = g_in.data.address_family or "v4" # default is v4 # TODO: can remove the infrastructure now create g_ip seperately if address_family == "None": log.info("IP addressing disabled, disabling routing protocol ", "configuration") anm['phy'].data.enable_routing = False if address_family == "None": log.info("IP addressing disabled, skipping IPv4") anm.add_overlay("ipv4") # create empty so rest of code follows