def build(self, *args, **kwargs):
        """
        the network

        h1 -- ra ---- rb ---- re -- h2
              |       |       |
              + ----- rc ---- +

        """

        #Routes
        ra_routes = [
            StaticRoute("::/0", "2001:2345:4::c"),
            StaticRoute("2001:2345:2::/47", "2001:2345:7::b")
        ]

        rb_routes = [
            StaticRoute("2001:2345:0::/47", "2001:2345:7::a"),
            StaticRoute("2001:2345:0::/46", "2001:2345:6::e")
        ]

        rc_routes = [
            StaticRoute("2001:2345:0::/46", "2001:2345:7::a"),
            StaticRoute("2001:2345:2::/47", "2001:2345:3::e")
        ]

        re_routes = [StaticRoute("2001:2345:0::/40", "2001:2345:3::c")]

        #Routers
        ra = self.addRouter_v6('ra', ra_routes)
        rb = self.addRouter_v6('rb', rb_routes)
        rc = self.addRouter_v6('rc', rc_routes)
        re = self.addRouter_v6('re', re_routes)

        #Links
        self.addLink(ra,
                     rb,
                     params1={"ip": "2001:2345:7::a/64"},
                     params2={"ip": "2001:2345:7::b/64"})
        self.addLink(ra,
                     rc,
                     params1={"ip": "2001:2345:4::a/64"},
                     params2={"ip": "2001:2345:4::c/64"})
        self.addLink(rb,
                     rc,
                     params1={"ip": "2001:2345:5::b/64"},
                     params2={"ip": "2001:2345:5::c/64"})
        self.addLink(rb,
                     re,
                     params1={"ip": "2001:2345:6::b/64"},
                     params2={"ip": "2001:2345:6::e/64"})
        self.addLink(rc,
                     re,
                     params1={"ip": "2001:2345:3::c/64"},
                     params2={"ip": "2001:2345:3::e/64"})

        self.addLink(ra,
                     self.addHost('h1'),
                     params1={"ip": "2001:2345:1::a/64"},
                     params2={"ip": "2001:2345:1::1/64"})
        self.addLink(re,
                     self.addHost('h2'),
                     params1={"ip": "2001:2345:2::e/64"},
                     params2={"ip": "2001:2345:2::2/64"})
Beispiel #2
0
    def build(self, *args, **kwargs):
        """
        """

        #Routes
        ra_routes = [
            StaticRoute("2001:2345:4::/46", "2001:2345:4::c"),
            StaticRoute("2001:2345:2::/47", "2001:2345:7::b")
        ]

        rb_routes = [
            StaticRoute("2001:2345:0::/44", "2001:2345:7::a"),
            StaticRoute("2001:2345:4::/46", "2001:2345:5::c"),
            StaticRoute("2001:2345:3::/48", "2001:2345:5::c"),
            StaticRoute("2001:2345:2::/47", "2001:2345:6::e")
        ]

        rc_routes = [
            StaticRoute("2001:2345:0::/47", "2001:2345:4::a"),
            StaticRoute("2001:2345:6::/47", "2001:2345:5::b"),
            StaticRoute("2001:2345:2::/47", "2001:2345:3::e")
        ]

        re_routes = [
            StaticRoute("2001:2345:0::/40", "2001:2345:6::b"),
            StaticRoute("2001:2345:5::/48", "2001:2345:3::c")
        ]

        #Routers
        ra = self.addRouter_v6('ra', ra_routes)
        rb = self.addRouter_v6('rb', rb_routes)
        rc = self.addRouter_v6('rc', rc_routes)
        re = self.addRouter_v6('re', re_routes)

        #Links
        self.addLink(ra,
                     rb,
                     params1={"ip": "2001:2345:7::a/64"},
                     params2={"ip": "2001:2345:7::b/64"})
        self.addLink(ra,
                     rc,
                     params1={"ip": "2001:2345:4::a/64"},
                     params2={"ip": "2001:2345:4::c/64"})
        self.addLink(rb,
                     rc,
                     params1={"ip": "2001:2345:5::b/64"},
                     params2={"ip": "2001:2345:5::c/64"})
        self.addLink(rb,
                     re,
                     params1={"ip": "2001:2345:6::b/64"},
                     params2={"ip": "2001:2345:6::e/64"})
        self.addLink(rc,
                     re,
                     params1={"ip": "2001:2345:3::c/64"},
                     params2={"ip": "2001:2345:3::e/64"})

        self.addLink(ra,
                     self.addHost('h1'),
                     params1={"ip": "2001:2345:1::a/64"},
                     params2={"ip": "2001:2345:1::1/64"})
        self.addLink(re,
                     self.addHost('h2'),
                     params1={"ip": "2001:2345:2::e/64"},
                     params2={"ip": "2001:2345:2::2/64"})
        super(SimpleTopo, self).build(*args, **kwargs)