コード例 #1
0
ファイル: openvswitch.py プロジェクト: michaeljbailey/core
    def attach(self, interface):
        if self.up:
            try:
                subprocess.check_call([constants.OVS_BIN, "add-port", self.bridge_name, interface.localname])
                subprocess.check_call([constants.IP_BIN, "link", "set", interface.localname, "up"])
            except subprocess.CalledProcessError:
                logger.exception("error joining interface %s to bridge %s", interface.localname, self.bridge_name)
                return

        PyCoreNet.attach(self, interface)
コード例 #2
0
    def attach(self, interface):
        if self.up:
            utils.check_cmd([
                constants.OVS_BIN, "add-port", self.bridge_name,
                interface.localname
            ])
            utils.check_cmd(
                [constants.IP_BIN, "link", "set", interface.localname, "up"])

        PyCoreNet.attach(self, interface)
コード例 #3
0
ファイル: vnet.py プロジェクト: Benocs/core
 def attach(self, netif):
     if self.up:
         try:
             check_call([BRCTL_BIN, "addif", self.brname, netif.localname])
             check_call([IP_BIN, "link", "set", netif.localname, "up"])
         except Exception as e:
             self.exception(coreapi.CORE_EXCP_LEVEL_ERROR, self.brname,
                            "Error joining interface %s to bridge %s: %s" % \
                            (netif.localname, self.brname, e))
             return
     PyCoreNet.attach(self, netif)
コード例 #4
0
ファイル: vnet.py プロジェクト: michaeljbailey/core
 def attach(self, netif):
     """
     Attach an interface to this netgraph node. Create a pipe between
     the interface and the hub/switch/wlan node.
     (Note that the PtpNet subclass overrides this method.)
     """
     if self.up:
         pipe = self.session.addobj(cls=NetgraphPipeNet, start=True)
         pipe.attach(netif)
         hook = "link%d" % len(self._netif)
         pipe.attachnet(self, hook)
     PyCoreNet.attach(self, netif)
コード例 #5
0
ファイル: vnet.py プロジェクト: 22beer1bif/core
 def attach(self, netif):
     ''' Attach an interface to this netgraph node. Create a pipe between
         the interface and the hub/switch/wlan node.
         (Note that the PtpNet subclass overrides this method.)
     '''
     if self.up:
         pipe = self.session.addobj(cls = NetgraphPipeNet,
                             verbose = self.verbose, start = True)
         pipe.attach(netif)
         hook = "link%d" % len(self._netif)
         pipe.attachnet(self, hook)
     PyCoreNet.attach(self, netif)
コード例 #6
0
    def attach(self, netif):
        """
        Attach a network interface.

        :param core.netns.vnode.VEth netif: network interface to attach
        :return: nothing
        """
        if self.up:
            utils.check_cmd([constants.BRCTL_BIN, "addif", self.brname, netif.localname])
            utils.check_cmd([constants.IP_BIN, "link", "set", netif.localname, "up"])

        PyCoreNet.attach(self, netif)
コード例 #7
0
    def attach(self, netif):
        """
        Attach a network interface.

        :param core.netns.vif.VEth netif: network interface to attach
        :return: nothing
        """
        if self.up:
            try:
                subprocess.check_call([
                    constants.BRCTL_BIN, "addif", self.brname, netif.localname
                ])
                subprocess.check_call(
                    [constants.IP_BIN, "link", "set", netif.localname, "up"])
            except subprocess.CalledProcessError:
                logger.exception("Error joining interface %s to bridge %s",
                                 netif.localname, self.brname)
                return
        PyCoreNet.attach(self, netif)
コード例 #8
0
ファイル: vnet.py プロジェクト: sarmentots/os-core-network
        self._netif.clear()
        self._linked.clear()
        del self.session
        self.up = False

    def attach(self, netif):
        if self.up:
            try:
                check_call([BRCTL_BIN, "addif", self.brname, netif.localname])
                check_call([IP_BIN, "link", "set", netif.localname, "up"])
            except Exception, e:
                self.exception(coreapi.CORE_EXCP_LEVEL_ERROR, self.brname,
                               "Error joining interface %s to bridge %s: %s" % \
                               (netif.localname, self.brname, e))
                return
        PyCoreNet.attach(self, netif)

    def detach(self, netif):
        if self.up:
            try:
                check_call([BRCTL_BIN, "delif", self.brname, netif.localname])
            except Exception, e:
                self.exception(coreapi.CORE_EXCP_LEVEL_ERROR, self.brname,
                               "Error removing interface %s from bridge %s: %s" % \
                               (netif.localname, self.brname, e))
                return
        PyCoreNet.detach(self, netif)

    def linked(self, netif1, netif2):
        # check if the network interfaces are attached to this network
        if self._netif[netif1.netifi] != netif1:
コード例 #9
0
ファイル: vnet.py プロジェクト: tohojo/core
        self._netif.clear()
        self._linked.clear()
        del self.session
        self.up = False

    def attach(self, netif):
        if self.up:
            try:
                check_call([BRCTL_BIN, "addif", self.brname, netif.localname])
                check_call([IP_BIN, "link", "set", netif.localname, "up"])
            except Exception, e:
                self.exception(coreapi.CORE_EXCP_LEVEL_ERROR, self.brname,
                               "Error joining interface %s to bridge %s: %s" % \
                               (netif.localname, self.brname, e))
                return
        PyCoreNet.attach(self, netif)

    def detach(self, netif):
        if self.up:
            try:
                check_call([BRCTL_BIN, "delif", self.brname, netif.localname])
            except Exception, e:
                self.exception(coreapi.CORE_EXCP_LEVEL_ERROR, self.brname,
                               "Error removing interface %s from bridge %s: %s" % \
                               (netif.localname, self.brname, e))
                return
        PyCoreNet.detach(self, netif)

    def linked(self, netif1, netif2):
        # check if the network interfaces are attached to this network
        if self._netif[netif1.netifi] != netif1:
コード例 #10
0
ファイル: openvswitch.py プロジェクト: gsomlo/core
    def attach(self, interface):
        if self.up:
            utils.check_cmd([constants.OVS_BIN, "add-port", self.bridge_name, interface.localname])
            utils.check_cmd([constants.IP_BIN, "link", "set", interface.localname, "up"])

        PyCoreNet.attach(self, interface)