def configuration(topology, request): sw1 = topology.get('sw1') sw2 = topology.get('sw2') sw3 = topology.get('sw3') assert sw1 is not None assert sw2 is not None assert sw3 is not None # Configuring ip address for sw1, sw2 and sw3 configure_interface(sw1, SW1_INTF1, SW1_INTF1_IPV4_ADDR) configure_interface(sw1, SW1_INTF2, SW1_INTF2_IPV4_ADDR) configure_interface(sw2, SW2_INTF1, SW2_INTF1_IPV4_ADDR) configure_interface(sw3, SW3_INTF1, SW3_INTF1_IPV4_ADDR) ports_sw1 = [sw1.ports[SW1_INTF1], sw1.ports[SW1_INTF2]] verify_turn_on_interfaces(sw1, ports_sw1) verify_turn_on_interfaces(sw2, [sw2.ports[SW2_INTF1]]) verify_turn_on_interfaces(sw3, [sw3.ports[SW3_INTF1]]) # Configuring ospf with network command in sw1, sw2 and sw3 configure_ospf_router(sw1, SW1_ROUTER_ID, SW1_INTF1_IPV4_ADDR, OSPF_AREA_1) configure_ospf_router(sw1, SW1_ROUTER_ID, SW1_INTF2_IPV4_ADDR, OSPF_AREA_1) configure_ospf_router(sw2, SW2_ROUTER_ID, SW2_INTF1_IPV4_ADDR, OSPF_AREA_1) configure_ospf_router(sw3, SW3_ROUTER_ID, SW3_INTF1_IPV4_ADDR, OSPF_AREA_1)
def configuration(topology, request): sw1 = topology.get('sw1') sw2 = topology.get('sw2') sw3 = topology.get('sw3') sw4 = topology.get('sw4') sw5 = topology.get('sw5') assert sw1 is not None assert sw2 is not None assert sw3 is not None assert sw4 is not None assert sw5 is not None configure_interface(sw1, SW1_INTF1, SW1_INTF1_IPV4_ADDR) configure_interface(sw1, SW1_INTF2, SW1_INTF2_IPV4_ADDR) configure_interface(sw2, SW2_INTF1, SW2_INTF1_IPV4_ADDR) configure_interface(sw2, SW2_INTF2, SW2_INTF2_IPV4_ADDR) configure_interface(sw3, SW3_INTF1, SW3_INTF1_IPV4_ADDR) configure_interface(sw3, SW3_INTF2, SW3_INTF2_IPV4_ADDR) configure_interface(sw4, SW4_INTF1, SW4_INTF1_IPV4_ADDR) configure_interface(sw5, SW5_INTF2, SW5_INTF2_IPV4_ADDR) ports_sw1 = [sw1.ports[SW1_INTF1], sw1.ports[SW1_INTF2]] verify_turn_on_interfaces(sw1, ports_sw1) ports_sw2 = [sw2.ports[SW2_INTF1], sw2.ports[SW2_INTF2]] verify_turn_on_interfaces(sw2, ports_sw2) ports_sw3 = [sw3.ports[SW3_INTF1], sw3.ports[SW3_INTF2]] verify_turn_on_interfaces(sw3, ports_sw3) ports_sw4 = [sw4.ports[SW4_INTF1]] verify_turn_on_interfaces(sw4, ports_sw4) ports_sw5 = [sw5.ports[SW5_INTF2]] verify_turn_on_interfaces(sw5, ports_sw5) # Configuring ospf with network command in sw1, sw2, sw3, sw4 and sw5 configure_ospf_router(sw1, SW1_ROUTER_ID, SW1_INTF1_IPV4_ADDR, OSPF_AREA_100) configure_ospf_router(sw1, SW1_ROUTER_ID, SW1_INTF2_IPV4_ADDR, OSPF_AREA_100) configure_ospf_router(sw2, SW2_ROUTER_ID, SW2_INTF1_IPV4_ADDR, OSPF_AREA_100) configure_ospf_router(sw2, SW2_ROUTER_ID, SW2_INTF2_IPV4_ADDR, OSPF_AREA_0) configure_ospf_router(sw3, SW3_ROUTER_ID, SW3_INTF1_IPV4_ADDR, OSPF_AREA_200) configure_ospf_router(sw3, SW3_ROUTER_ID, SW3_INTF2_IPV4_ADDR, OSPF_AREA_0) configure_ospf_router(sw4, SW4_ROUTER_ID, SW4_INTF1_IPV4_ADDR, OSPF_AREA_200) configure_ospf_router(sw5, SW5_ROUTER_ID, SW5_INTF2_IPV4_ADDR, OSPF_AREA_100)
def configuration(topology, request): sw1 = topology.get('sw1') sw2 = topology.get('sw2') sw3 = topology.get('sw3') hs1 = topology.get('hs1') hs2 = topology.get('hs2') assert sw1 is not None assert sw2 is not None assert sw3 is not None assert hs1 is not None assert hs2 is not None # Configuring ip address for sw2 and sw3 configure_interface(sw1, SW1_INTF1, SW1_INTF1_IPV4_ADDR) configure_interface(sw1, SW1_INTF2, SW1_INTF2_IPV4_ADDR) configure_interface(sw2, SW2_INTF1, SW2_INTF1_IPV4_ADDR) configure_interface(sw2, SW2_INTF2, SW2_INTF2_IPV4_ADDR) configure_interface(sw3, SW3_INTF1, SW3_INTF1_IPV4_ADDR) configure_interface(sw3, SW3_INTF2, SW3_INTF2_IPV4_ADDR) ports_sw1 = [sw1.ports[SW1_INTF1], sw1.ports[SW1_INTF2]] verify_turn_on_interfaces(sw1, ports_sw1) ports_sw2 = [sw2.ports[SW2_INTF1], sw2.ports[SW2_INTF2]] verify_turn_on_interfaces(sw2, ports_sw2) ports_sw3 = [sw3.ports[SW3_INTF1], sw3.ports[SW3_INTF2]] verify_turn_on_interfaces(sw3, ports_sw3) # Configure IP and bring UP host 1 interfaces hs1.libs.ip.interface('1', addr='10.10.40.2/24', up=True) # Configure IP and bring UP host 2 interfaces hs2.libs.ip.interface('1', addr='10.10.30.2/24', up=True) # Configuring ospf with network command in sw2 and sw3 configure_ospf_router(sw1, SW1_ROUTER_ID, SW1_INTF1_IPV4_ADDR, OSPF_AREA_1) configure_ospf_router(sw2, SW2_ROUTER_ID, SW2_INTF1_IPV4_ADDR, OSPF_AREA_1) configure_ospf_router(sw2, SW2_ROUTER_ID, SW2_INTF2_IPV4_ADDR, OSPF_AREA_1) configure_ospf_router(sw3, SW3_ROUTER_ID, SW3_INTF2_IPV4_ADDR, OSPF_AREA_1)