Exemplo n.º 1
0
    def build(self, *args, **kwargs):
        """
                             +--------+
                             | server |
                             +---+----+
                                 |
                              +--+-+
                        +-----+ r1 +-----+
                        |     +----+     |
        +-------+     +-+--+          +--+-+     +--------+
        | slave +-----+ r2 +----------+ r3 +-----+ master |
        +-------+     +----+          +----+     +--------+
        """
        # Add routers

        r1, r2, r3 = self.addRouters('r1', 'r2', 'r3')
        self.addLinks((r1, r2), (r1, r3), (r3, r2))

        # Add hosts

        server = self.addHost('server')
        lr1server = self.addLink(r1, server)
        self.addSubnet(links=[lr1server],
                       subnets=["192.168.0.0/24", "fc00::/64"])

        master = self.addHost('master')
        master.addDaemon(Named)
        self.addLink(r3, master)

        slave = self.addHost('slave')
        slave.addDaemon(Named)
        self.addLink(r2, slave)

        # Declare a new DNS Zone

        # By default all the NS, A and AAAA records are generated
        # but you can add them explicitly to change their TTL
        records = [ARecord(server, "fc00::2", ttl=120)]
        self.addDNSZone(name="mydomain.org",
                        dns_master=master,
                        dns_slaves=[slave],
                        nodes=[server],
                        records=records)

        # By default IPMininet creates the reverse DNS zones for the addresses
        # of the other zones but if you want to change the default values of
        # the zone or of the PTR records, you can declare them explicitly.
        # The missing PTR records will be placed in this zone if their prefix
        # match or another reverse zone will be created.
        ptr_record = PTRRecord("fc00::2", server + ".mydomain.org", ttl=120)
        # reverse_domain_name is "f.ip6.arpa"
        reverse_domain_name = ip_address("fc00::").reverse_pointer[-10:]
        self.addDNSZone(name=reverse_domain_name,
                        dns_master=master,
                        dns_slaves=[slave],
                        records=[ptr_record],
                        ns_domain_name="mydomain.org",
                        retry_time=8200)

        super().build(*args, **kwargs)
Exemplo n.º 2
0
def test_dns_network(named_cfg, zone_args, exp_named_cfg, exp_zone_cfg):
    try:
        net = IPNet(topo=CustomDNSNetwork(named_cfg, zone_args))
        net.start()

        # Check generated configurations
        with open("/tmp/named_master2.cfg") as fileobj:
            cfg = fileobj.readlines()
            for line in exp_named_cfg:
                assert line + "\n" in cfg,\
                    "Cannot find the line '%s' in the generated " \
                    "main configuration:\n%s" % (line, "".join(cfg))
        with open("/tmp/named_master2.test.org.zone.cfg") as fileobj:
            cfg = fileobj.readlines()
            for line in exp_zone_cfg:
                assert line + "\n" in cfg,\
                    "Cannot find the line '%s' in the generated zone " \
                    "configuration:\n%s" % (line, "".join(cfg))

        # Check port number configuration
        dns_server_port = named_cfg.get("dns_server_port", 53)
        assert_dns_record(net["master2"],
                          "localhost",
                          AAAARecord("master2.test.org",
                                     net["master2"].defaultIntf().ip6),
                          port=dns_server_port)

        # Check connectivity
        assert_connectivity(net, v6=False)
        assert_connectivity(net, v6=True)

        # Check generated DNS record
        records = [
            NSRecord("mydomain.org", "master"),
            NSRecord("mydomain.org", "slave"),
            ARecord("master.mydomain.org", net["master"].defaultIntf().ip),
            AAAARecord("master.mydomain.org", net["master"].defaultIntf().ip6),
            ARecord("slave.mydomain.org", net["slave"].defaultIntf().ip),
            AAAARecord("slave.mydomain.org", net["slave"].defaultIntf().ip6),
            ARecord("server.mydomain.org", net["server"].defaultIntf().ip),
            AAAARecord("server.mydomain.org",
                       net["server"].defaultIntf().ip6,
                       ttl=120),
            PTRRecord(net["master"].defaultIntf().ip, "master.mydomain.org"),
            PTRRecord(net["master"].defaultIntf().ip6, "master.mydomain.org"),
            PTRRecord(net["slave"].defaultIntf().ip, "slave.mydomain.org"),
            PTRRecord(net["slave"].defaultIntf().ip6, "slave.mydomain.org"),
            PTRRecord(net["server"].defaultIntf().ip, "server.mydomain.org"),
            PTRRecord(net["server"].defaultIntf().ip6,
                      "server.mydomain.org",
                      ttl=120)
        ]
        for node in [net["master"], net["slave"]]:
            for record in records:
                assert_dns_record(node, "localhost", record)
            time.sleep(10)

        net.stop()
    finally:
        cleanup()
Exemplo n.º 3
0
    def build(self, *args, **kwargs):
        """
        Build the topology of our OVH network and set up it by adding routers, links, protocols, setting up routers
        reflectors, etc.
        """
        # Adding routers
        fra1_g1 = self.addRouter("fra1_g1", [
            IPv6Address("2023", "a", "c", "0", "0", "0", "0", "1",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(12, 16, 216, 1, IPV4_LO_PREFIX).__str__()
        ])
        fra1_g2 = self.addRouter("fra1_g2", [
            IPv6Address("2023", "a", "c", "0", "0", "0", "0", "2",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(12, 16, 216, 2, IPV4_LO_PREFIX).__str__()
        ])
        fra_sbb1 = self.addRouter("fra_sbb1", [
            IPv6Address("2023", "a", "c", "0", "0", "0", "0", "3",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(12, 16, 216, 3, IPV4_LO_PREFIX).__str__()
        ])
        fra_sbb2 = self.addRouter("fra_sbb2", [
            IPv6Address("2023", "a", "c", "0", "0", "0", "0", "4",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(12, 16, 216, 4, IPV4_LO_PREFIX).__str__()
        ])
        fra_1 = self.addRouter("fra_1", [
            IPv6Address("2023", "a", "c", "0", "0", "0", "0", "5",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(12, 16, 216, 5, IPV4_LO_PREFIX).__str__()
        ])
        fra_5 = self.addRouter("fra_5", [
            IPv6Address("2023", "a", "c", "0", "0", "0", "0", "6",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(12, 16, 216, 6, IPV4_LO_PREFIX).__str__()
        ])
        rbx_g1 = self.addRouter("rbx_g1", [
            IPv6Address("2023", "a", "d", "0", "0", "0", "0", "1",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(12, 16, 216, 7, IPV4_LO_PREFIX).__str__()
        ])
        rbx_g2 = self.addRouter("rbx_g2", [
            IPv6Address("2023", "a", "d", "0", "0", "0", "0", "2",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(12, 16, 216, 8, IPV4_LO_PREFIX).__str__()
        ])
        sbg_g1 = self.addRouter("sbg_g1", [
            IPv6Address("2023", "a", "e", "0", "0", "0", "0", "1",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(12, 16, 216, 9, IPV4_LO_PREFIX).__str__()
        ])
        sbg_g2 = self.addRouter("sbg_g2", [
            IPv6Address("2023", "a", "e", "0", "0", "0", "0", "2",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(12, 16, 216, 10, IPV4_LO_PREFIX).__str__()
        ])
        par_th2 = self.addRouter("par_th2", [
            IPv6Address("2023", "a", "f", "0", "0", "0", "0", "1",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(12, 16, 216, 11, IPV4_LO_PREFIX).__str__()
        ])
        par_gsw = self.addRouter("par_gsw", [
            IPv6Address("2023", "a", "f", "0", "0", "0", "0", "2",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(12, 16, 216, 12, IPV4_LO_PREFIX).__str__()
        ])
        telia = self.addRouter("telia", [
            IPv6Address("2299", "a", "5", "0", "0", "0", "0", "1",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(123, 3, 2, 1, IPV4_LO_PREFIX).__str__()
        ])
        google = self.addRouter("google", [
            IPv6Address("2169", "a", "6", "0", "0", "0", "0", "1",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(124, 3, 2, 1, IPV4_LO_PREFIX).__str__()
        ])
        cogent = self.addRouter("cogent", [
            IPv6Address("2174", "a", "7", "0", "0", "0", "0", "1",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(125, 3, 2, 1, IPV4_LO_PREFIX).__str__()
        ])
        level3 = self.addRouter("level3", [
            IPv6Address("2356", "a", "8", "0", "0", "0", "0", "1",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(126, 3, 2, 1, IPV4_LO_PREFIX).__str__()
        ])
        all_routers = [
            fra1_g1, fra1_g2, fra_sbb1, fra_sbb2, fra_1, fra_5, rbx_g1, rbx_g2,
            sbg_g1, sbg_g2, par_th2, par_gsw, telia, google, cogent, level3
        ]
        fra_routers = [fra1_g1, fra1_g2, fra_sbb1, fra_sbb2, fra_1,
                       fra_5]  # In Frankfurt
        rbx_routers = [rbx_g1, rbx_g2]  # In Roubaix
        sbg_routers = [sbg_g1, sbg_g2]  # In Strasbourg
        par_routers = [par_th2, par_gsw]  # In Paris
        ovh_routers = fra_routers + rbx_routers + sbg_routers + par_routers
        external_routers = [telia, google, cogent, level3]

        # Adding physical links
        self.add_physical_link(fra1_g1, fra1_g2, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "0",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 0, IPV4_LINK_PREFIX)))
        self.add_physical_link(fra1_g1, fra_sbb1, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "2",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 2, IPV4_LINK_PREFIX)))
        self.add_physical_link(fra1_g2, fra_sbb2, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "4",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 4, IPV4_LINK_PREFIX)))
        self.add_physical_link(fra_sbb1, fra_sbb2, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "6",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 6, IPV4_LINK_PREFIX)))
        self.add_physical_link(fra_sbb1, fra_5, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "8",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 8, IPV4_LINK_PREFIX)))
        self.add_physical_link(fra_sbb1, fra_1, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "a",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 10, IPV4_LINK_PREFIX)))
        self.add_physical_link(
            fra_sbb1,
            sbg_g1, (IPv6Address("2023", "b", "0", "0", "0", "0", "0", "c",
                                 IPV6_LINK_PREFIX),
                     IPv4Address(12, 16, 217, 12, IPV4_LINK_PREFIX)),
            igp_cost_value=2)
        self.add_physical_link(
            fra_sbb1,
            rbx_g1, (IPv6Address("2023", "b", "0", "0", "0", "0", "0", "e",
                                 IPV6_LINK_PREFIX),
                     IPv4Address(12, 16, 217, 14, IPV4_LINK_PREFIX)),
            igp_cost_value=5)
        self.add_physical_link(fra_sbb2, fra_1, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "10",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 16, IPV4_LINK_PREFIX)))
        self.add_physical_link(fra_sbb2, fra_5, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "12",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 18, IPV4_LINK_PREFIX)))
        self.add_physical_link(
            fra_sbb2,
            rbx_g2, (IPv6Address("2023", "b", "0", "0", "0", "0", "0", "14",
                                 IPV6_LINK_PREFIX),
                     IPv4Address(12, 16, 217, 20, IPV4_LINK_PREFIX)),
            igp_cost_value=5)
        self.add_physical_link(
            fra_sbb2,
            sbg_g2, (IPv6Address("2023", "b", "0", "0", "0", "0", "0", "16",
                                 IPV6_LINK_PREFIX),
                     IPv4Address(12, 16, 217, 22, IPV4_LINK_PREFIX)),
            igp_cost_value=2)
        self.add_physical_link(fra_1, telia, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "18",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 24, IPV4_LINK_PREFIX)))
        self.add_physical_link(fra_5, telia, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "1a",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 26, IPV4_LINK_PREFIX)))
        self.add_physical_link(fra_5, level3, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "1c",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 28, IPV4_LINK_PREFIX)))
        self.add_physical_link(rbx_g1, rbx_g2, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "1e",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 30, IPV4_LINK_PREFIX)))
        self.add_physical_link(
            rbx_g1,
            par_th2, (IPv6Address("2023", "b", "0", "0", "0", "0", "0", "20",
                                  IPV6_LINK_PREFIX),
                      IPv4Address(12, 16, 217, 32, IPV4_LINK_PREFIX)),
            igp_cost_value=3)
        self.add_physical_link(rbx_g2, par_gsw, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "22",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 34, IPV4_LINK_PREFIX)))
        self.add_physical_link(sbg_g1, sbg_g2, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "24",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 36, IPV4_LINK_PREFIX)))
        self.add_physical_link(
            sbg_g1,
            par_th2, (IPv6Address("2023", "b", "0", "0", "0", "0", "0", "26",
                                  IPV6_LINK_PREFIX),
                      IPv4Address(12, 16, 217, 38, IPV4_LINK_PREFIX)),
            igp_cost_value=5)
        self.add_physical_link(par_th2, par_gsw, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "28",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 40, IPV4_LINK_PREFIX)))
        self.add_physical_link(
            par_th2,
            google, (IPv6Address("2023", "b", "0", "0", "0", "0", "0", "2a",
                                 IPV6_LINK_PREFIX),
                     IPv4Address(12, 16, 217, 42, IPV4_LINK_PREFIX)),
            igp_cost_value=2)
        self.add_physical_link(par_th2, cogent, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "2c",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 44, IPV4_LINK_PREFIX)))
        self.add_physical_link(
            par_gsw,
            sbg_g2, (IPv6Address("2023", "b", "0", "0", "0", "0", "0", "2e",
                                 IPV6_LINK_PREFIX),
                     IPv4Address(12, 16, 217, 46, IPV4_LINK_PREFIX)),
            igp_cost_value=5)
        self.add_physical_link(par_gsw, level3, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "30",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 48, IPV4_LINK_PREFIX)))
        self.add_physical_link(par_gsw, cogent, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "32",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 50, IPV4_LINK_PREFIX)))
        self.add_physical_link(
            par_gsw,
            google, (IPv6Address("2023", "b", "0", "0", "0", "0", "0", "34",
                                 IPV6_LINK_PREFIX),
                     IPv4Address(12, 16, 217, 52, IPV4_LINK_PREFIX)),
            igp_cost_value=2)

        # Adding OSPF and BGP daemons to routers
        self.add_ospf(all_routers)
        self.add_bgp(ovh_routers, external_routers)

        # Adding AS ownerships
        self.addAS(OVH_AS, (fra1_g1, fra1_g2, fra_sbb1, fra_sbb2, fra_1, fra_5,
                            rbx_g1, rbx_g2, sbg_g1, par_th2, par_gsw, sbg_g2))
        self.addAS(TELIA_AS, (telia, ))
        self.addAS(COGENT_AS, (cogent, ))
        self.addAS(LEVEL3_AS, (level3, ))
        self.addAS(GOOGLE_AS, (google, ))

        # Configuring RRs/iBGP sessions
        peers_fra_fr5_sbb1 = peers_fra_5 = [fra1_g1, fra1_g2, fra_sbb2, fra_1]
        peers_rbx_g1 = peers_rbx_g2 = [sbg_g1, par_th2, par_gsw, sbg_g2]
        set_rr(self, rr=fra_sbb1, peers=peers_fra_fr5_sbb1)
        set_rr(self, rr=fra_5, peers=peers_fra_5)
        set_rr(self, rr=rbx_g1, peers=peers_rbx_g1)
        set_rr(self, rr=rbx_g2, peers=peers_rbx_g2)
        self.addiBGPFullMesh(16276, routers=[fra_sbb1, fra_5, rbx_g1,
                                             rbx_g2])  # (4*3)/2 iBGP sessions

        # Adding eBGP sessions
        ebgp_session(self, telia, fra_1, link_type=CLIENT_PROVIDER)
        ebgp_session(self, telia, fra_5, link_type=CLIENT_PROVIDER)
        ebgp_session(self, level3, fra_5, link_type=CLIENT_PROVIDER)
        ebgp_session(self, google, par_gsw, link_type=CLIENT_PROVIDER)
        ebgp_session(self, cogent, par_gsw, link_type=CLIENT_PROVIDER)
        ebgp_session(self, level3, par_gsw, link_type=CLIENT_PROVIDER)
        ebgp_session(self, cogent, par_th2, link_type=CLIENT_PROVIDER)
        ebgp_session(self, google, par_th2, link_type=CLIENT_PROVIDER)

        # DNS anycast
        sbg_web = self.addHost("sbg_web")
        fra_server = self.addRouter("fra_server", [
            IPv6Address("2023", "a", "c", "0", "0", "0", "0", "7",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(12, 16, 216, 13, IPV4_LO_PREFIX).__str__()
        ])
        rbx_server = self.addRouter("rbx_server", [
            IPv6Address("2023", "a", "c", "0", "0", "0", "0", "7",
                        IPV6_LO_PREFIX).__str__(),
            IPv4Address(12, 16, 216, 13, IPV4_LO_PREFIX).__str__()
        ])
        fra_server.addDaemon(
            BGP,
            address_families=(AF_INET(redistribute=("connected", )),
                              AF_INET6(redistribute=("connected", ))))
        rbx_server.addDaemon(
            BGP,
            address_families=(AF_INET(redistribute=("connected", )),
                              AF_INET6(redistribute=("connected", ))))
        self.addAS(64512, (fra_server, ))  # private ASN
        self.addAS(64513, (rbx_server, ))
        self.add_physical_link(rbx_g1, rbx_server, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "36",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 54, IPV4_LINK_PREFIX)))
        self.add_physical_link(fra_sbb2, fra_server, (IPv6Address(
            "2023", "b", "0", "0", "0", "0", "0", "36",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 217, 54, IPV4_LINK_PREFIX)))
        self.add_physical_link(sbg_g2, sbg_web, (IPv6Address(
            "2023", "e", "2", "0", "0", "0", "0", "3",
            IPV6_LINK_PREFIX), IPv4Address(12, 16, 218, 71, IPV4_LINK_PREFIX)))

        ebgp_session(self, fra_server, fra_sbb2, link_type=CLIENT_PROVIDER)
        ebgp_session(self, rbx_server, rbx_g1, link_type=CLIENT_PROVIDER)

        fra_server.addDaemon(Named)
        rbx_server.addDaemon(Named)
        self.addDNSZone(name=DOMAIN,
                        dns_master=fra_server,
                        dns_slaves=[rbx_server],
                        nodes=[sbg_web])

        reverse_domain_name_ipv6 = ip_address("2023::").reverse_pointer[
            -10:]  # adding a missing PTR record
        ptr_record_ipv6 = PTRRecord(
            IPv6Address("2023", "b", "0", "0", "0", "0", "0", "38",
                        IPV6_LINK_PREFIX).__str__()[:-4],
            sbg_web + f".{DOMAIN}")
        self.addDNSZone(name=reverse_domain_name_ipv6,
                        dns_master=fra_server,
                        dns_slaves=[rbx_server],
                        ns_domain_name=DOMAIN,
                        records=[ptr_record_ipv6])

        super().build(*args, **kwargs)
Exemplo n.º 4
0
    def build(self, *args, **kwargs):
        print('Building the Network, Please Wait.....')
        # Add routers
        # -----------------------------------------------------------------------------------------------------
        # Singapore Routers   BABE:1:00YM    Y = 0 -> for loopback   M = 0 -> for Singapore 139.99.0
        # -----------------------------------------------------------------------------------------------------
        sin_r1 = self.add_config_router(
            'sin_r1', ["BABE:1:0000::1/128", "139.99.0.1/32"],
            family4=AF_INET(networks=('139.99.0.0/17', ), ),
            family6=AF_INET6(networks=('BABE:1:0000::/64', ), ))
        sin_r2 = self.add_config_router(
            'sin_r2', ["BABE:1:0000::2/128", "139.99.0.2/32"],
            family4=AF_INET(networks=('139.99.0.0/17', ), ),
            family6=AF_INET6(networks=('BABE:1:0000::/64', ), ))
        sin_r3 = self.add_config_router(
            'sin_r3', ["BABE:1:0000::3/128", "139.99.0.3/32"],
            family4=AF_INET(networks=('139.99.0.0/17', ), ),
            family6=AF_INET6(networks=('BABE:1:0000::/64', ), ))
        sin_r4 = self.add_config_router(
            'sin_r4', ["BABE:1:0000::4/128", "139.99.0.4/32"],
            family4=AF_INET(networks=('139.99.0.0/17', ), ),
            family6=AF_INET6(networks=('BABE:1:0000::/64', ), ))
        sin_r5 = self.add_config_router(
            'sin_r5', ["BABE:1:0000::5/128", "139.99.0.5/32"],
            family4=AF_INET(networks=('139.99.0.0/17', ), ),
            family6=AF_INET6(networks=('BABE:1:0000::/64', ), ))
        sin_r6 = self.add_config_router(
            'sin_r6', ["BABE:1:0000::6/128", "139.99.0.6/32"],
            family4=AF_INET(networks=('139.99.0.0/17', ), ),
            family6=AF_INET6(networks=('BABE:1:0000::/64', ), ))
        # -----------------------------------------------------------------------------------------------------
        # Australia Routers  BABE:1:00YM    Y = 0 -> for loopback   M = 1 -> for Australia 139.99.0
        # -----------------------------------------------------------------------------------------------------
        syd_bb1 = self.add_config_router(
            'syd_bb1', ["BABE:1:0001::1/128", "139.99.0.7/32"],
            family4=AF_INET(networks=('139.99.0.0/17', ), ),
            family6=AF_INET6(networks=('BABE:1:0001::/64', ), ))
        syd_bb2 = self.add_config_router(
            'syd_bb2', ["BABE:1:0001::2/128", "139.99.0.8/32"],
            family4=AF_INET(networks=('139.99.0.0/17', ), ),
            family6=AF_INET6(networks=('BABE:1:0001::/64', ), ))
        syd_r3 = self.add_config_router(
            'syd_r3', ["BABE:1:0001::3/128", "139.99.0.9/32"],
            family4=AF_INET(networks=('139.99.0.0/17', ), ),
            family6=AF_INET6(networks=('BABE:1:0001::/64', ), ))
        syd_r4 = self.add_config_router(
            'syd_r4', ["BABE:1:0001::4/128", "139.99.0.10/32"],
            family4=AF_INET(networks=('139.99.0.0/17', ), ),
            family6=AF_INET6(networks=('BABE:1:0001::/64', ), ))
        syd_r5 = self.add_config_router(
            'syd_r5', ["BABE:1:0001::5/128", "139.99.0.11/32"],
            family4=AF_INET(networks=('139.99.0.0/17', ), ),
            family6=AF_INET6(networks=('BABE:1:0001::/64', ), ))
        syd_r6 = self.add_config_router(
            'syd_r6', ["BABE:1:0001::6/128", "139.99.0.12/32"],
            family4=AF_INET(networks=('139.99.0.0/17', ), ),
            family6=AF_INET6(networks=('BABE:1:0001::/64', ), ))
        # -----------------------------------------------------------------------------------------------------
        # inter AS Routers /(telstra = BABE:1:0005/139.98.0)/(equinix = BABE:1:0007/139.96.0)
        # -----------------------------------------------------------------------------------------------------
        syd_tel1 = self.add_config_router(
            'syd_tel1', ["BABE:1:0005::1/128", "139.98.0.1/32"],
            family4=AF_INET(networks=('139.98.0.0/24', ), ),
            family6=AF_INET6(networks=('BABE:1:0005::/64', ), ))
        syd_tel2 = self.add_config_router(
            'syd_tel2', ["BABE:1:0005::2/128", "139.98.0.2/32"],
            family4=AF_INET(networks=('139.98.0.0/24', ), ),
            family6=AF_INET6(networks=('BABE:1:0005::/64', ), ))
        syd_ntt1 = self.add_config_router(
            'syd_ntt1', ["BABE:1:0006::1/128", "139.97.0.1/32"],
            family4=AF_INET(networks=('139.97.0.0/24', ), ),
            family6=AF_INET6(networks=('BABE:1:0006::/64', ), ))
        syd_eq = self.add_config_router(
            'syd_eq', ["BABE:1:0007::1/128", "139.96.0.1/32"],
            family4=AF_INET(networks=('139.96.0.0/24', ), ),
            family6=AF_INET6(networks=('BABE:1:0007::/64', ), ))
        syd_ntt2 = self.add_config_router(
            'syd_ntt2', ["BABE:1:0006::2/128", "139.97.0.2/32"],
            family4=AF_INET(networks=('139.97.0.0/24', ), ),
            family6=AF_INET6(networks=('BABE:1:0006::/64', ), ))
        # -----------------------------------------------------------------------------------------------------
        # NTT = BABE:1:0006 / 139.96.0
        # -----------------------------------------------------------------------------------------------------
        sin_eq = self.add_config_router(
            'sin_eq', ["BABE:1:0007::2/128", "139.96.0.2/32"],
            family4=AF_INET(networks=('139.96.0.0/24', ), ),
            family6=AF_INET6(networks=('BABE:1:0007::/64', ), ))
        sin_ntt = self.add_config_router(
            'sin_ntt', ["BABE:1:0006::3/128", "139.97.0.3/32"],
            family4=AF_INET(networks=('139.97.0.0/24', ), ),
            family6=AF_INET6(networks=('BABE:1:0006::/64', ), ))
        sin_tel = self.add_config_router(
            'sin_tel', ["BABE:1:0005::3/128", "139.98.0.3/32"],
            family4=AF_INET(networks=('139.98.0.0/24', ), ),
            family6=AF_INET6(networks=('BABE:1:0005::/64', ), ))
        # -----------------------------------------------------------------------------------------------------
        # France Routers   BABE:1:00YM =  Y = o -> for loopback   M = 2 -> for France / 139.95.0
        # -----------------------------------------------------------------------------------------------------
        mrs = self.add_config_router(
            'mrs', ["BABE:1:0002::1/128", "139.95.0.1/32"],
            family4=AF_INET(networks=('139.95.0.0/24', ), ),
            family6=AF_INET6(networks=('BABE:1:0002::/64', ), ))
        # -----------------------------------------------------------------------------------------------------
        # USA Routers      BABE:1:00YM =  Y = o -> for loopback   M = 3 -> for USA / 139.94.0
        # -----------------------------------------------------------------------------------------------------
        lax = self.add_config_router(
            'lax', ["BABE:1:0003::1/128", "139.94.0.1/32"],
            family4=AF_INET(networks=('139.94.0.0/24', ), ),
            family6=AF_INET6(networks=('BABE:1:0003::/64', ), ))
        sjo = self.add_config_router(
            'sjo', ["BABE:1:0003::2/128", "139.94.0.2/32"],
            family4=AF_INET(networks=('139.94.0.0/24', ), ),
            family6=AF_INET6(networks=('BABE:1:0003::/64', ), ))
        # -----------------------------------------------------------------------------------------------------
        # Customers Routers  BABE:1:00YM:x+1 =  Y = 2 -> for customers / 139.x+1.15
        # -----------------------------------------------------------------------------------------------------
        client1 = self.add_config_router(
            'client1', ["BABE:1:0020:1::0/128", "139.91.15.0/32"],
            family4=AF_INET(networks=('139.91.15.0/24', ), ),
            family6=AF_INET6(networks=(
                'BABE:1:0020:1::0/64',
                'BABE:1f01::0/64',
            ), ))
        client1b = self.add_config_router(
            'client1b', ["BABE:1:0020:1::1/128", "139.91.15.1/32"],
            family4=AF_INET(networks=('139.91.15.0/24', ), ),
            family6=AF_INET6(networks=(
                'BABE:1:0020:1::0/64',
                'BABE:1f01::0/64',
            ), ))
        client2 = self.add_config_router(
            'client2', ["BABE:1:0020:2::0/128", "139.92.14.0/32"],
            family4=AF_INET(networks=('139.91.14.0/24', ), ),
            family6=AF_INET6(networks=('BABE:1:0020:2::0/64', ), ))
        client2b = self.add_config_router(
            'client2b', ["BABE:1:0020:2::1/128", "139.91.14.1/32"],
            family4=AF_INET(networks=('139.91.14.0/24', ), ),
            family6=AF_INET6(networks=('BABE:1:0020:2::0/64', ), ))
        client3 = self.add_config_router(
            'client3', ["BABE:1:0020:3::0/128", "139.91.13.0/32"],
            family4=AF_INET(networks=('139.93.15.0/24', ), ),
            family6=AF_INET6(networks=('BABE:1:0020:3::0/64', ), ))
        client3b = self.add_config_router(
            'client3b', ["BABE:1:0020:3::1/128", "139.93.13.1/32"],
            family4=AF_INET(networks=('139.91.13.0/24', ), ),
            family6=AF_INET6(networks=('BABE:1:0020:3::0/64', ), ))
        # -----------------------------------------------------------------------------------------------------
        # anycast Routers  BABE:1:00YM: =  Y = 3 -> for anycast / 139.1.10
        # -----------------------------------------------------------------------------------------------------
        lo4_anycast = "193.1.10.0/32"
        lo6_anycast = "BABE:1:0030::0/128"
        lo_anycast_addresses = (lo6_anycast, lo4_anycast)
        family4_anycast = "193.1.10.0/24"
        family6_anycast = "BABE:1:0030::0/64"

        anycast1 = self.add_config_router(
            'anycast1',
            lo_anycast_addresses,
            family4=AF_INET(networks=(family4_anycast, ), ),
            family6=AF_INET6(networks=(family6_anycast, ), ))
        anycast2 = self.add_config_router(
            'anycast2',
            lo_anycast_addresses,
            family4=AF_INET(networks=(family4_anycast, ), ),
            family6=AF_INET6(networks=(family6_anycast, ), ))
        anycast3 = self.add_config_router(
            'anycast3',
            lo_anycast_addresses,
            family4=AF_INET(networks=(family4_anycast, ), ),
            family6=AF_INET6(networks=(family6_anycast, ), ))
        anycast4 = self.add_config_router(
            'anycast4',
            lo_anycast_addresses,
            family4=AF_INET(networks=(family4_anycast, ), ),
            family6=AF_INET6(networks=(family6_anycast, ), ))

        # -----------------------------------------------------------------------------------------------------
        # Add Links
        # -----------------------------------------------------------------------------------------------------
        sin_r5_link_anycast1 = self.addLink(sin_r5, anycast1, igp_metric=2)
        sin_r5_link_anycast1['sin_r5'].addParams(ip=('139.4.99.1/30',
                                                     'BABE:4:99::1/64'))
        sin_r5_link_anycast1['anycast1'].addParams(ip=('139.4.99.2/30',
                                                       'BABE:4:99::2/64'))

        sin_r6_link_anycast2 = self.addLink(sin_r6, anycast2, igp_metric=2)
        sin_r6_link_anycast2['sin_r6'].addParams(ip=('139.5.99.1/30',
                                                     'BABE:5:99::1/64'))
        sin_r6_link_anycast2['anycast2'].addParams(ip=('139.5.99.2/30',
                                                       'BABE:5:99::2/64'))

        syd_bb1_link_anycast3 = self.addLink(syd_bb1, anycast3, igp_metric=2)
        syd_bb1_link_anycast3['syd_bb1'].addParams(ip=('139.8.99.1/30',
                                                       'BABE:8:99::1/64'))
        syd_bb1_link_anycast3['anycast3'].addParams(ip=('139.8.99.2/30',
                                                        'BABE:8:99::2/64'))

        syd_bb2_link_anycast4 = self.addLink(syd_bb2, anycast4, igp_metric=2)
        syd_bb2_link_anycast4['syd_bb2'].addParams(ip=('139.9.99.1/30',
                                                       'BABE:9:99::1/64'))
        syd_bb2_link_anycast4['anycast4'].addParams(ip=('139.9.99.2/30',
                                                        'BABE:9:99::2/64'))

        sin_r3_link_syd_r3 = self.addLink(sin_r3,
                                          syd_r3,
                                          igp_metric=2,
                                          password=OSPF_PW_OVH)
        sin_r3_link_syd_r3['sin_r3'].addParams(ip=('139.0.6.1/30',
                                                   'BABE:0:6::1/64'))
        sin_r3_link_syd_r3['syd_r3'].addParams(ip=('139.0.6.2/30',
                                                   'BABE:0:6::2/64'))

        sin_r1_link_syd_bb1 = self.addLink(sin_r1,
                                           syd_bb1,
                                           igp_metric=2,
                                           password=OSPF_PW_OVH)
        sin_r1_link_syd_bb1['sin_r1'].addParams(ip=('139.2.8.1/30',
                                                    'BABE:2:8::1/64'))
        sin_r1_link_syd_bb1['syd_bb1'].addParams(ip=('139.2.8.2/30',
                                                     'BABE:2:8::2/64'))

        sin_r1_link_mrs = self.addLink(sin_r1,
                                       mrs,
                                       igp_metric=2,
                                       password=OSPF_PW_OVH)
        sin_r1_link_mrs['sin_r1'].addParams(ip=('139.2.12.1/30',
                                                'BABE:2:12::1/64'))
        sin_r1_link_mrs['mrs'].addParams(ip=('139.2.12.2/30',
                                             'BABE:2:12::2/64'))

        sin_r2_link_syd_bb2 = self.addLink(sin_r2,
                                           syd_bb2,
                                           igp_metric=2,
                                           password=OSPF_PW_OVH)
        sin_r2_link_syd_bb2['sin_r2'].addParams(ip=('139.3.9.1/30',
                                                    'BABE:3:9::1/64'))
        sin_r2_link_syd_bb2['syd_bb2'].addParams(ip=('139.3.9.2/30',
                                                     'BABE:3:9::2/64'))

        sin_r2_link_sjo = self.addLink(sin_r2,
                                       sjo,
                                       igp_metric=2,
                                       password=OSPF_PW_OVH)
        sin_r2_link_sjo['sin_r2'].addParams(ip=('139.3.13.1/30',
                                                'BABE:3:13::1/64'))
        sin_r2_link_sjo['sjo'].addParams(ip=('139.3.13.2/30',
                                             'BABE:3:13::2/64'))

        sin_r2_link_mrs = self.addLink(sin_r2,
                                       mrs,
                                       igp_metric=2,
                                       password=OSPF_PW_OVH)
        sin_r2_link_mrs['sin_r2'].addParams(ip=('139.3.12.1/30',
                                                'BABE:3:12::1/64'))
        sin_r2_link_mrs['mrs'].addParams(ip=('139.3.12.2/30',
                                             'BABE:3:12::2/64'))

        syd_bb2_link_lax = self.addLink(syd_bb2,
                                        lax,
                                        igp_metric=2,
                                        password=OSPF_PW_OVH)
        syd_bb2_link_lax['syd_bb2'].addParams(ip=('139.9.14.1/30',
                                                  'BABE:9:14::1/64'))
        syd_bb2_link_lax['lax'].addParams(ip=('139.9.14.2/30',
                                              'BABE:9:14::2/64'))

        sin_r3_link_sin_r1 = self.addLink(sin_r3,
                                          sin_r1,
                                          igp_metric=2,
                                          password=OSPF_PW_OVH)
        sin_r3_link_sin_r1['sin_r3'].addParams(ip=('139.0.2.1/30',
                                                   'BABE:0:2::1/64'))
        sin_r3_link_sin_r1['sin_r1'].addParams(ip=('139.0.2.2/30',
                                                   'BABE:0:2::2/64'))

        sin_r3_link_sin_r4 = self.addLink(sin_r3,
                                          sin_r4,
                                          igp_metric=2,
                                          password=OSPF_PW_OVH)
        sin_r3_link_sin_r4['sin_r3'].addParams(ip=('139.0.1.1/30',
                                                   'BABE:0:1::1/64'))
        sin_r3_link_sin_r4['sin_r4'].addParams(ip=('139.0.1.2/30',
                                                   'BABE:0:1::2/64'))

        sin_r1_link_sin_r5 = self.addLink(sin_r1,
                                          sin_r5,
                                          igp_metric=2,
                                          password=OSPF_PW_OVH)
        sin_r1_link_sin_r5['sin_r1'].addParams(ip=('139.2.4.1/30',
                                                   'BABE:2:4::1/64'))
        sin_r1_link_sin_r5['sin_r5'].addParams(ip=('139.2.4.2/30',
                                                   'BABE:2:4::2/64'))

        sin_r1_link_sin_r2 = self.addLink(sin_r1,
                                          sin_r2,
                                          igp_metric=2,
                                          password=OSPF_PW_OVH)
        sin_r1_link_sin_r2['sin_r1'].addParams(ip=('139.2.3.1/30',
                                                   'BABE:2:3::1/64'))
        sin_r1_link_sin_r2['sin_r2'].addParams(ip=('139.2.3.2/30',
                                                   'BABE:2:3::2/64'))

        sin_r2_link_sin_r6 = self.addLink(sin_r2,
                                          sin_r6,
                                          igp_metric=2,
                                          password=OSPF_PW_OVH)
        sin_r2_link_sin_r6['sin_r2'].addParams(ip=('139.3.5.1/30',
                                                   'BABE:3:5::1/64'))
        sin_r2_link_sin_r6['sin_r6'].addParams(ip=('139.3.5.2/30',
                                                   'BABE:3:5::2/64'))

        sin_r4_link_sin_r2 = self.addLink(sin_r4,
                                          sin_r2,
                                          igp_metric=2,
                                          password=OSPF_PW_OVH)
        sin_r4_link_sin_r2['sin_r4'].addParams(ip=('139.1.3.1/30',
                                                   'BABE:1:3::1/64'))
        sin_r4_link_sin_r2['sin_r2'].addParams(ip=('139.1.3.2/30',
                                                   'BABE:1:3::2/64'))

        syd_r3_link_syd_bb1 = self.addLink(syd_r3,
                                           syd_bb1,
                                           igp_metric=2,
                                           password=OSPF_PW_OVH)
        syd_r3_link_syd_bb1['syd_r3'].addParams(ip=('139.6.8.1/30',
                                                    'BABE:6:8::1/64'))
        syd_r3_link_syd_bb1['syd_bb1'].addParams(ip=('139.6.8.2/30',
                                                     'BABE:6:8::2/64'))

        syd_r3_link_syd_r4 = self.addLink(syd_r3,
                                          syd_r4,
                                          igp_metric=2,
                                          password=OSPF_PW_OVH)
        syd_r3_link_syd_r4['syd_r3'].addParams(ip=('139.6.7.1/30',
                                                   'BABE:6:7::1/64'))
        syd_r3_link_syd_r4['syd_r4'].addParams(ip=('139.6.7.2/30',
                                                   'BABE:6:7::2/64'))

        syd_r4_link_syd_bb2 = self.addLink(syd_r4,
                                           syd_bb2,
                                           igp_metric=2,
                                           password=OSPF_PW_OVH)
        syd_r4_link_syd_bb2['syd_r4'].addParams(ip=('139.7.9.1/30',
                                                    'BABE:7:9::1/64'))
        syd_r4_link_syd_bb2['syd_bb2'].addParams(ip=('139.7.9.2/30',
                                                     'BABE:7:9::2/64'))

        syd_bb1_link_syd_bb2 = self.addLink(syd_bb1,
                                            syd_bb2,
                                            igp_metric=2,
                                            password=OSPF_PW_OVH)
        syd_bb1_link_syd_bb2['syd_bb1'].addParams(ip=('139.8.9.1/30',
                                                      'BABE:8:9::1/64'))
        syd_bb1_link_syd_bb2['syd_bb2'].addParams(ip=('139.8.9.2/30',
                                                      'BABE:8:9::2/64'))

        syd_bb1_link_syd_r5 = self.addLink(syd_bb1,
                                           syd_r5,
                                           igp_metric=2,
                                           password=OSPF_PW_OVH)
        syd_bb1_link_syd_r5['syd_bb1'].addParams(ip=('139.8.10.1/30',
                                                     'BABE:8:10::1/64'))
        syd_bb1_link_syd_r5['syd_r5'].addParams(ip=('139.8.10.2/30',
                                                    'BABE:8:10::2/64'))

        syd_bb2_link_syd_r6 = self.addLink(syd_bb2,
                                           syd_r6,
                                           igp_metric=2,
                                           password=OSPF_PW_OVH)
        syd_bb2_link_syd_r6['syd_bb2'].addParams(ip=('139.9.11.1/30',
                                                     'BABE:9:11::1/64'))
        syd_bb2_link_syd_r6['syd_r6'].addParams(ip=('139.9.11.2/30',
                                                    'BABE:9:11::2/64'))

        sjo_link_lax = self.addLink(sjo,
                                    lax,
                                    igp_metric=2,
                                    password=OSPF_PW_OVH)
        sjo_link_lax['sjo'].addParams(ip=('139.13.14.1/30',
                                          'BABE:13:14::1/64'))
        sjo_link_lax['lax'].addParams(ip=('139.13.14.2/30',
                                          'BABE:13:14::2/64'))

        sin_eq_link_syd_eq = self.addLink(sin_eq,
                                          syd_eq,
                                          igp_metric=2,
                                          password=OSPF_PW_OVH)
        sin_eq_link_syd_eq['sin_eq'].addParams(ip=('139.16.17.1/30',
                                                   'BABE:16:17::1/64'))
        sin_eq_link_syd_eq['syd_eq'].addParams(ip=('139.16.17.2/30',
                                                   'BABE:16:17::2/64'))

        sin_r5_link_sin_eq = self.addLink(sin_r5, sin_eq, igp_metric=2)
        sin_r5_link_sin_eq['sin_r5'].addParams(ip=('139.4.16.1/30',
                                                   'BABE:4:16::1/64'))
        sin_r5_link_sin_eq['sin_eq'].addParams(ip=('139.4.16.2/30',
                                                   'BABE:4:16::2/64'))

        syd_bb2_link_syd_eq = self.addLink(syd_bb2, syd_eq, igp_metric=2)
        syd_bb2_link_syd_eq['syd_bb2'].addParams(ip=('139.9.17.1/30',
                                                     'BABE:9:17::1/64'))
        syd_bb2_link_syd_eq['syd_eq'].addParams(ip=('139.9.17.2/30',
                                                    'BABE:9:17::2/64'))

        sin_ntt_link_syd_ntt1 = self.addLink(sin_ntt, syd_ntt1, igp_metric=2)
        sin_ntt_link_syd_ntt1['sin_ntt'].addParams(ip=('139.32.33.1/30',
                                                       'BABE:32:33::1/64'))
        sin_ntt_link_syd_ntt1['syd_ntt1'].addParams(ip=('139.32.33.2/30',
                                                        'BABE:32:33::2/64'))

        sin_ntt_link_syd_ntt2 = self.addLink(sin_ntt, syd_ntt2, igp_metric=2)
        sin_ntt_link_syd_ntt2['sin_ntt'].addParams(ip=('139.32.34.1/30',
                                                       'BABE:32:34::1/64'))
        sin_ntt_link_syd_ntt2['syd_ntt2'].addParams(ip=('139.32.34.2/30',
                                                        'BABE:32:34::2/64'))

        syd_ntt1_link_syd_ntt2 = self.addLink(syd_ntt1, syd_ntt2, igp_metric=2)
        syd_ntt1_link_syd_ntt2['syd_ntt1'].addParams(ip=('139.33.34.1/30',
                                                         'BABE:33:34::1/64'))
        syd_ntt1_link_syd_ntt2['syd_ntt2'].addParams(ip=('139.33.34.2/30',
                                                         'BABE:33:34::2/64'))

        sin_r5_link_sin_ntt = self.addLink(sin_r5, sin_ntt, igp_metric=2)
        sin_r5_link_sin_ntt['sin_r5'].addParams(ip=('139.4.32.1/30',
                                                    'BABE:4:32::1/64'))
        sin_r5_link_sin_ntt['sin_ntt'].addParams(ip=('139.4.32.2/30',
                                                     'BABE:4:32::2/64'))

        syd_bb1_link_syd_ntt1 = self.addLink(syd_bb1, syd_ntt1, igp_metric=2)
        syd_bb1_link_syd_ntt1['syd_bb1'].addParams(ip=('139.8.33.1/30',
                                                       'BABE:8:33::1/64'))
        syd_bb1_link_syd_ntt1['syd_ntt1'].addParams(ip=('139.8.33.2/30',
                                                        'BABE:8:33::2/64'))

        syd_bb2_link_syd_ntt2 = self.addLink(syd_bb2, syd_ntt2, igp_metric=2)
        syd_bb2_link_syd_ntt2['syd_bb2'].addParams(ip=('139.9.34.1/30',
                                                       'BABE:9:34::1/64'))
        syd_bb2_link_syd_ntt2['syd_ntt2'].addParams(ip=('139.9.34.2/30',
                                                        'BABE:9:34::2/64'))

        sin_tel_link_syd_tel1 = self.addLink(sin_tel, syd_tel1, igp_metric=2)
        sin_tel_link_syd_tel1['sin_tel'].addParams(ip=('139.48.49.1/30',
                                                       'BABE:48:49::1/64'))
        sin_tel_link_syd_tel1['syd_tel1'].addParams(ip=('139.48.49.2/30',
                                                        'BABE:48:49::2/64'))

        sin_tel_link_syd_tel2 = self.addLink(sin_tel, syd_tel2, igp_metric=2)
        sin_tel_link_syd_tel2['sin_tel'].addParams(ip=('139.48.50.1/30',
                                                       'BABE:48:50::1/64'))
        sin_tel_link_syd_tel2['syd_tel2'].addParams(ip=('139.48.50.2/30',
                                                        'BABE:48:50::2/64'))

        syd_tel1_link_syd_tel2 = self.addLink(syd_tel1, syd_tel2, igp_metric=2)
        syd_tel1_link_syd_tel2['syd_tel1'].addParams(ip=('139.49.50.1/30',
                                                         'BABE:49:50::1/64'))
        syd_tel1_link_syd_tel2['syd_tel2'].addParams(ip=('139.49.50.2/30',
                                                         'BABE:49:50::2/64'))

        sin_r6_link_sin_tel = self.addLink(sin_r6, sin_tel, igp_metric=2)
        sin_r6_link_sin_tel['sin_r6'].addParams(ip=('139.5.48.1/30',
                                                    'BABE:5:48::1/64'))
        sin_r6_link_sin_tel['sin_tel'].addParams(ip=('139.5.48.2/30',
                                                     'BABE:5:48::2/64'))

        syd_bb1_link_syd_tel1 = self.addLink(syd_bb1, syd_tel1, igp_metric=2)
        syd_bb1_link_syd_tel1['syd_bb1'].addParams(ip=('139.8.49.1/30',
                                                       'BABE:8:49::1/64'))
        syd_bb1_link_syd_tel1['syd_tel1'].addParams(ip=('139.8.49.2/30',
                                                        'BABE:8:49::2/64'))

        syd_bb2_link_syd_tel2 = self.addLink(syd_bb2, syd_tel2, igp_metric=2)
        syd_bb2_link_syd_tel2['syd_bb2'].addParams(ip=('139.9.50.1/30',
                                                       'BABE:9:50::1/64'))
        syd_bb2_link_syd_tel2['syd_tel2'].addParams(ip=('139.9.50.2/30',
                                                        'BABE:9:50::2/64'))

        client1_link_client1b = self.addLink(client1, client1b, igp_metric=2)
        client1_link_client1b['client1'].addParams(ip=('139.96.96.1/30',
                                                       'BABE:96:96::1/64'))
        client1_link_client1b['client1b'].addParams(ip=('139.96.96.2/30',
                                                        'BABE:96:96::2/64'))

        sin_r5_link_client1 = self.addLink(sin_r5, client1, igp_metric=2)
        sin_r5_link_client1['sin_r5'].addParams(ip=('139.4.96.1/30',
                                                    'BABE:4:96:1::1/64'))
        sin_r5_link_client1['client1'].addParams(ip=('139.4.96.2/30',
                                                     'BABE:4:96:1::2/64'))

        sin_r5_link_client1b = self.addLink(sin_r5, client1b, igp_metric=2)
        sin_r5_link_client1b['sin_r5'].addParams(ip=('139.4.96.3/30',
                                                     'BABE:4:96:2::1/64'))
        sin_r5_link_client1b['client1b'].addParams(ip=('139.4.96.4/30',
                                                       'BABE:4:96:2::2/64'))

        client2_link_client2b = self.addLink(client2, client2b, igp_metric=2)
        client2_link_client2b['client2'].addParams(ip=('139.97.97.1/30',
                                                       'BABE:97:97::1/64'))
        client2_link_client2b['client2b'].addParams(ip=('139.97.97.2/30',
                                                        'BABE:97:97::2/64'))

        syd_bb1_link_client2 = self.addLink(syd_bb1, client2, igp_metric=2)
        syd_bb1_link_client2['syd_bb1'].addParams(ip=('139.8.97.1/30',
                                                      'BABE:8:97:1::1/64'))
        syd_bb1_link_client2['client2'].addParams(ip=('139.8.97.2/30',
                                                      'BABE:8:97:1::2/64'))

        syd_bb1_link_client2p = self.addLink(syd_bb1, client2b, igp_metric=2)
        syd_bb1_link_client2p['syd_bb1'].addParams(ip=('139.8.97.3/30',
                                                       'BABE:8:97:2::1/64'))
        syd_bb1_link_client2p['client2b'].addParams(ip=('139.8.97.4/30',
                                                        'BABE:8:97:2::2/64'))

        client3_link_client3b = self.addLink(client3, client3b, igp_metric=2)
        client3_link_client3b['client3'].addParams(ip=('139.98.98.1/30',
                                                       'BABE:98:98::1/64'))
        client3_link_client3b['client3b'].addParams(ip=('139.98.98.2/30',
                                                        'BABE:98:98::2/64'))

        syd_bb2_link_client3 = self.addLink(syd_bb2, client3, igp_metric=2)
        syd_bb2_link_client3['syd_bb2'].addParams(ip=('139.9.98.1/30',
                                                      'BABE:9:98:1::1/64'))
        syd_bb2_link_client3['client3'].addParams(ip=('139.9.98.2/30',
                                                      'BABE:9:98:1::2/64'))

        syd_bb2_link_client3b = self.addLink(syd_bb2, client3b, igp_metric=2)
        syd_bb2_link_client3b['syd_bb2'].addParams(ip=('139.9.98.3/30',
                                                       'BABE:9:98:2::1/64'))
        syd_bb2_link_client3b['client3b'].addParams(ip=('139.9.98.4/30',
                                                        'BABE:9:98:2::2/64'))
        # -----------------------------------------------------------------------------------------------------
        # Add Hosts
        # -----------------------------------------------------------------------------------------------------
        # Singapore hosts
        sin_h1 = self.addHost("sin_h1")
        sin_h2 = self.addHost("sin_h2")
        sin_h3 = self.addHost("sin_h3")
        sin_h4 = self.addHost("sin_h4")
        sin_h5 = self.addHost("sin_h5")
        sin_h6 = self.addHost("sin_h6")
        # Australia Hosts
        syd_h1 = self.addHost("syd_h1")
        syd_h2 = self.addHost("syd_h2")
        syd_h3 = self.addHost("syd_h3")
        syd_h4 = self.addHost("syd_h4")
        syd_h5 = self.addHost("syd_h5")
        syd_h6 = self.addHost("syd_h6")
        #
        mrs_h = self.addHost("mrs_h")
        sjo_h = self.addHost("sjo_h")
        lax_h = self.addHost("lax_h")
        # Equinix
        syd_eq_h = self.addHost("syd_eq_h")
        sin_eq_h = self.addHost("sin_eq_h")
        # NTT
        syd_ntt1_h = self.addHost("syd_ntt1_h")
        syd_ntt2_h = self.addHost("syd_ntt2_h")
        sin_ntt_h = self.addHost("sin_ntt_h")
        # Telstra
        syd_tel1_h = self.addHost("syd_tel1_h")
        syd_tel2_h = self.addHost("syd_tel2_h")
        sin_tel_h = self.addHost("sin_tel_h")
        # Clients
        client_h1 = self.addHost("client_h1")
        client_h2 = self.addHost("client_h2")
        client_h3 = self.addHost("client_h3")
        # -----------------------------------------------------------------------------------------------------
        # Add links to Hosts
        # -----------------------------------------------------------------------------------------------------
        self.addLinks(
            (sin_r3, sin_h1), (sin_r4, sin_h2), (sin_r1, sin_h3),
            (sin_r2, sin_h4), (sin_r5, sin_h5), (sin_r6, sin_h6),
            (syd_r3, syd_h1), (syd_r4, syd_h2), (syd_bb1, syd_h3),
            (syd_bb2, syd_h4), (syd_r5, syd_h5), (syd_r6, syd_h6),
            (mrs, mrs_h), (lax, lax_h), (sjo, sjo_h), (sin_eq, sin_eq_h),
            (syd_eq, syd_eq_h), (sin_ntt, sin_ntt_h), (syd_ntt2, syd_ntt2_h),
            (syd_ntt1, syd_ntt1_h), (syd_tel1, syd_tel1_h),
            (syd_tel2, syd_tel2_h), (sin_tel, sin_tel_h), (client1, client_h1),
            (client2, client_h2), (client3, client_h3))
        # -----------------------------------------------------------------------------------------------------
        # Add Subnets to Hosts
        # -----------------------------------------------------------------------------------------------------
        # Singapore hosts
        self.addSubnet((sin_r3, sin_h1),
                       subnets=('139.99.0.24/30', 'BABE:1:0000::8/126'))
        self.addSubnet((sin_r4, sin_h2),
                       subnets=('139.99.0.28/30', 'BABE:1:0000::1C/126'))
        self.addSubnet((sin_r1, sin_h3),
                       subnets=('139.99.0.32/30', 'BABE:1:0000::18/126'))
        self.addSubnet((sin_r2, sin_h4),
                       subnets=('139.99.0.36/30', 'BABE:1:0000::2C/126'))
        self.addSubnet((sin_r5, sin_h5),
                       subnets=('139.99.0.40/30', 'BABE:1:0000::3C/126'))
        self.addSubnet((sin_r6, sin_h6),
                       subnets=('139.99.0.44/30', 'BABE:1:0000::30/126'))
        # Australia Hosts
        self.addSubnet((syd_r3, syd_h1),
                       subnets=('139.99.0.48/30', 'BABE:1:0001::8/126'))
        self.addSubnet((syd_r4, syd_h2),
                       subnets=('139.99.0.52/30', 'BABE:1:0001::1C/126'))
        self.addSubnet((syd_bb1, syd_h3),
                       subnets=('139.99.0.56/30', 'BABE:1:0001::2C/126'))
        self.addSubnet((syd_bb2, syd_h4),
                       subnets=('139.99.0.60/30', 'BABE:1:0001::3C/126'))
        self.addSubnet((syd_r5, syd_h5),
                       subnets=('139.99.0.64/30', 'BABE:1:0001::30/126'))
        self.addSubnet((syd_r6, syd_h6),
                       subnets=('139.99.0.68/30', 'BABE:1:0001::34/126'))
        #
        self.addSubnet((mrs, mrs_h),
                       subnets=('139.95.0.24/30', 'BABE:1:0002::4/126'))
        self.addSubnet((sjo, sjo_h),
                       subnets=('139.94.0.28/30', 'BABE:1:0003::4/126'))
        self.addSubnet((lax, lax_h),
                       subnets=('139.94.0.44/30', 'BABE:1:0003::8/126'))
        # Equinix
        self.addSubnet((sin_eq, sin_eq_h),
                       subnets=('139.96.0.36/30', 'BABE:1:0007::1C/126'))
        self.addSubnet((syd_eq, syd_eq_h),
                       subnets=('139.96.0.44/30', 'BABE:1:0007::3C/126'))
        # NTT
        self.addSubnet((sin_ntt, sin_ntt_h),
                       subnets=('139.97.0.48/30', 'BABE:1:0006::1C/126'))
        self.addSubnet((syd_ntt2, syd_ntt2_h),
                       subnets=('139.97.0.24/30', 'BABE:1:0006::8/126'))
        self.addSubnet((syd_ntt1, syd_ntt1_h),
                       subnets=('139.97.0.28/30', 'BABE:1:0006::10/126'))
        # Telstra
        self.addSubnet((syd_tel1, syd_tel1_h),
                       subnets=('139.98.0.36/30', 'BABE:1:0005::1C/126'))
        self.addSubnet((syd_tel2, syd_tel2_h),
                       subnets=('139.98.0.32/30', 'BABE:1:0005::8/126'))
        self.addSubnet((sin_tel, sin_tel_h),
                       subnets=('139.98.0.44/30', 'BABE:1:0005::10/126'))
        # Clients
        self.addSubnet((client1, client_h1),
                       subnets=('139.1.15.24/30', 'BABE:1:0020:1::4/126'))
        self.addSubnet((client2, client_h2),
                       subnets=('139.1.14.28/30', 'BABE:1:0020:2::8/126'))
        self.addSubnet((client3, client_h3),
                       subnets=('139.1.13.32/30', 'BABE:1:0020:3::10/126'))

        # In the same AS
        self.addAS(16276,
                   routers=(sin_r3, sin_r4, sin_r1, sin_r2, sin_r5, sin_r6,
                            syd_r3, syd_r4, syd_bb1, syd_bb2, syd_r5, syd_r6,
                            mrs, sjo, lax, anycast1, anycast2, anycast3,
                            anycast4))

        # RR iBGP sessions
        set_rr(self,
               rr=sin_r1,
               peers=[
                   syd_r3, syd_r4, sin_r4, sin_r3, sin_r2, sin_r5, sin_r6, mrs,
                   sjo, anycast1, anycast2
               ])
        set_rr(self,
               rr=sin_r2,
               peers=[
                   syd_r3, syd_r4, sin_r3, sin_r1, sin_r4, sin_r5, sin_r6, mrs,
                   sjo, anycast1, anycast2
               ])
        set_rr(self,
               rr=syd_r5,
               peers=[
                   sin_r3, sin_r4, syd_r4, syd_bb1, syd_bb2, syd_r3, syd_r6,
                   lax, anycast3, anycast4
               ])
        set_rr(self,
               rr=syd_r4,
               peers=[
                   sin_r3, sin_r4, syd_r3, syd_bb1, syd_bb2, syd_r5, syd_r6,
                   lax, anycast3, anycast4
               ])

        self.addiBGPFullMesh(1616, (syd_eq, sin_eq))

        self.addiBGPFullMesh(2914, (syd_ntt1, syd_ntt2, sin_ntt))

        self.addiBGPFullMesh(4637, (syd_tel1, syd_tel2, sin_tel))
        self.addiBGPFullMesh(1, (client1, client1b))
        self.addiBGPFullMesh(2, (client2, client2b))
        self.addiBGPFullMesh(3, (client3, client3b))

        # eBGP sessions

        # Share cost sessions
        ebgp_session(self, sin_r5, sin_eq)
        ebgp_session(self, syd_bb2, syd_eq)

        # Provider sessions
        ebgp_session(self, syd_bb1, syd_ntt1)
        ebgp_session(self, syd_bb2, syd_ntt2)
        ebgp_session(self, sin_r5, sin_ntt)
        ebgp_session(self, sin_r6, sin_tel)
        ebgp_session(self, syd_bb1, syd_tel1)
        ebgp_session(self, syd_bb2, syd_tel2)

        # Clients sessions
        ebgp_session(self, client1, sin_r5)
        ebgp_session(self, client2, syd_bb1)
        ebgp_session(self, client3, syd_bb2)
        ebgp_session(self, client1b, sin_r5)
        ebgp_session(self, client2b, syd_bb1)
        ebgp_session(self, client3b, syd_bb2)

        # Send communities from neighbors

        all_al = AccessList('all', ('any', ))

        blackhole = AccessList('blackhole', ('BABE:1f01::0/64', ))

        # Client1 customer link
        client1.get_config(BGP).set_community('16276:120',
                                              to_peer=sin_r5,
                                              matching=(all_al, ))
        # Client1 customer backup link
        client1b.get_config(BGP).set_community('16276:115',
                                               to_peer=sin_r5,
                                               matching=(all_al, ))

        # Client1 blackholed prefix
        client1.get_config(BGP).set_community('16276:666',
                                              to_peer=sin_r5,
                                              matching=(blackhole, ))
        client1b.get_config(BGP).set_community('16276:666',
                                               to_peer=sin_r5,
                                               matching=(blackhole, ))

        # Client2 customer link
        client2.get_config(BGP).set_community('16276:120',
                                              to_peer=syd_bb1,
                                              matching=(all_al, ))
        # Client2 customer backup link
        client2b.get_config(BGP).set_community('16276:115',
                                               to_peer=syd_bb1,
                                               matching=(all_al, ))

        # Client3 customer link
        client3.get_config(BGP).set_community('16276:120',
                                              to_peer=syd_bb2,
                                              matching=(all_al, ))
        # Client3 customer backup link
        client3b.get_config(BGP).set_community('16276:115',
                                               to_peer=syd_bb2,
                                               matching=(all_al, ))

        # set MED for providers/peer that have several eBGP connection to OVH to differentiate them:
        # favor traffic with higher MED
        # equinix
        sin_eq.get_config(BGP).set_med(1, to_peer=sin_r5)
        syd_eq.get_config(BGP).set_med(4, to_peer=syd_bb1)
        # NTT
        sin_ntt.get_config(BGP).set_med(1, to_peer=sin_r5)
        syd_ntt1.get_config(BGP).set_med(1, to_peer=syd_bb1)
        syd_ntt2.get_config(BGP).set_med(4, to_peer=syd_bb2)
        # Telstra
        sin_tel.get_config(BGP).set_med(1, to_peer=sin_r6)
        syd_tel1.get_config(BGP).set_med(4, to_peer=syd_bb1)
        syd_tel2.get_config(BGP).set_med(1, to_peer=syd_bb2)

        # firewall table
        syd_bb1.addDaemon(IP6Tables, rules=ip6_rules)
        syd_bb2.addDaemon(IP6Tables, rules=ip6_rules)
        sin_r5.addDaemon(IP6Tables, rules=ip6_rules)
        sin_r6.addDaemon(IP6Tables, rules=ip6_rules)

        # Declare a new DNS Zone

        server4_addr = "10.11.12.13"
        server6_addr = "cafe::"
        domain = "ovh.com"

        server = self.addHost("server")
        self.addLink(sin_r1, server)

        records = [
            ARecord(server, server4_addr, ttl=120),
            AAAARecord(server, server6_addr, ttl=120)
        ]
        self.addDNSZone(name=domain,
                        dns_master=anycast3,
                        dns_slaves=[anycast1, anycast2, anycast4],
                        nodes=[server],
                        records=records)

        ptr_records = [
            PTRRecord(server4_addr, server + f".{domain}", ttl=120),
            PTRRecord(server6_addr, server + f".{domain}", ttl=120)
        ]
        reverse_domain_name_v4 = ip_address(server4_addr).reverse_pointer[-10:]
        reverse_domain_name_v6 = ip_address(server6_addr).reverse_pointer[-10:]
        self.addDNSZone(name=reverse_domain_name_v4,
                        dns_master=anycast3,
                        dns_slaves=[anycast1, anycast2, anycast4],
                        records=ptr_records,
                        ns_domain_name=domain,
                        retry_time=8200)
        self.addDNSZone(name=reverse_domain_name_v6,
                        dns_master=anycast3,
                        dns_slaves=[anycast1, anycast2, anycast4],
                        records=ptr_records,
                        ns_domain_name=domain,
                        retry_time=8200)

        super().build(*args, **kwargs)