コード例 #1
0
ファイル: overlay_link.py プロジェクト: catalyst/l3overlay
    def start(self):
        '''
        Start the static overlay link.
        '''

        self.logger.info("starting static overlay link '%s'" % self.name)

        # Start the network namespace object for the linked overlay.
        self.inner_netns.start()

        # Create the inner and outer veth interfaces, which link the
        # overlays together. At the same time, move the inner veth
        # interface to the inner overlay.
        outer_if = veth.create(
            self.dry_run,
            self.logger,
            self.outer_name,
            self.inner_name,
            netns = self.netns,
        )

        inner_if = outer_if.peer_get(peer_netns=self.inner_netns)
        inner_if.netns_set(self.inner_netns)

        # Create a dummy interface for the outer veth interface to be
        # bridged with.
        dummy_if = dummy.create(
            self.dry_run,
            self.logger,
            self.dummy_name,
            netns = self.netns,
        )

        # Create the bridge interface for the dummy interface and the
        # veth pair interface, and add the bridge ports.
        bridge_if = bridge.create(
            self.dry_run,
            self.logger,
            self.bridge_name,
            netns = self.netns,
        )
        bridge_if.add_port(outer_if)
        bridge_if.add_port(dummy_if)

        # Assign address to the interfaces.
        bridge_if.add_ip(self.outer_address, self.netmask)
        inner_if.add_ip(self.inner_address, self.netmask)

        # Bring up both the inner and outer interfaces, and their
        # linking interfaces.
        outer_if.up()
        inner_if.up()
        dummy_if.up()
        bridge_if.up()

        # Stop the network namespace object for the linked overlay,
        # to remove its process from memory.
        self.inner_netns.stop()

        self.logger.info("finished starting static overlay link '%s'" % self.name)
コード例 #2
0
ファイル: dummy.py プロジェクト: catalyst/l3overlay
    def start(self):
        '''
        Start the static dummy.
        '''

        self.logger.info("starting static dummy '%s'" % self.name)

        dummy_if = dummy.create(
            self.dry_run,
            self.logger,
            self.dummy_name,
            netns = self.netns,
        )
        dummy_if.add_ip(self.address, self.netmask)
        dummy_if.up()

        self.logger.info("finished starting static dummy '%s'" % self.name)