コード例 #1
0
    def __init__(self,
                 session,
                 objid=None,
                 name=None,
                 start=True,
                 policy=None):
        """
        Creates an OvsNet instance.

        :param core.session.Session session: session this object is a part of
        :param objid:
        :param name:
        :param start:
        :param policy:
        :return:
        """

        PyCoreNet.__init__(self, session, objid, name, start)

        if policy:
            self.policy = policy
        else:
            self.policy = self.__class__.policy

        session_id = self.session.short_session_id()
        self.bridge_name = "b.%s.%s" % (str(self.objid), session_id)
        self.up = False

        if start:
            self.startup()
            ebtables_queue.startupdateloop(self)
コード例 #2
0
ファイル: nodes.py プロジェクト: michaeljbailey/core
 def __init__(self, session, objid=None, name=None, start=True):
     PyCoreNet.__init__(self, session, objid, name, start)
     self.conf = ""
     self.up = False
     self.nemidmap = {}
     self.model = None
     self.mobility = None
コード例 #3
0
ファイル: nodes.py プロジェクト: gsomlo/core
 def __init__(self, session, objid=None, name=None, start=True):
     PyCoreNet.__init__(self, session, objid, name, start)
     self.conf = ""
     self.up = False
     self.nemidmap = {}
     self.model = None
     self.mobility = None
コード例 #4
0
ファイル: vnet.py プロジェクト: yrs1/core
    def __init__(self,
                 session,
                 objid=None,
                 name=None,
                 start=True,
                 policy=None):
        """
        Creates a LxBrNet instance.

        :param core.session.Session session: core session instance
        :param int objid: object id
        :param str name: object name
        :param bool start: start flag
        :param policy: network policy
        """
        PyCoreNet.__init__(self, session, objid, name, start)
        if name is None:
            name = str(self.objid)
        if policy is not None:
            self.policy = policy
        self.name = name
        sessionid = self.session.short_session_id()
        self.brname = "b.%s.%s" % (str(self.objid), sessionid)
        self.up = False
        if start:
            self.startup()
            ebq.startupdateloop(self)
コード例 #5
0
ファイル: openvswitch.py プロジェクト: gsomlo/core
    def __init__(self, session, objid=None, name=None, start=True, policy=None):
        """
        Creates an OvsNet instance.

        :param core.session.Session session: session this object is a part of
        :param objid:
        :param name:
        :param start:
        :param policy:
        :return:
        """

        PyCoreNet.__init__(self, session, objid, name, start)

        if policy:
            self.policy = policy
        else:
            self.policy = self.__class__.policy

        session_id = self.session.short_session_id()
        self.bridge_name = "b.%s.%s" % (str(self.objid), session_id)
        self.up = False

        if start:
            self.startup()
            ebtables_queue.startupdateloop(self)
コード例 #6
0
    def detach(self, interface):
        if self.up:
            utils.check_cmd([
                constants.OVS_BIN, "del-port", self.bridge_name,
                interface.localname
            ])

        PyCoreNet.detach(self, interface)
コード例 #7
0
ファイル: openvswitch.py プロジェクト: michaeljbailey/core
    def detach(self, interface):
        if self.up:
            try:
                subprocess.check_call([constants.OVS_BIN, "del-port", self.bridge_name, interface.localname])
            except subprocess.CalledProcessError:
                logger.exception("error removing interface %s from bridge %s", interface.localname, self.bridge_name)
                return

        PyCoreNet.detach(self, interface)
コード例 #8
0
ファイル: vnet.py プロジェクト: Benocs/core
 def detach(self, netif):
     if self.up:
         try:
             check_call([BRCTL_BIN, "delif", self.brname, netif.localname])
         except Exception as 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)
コード例 #9
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)
コード例 #10
0
 def __init__(self,
              session,
              objid=None,
              name=None,
              start=True,
              policy=None):
     PyCoreNet.__init__(self, session, objid, name)
     self.tapbridge = ns.tap_bridge.TapBridgeHelper()
     self._ns3devs = {}
     self._tapdevs = {}
コード例 #11
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)
コード例 #12
0
    def detach(self, netif):
        """
        Detach a network interface.

        :param core.netns.vif.Veth netif: network interface to detach
        :return: nothing
        """
        if self.up:
            utils.check_cmd([constants.BRCTL_BIN, "delif", self.brname, netif.localname])

        PyCoreNet.detach(self, netif)
コード例 #13
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)
コード例 #14
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)
コード例 #15
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)
コード例 #16
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)
コード例 #17
0
ファイル: vnet.py プロジェクト: Benocs/core
 def __init__(self, session, objid = None, name = None, verbose = False,
                     start = True, policy = None):
     PyCoreNet.__init__(self, session, objid, name, verbose, start)
     if name is None:
         name = str(self.objid)
     if policy is not None:
         self.policy = policy
     self.name = name
     self.brname = "b.%s.%s" % (str(self.objid), self.session.sessionid)
     self.up = False
     if start:
         self.startup()
         ebq.startupdateloop(self)
コード例 #18
0
 def __init__(self, session, objid = None, name = None, verbose = False,
                     start = True, policy = None):
     PyCoreNet.__init__(self, session, objid, name, verbose, start)
     if name is None:
         name = str(self.objid)
     if policy is not None:
         self.policy = policy
     self.name = name
     sessionid = self.session.shortsessionid()
     self.brname = "b.%s.%s" % (str(self.objid), sessionid)
     self.up = False
     if start:
         self.startup()
         ebq.startupdateloop(self)
コード例 #19
0
ファイル: vnet.py プロジェクト: 22beer1bif/core
 def __init__(self, session, objid = None, name = None, verbose = False,
                     start = True, policy = None):
     PyCoreNet.__init__(self, session, objid, name)
     if name is None:
         name = str(self.objid)
     if policy is not None:
         self.policy = policy
     self.name = name
     self.ngname = "n_%s_%s" % (str(self.objid), self.session.sessionid)
     self.ngid = None
     self.verbose = verbose
     self._netif = {}
     self._linked = {}
     self.up = False
     if start:
         self.startup()
コード例 #20
0
    def detach(self, netif):
        """
        Detach a network interface.

        :param core.netns.vif.Veth netif: network interface to detach
        :return: nothing
        """
        if self.up:
            try:
                subprocess.check_call([
                    constants.BRCTL_BIN, "delif", self.brname, netif.localname
                ])
            except subprocess.CalledProcessError:
                logger.exception("Error removing interface %s from bridge %s",
                                 netif.localname, self.brname)
                return
        PyCoreNet.detach(self, netif)
コード例 #21
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)
コード例 #22
0
ファイル: vnet.py プロジェクト: michaeljbailey/core
 def __init__(self,
              session,
              objid=None,
              name=None,
              start=True,
              policy=None):
     PyCoreNet.__init__(self, session, objid, name)
     if name is None:
         name = str(self.objid)
     if policy is not None:
         self.policy = policy
     self.name = name
     self.ngname = "n_%s_%s" % (str(self.objid), self.session.session_id)
     self.ngid = None
     self._netif = {}
     self._linked = {}
     self.up = False
     if start:
         self.startup()
コード例 #23
0
ファイル: vnet.py プロジェクト: gsomlo/core
    def __init__(self, session, objid=None, name=None, start=True, policy=None):
        """
        Creates a LxBrNet instance.

        :param core.session.Session session: core session instance
        :param int objid: object id
        :param str name: object name
        :param bool start: start flag
        :param policy: network policy
        """
        PyCoreNet.__init__(self, session, objid, name, start)
        if name is None:
            name = str(self.objid)
        if policy is not None:
            self.policy = policy
        self.name = name
        sessionid = self.session.short_session_id()
        self.brname = "b.%s.%s" % (str(self.objid), sessionid)
        self.up = False
        if start:
            self.startup()
            ebq.startupdateloop(self)
コード例 #24
0
ファイル: vnet.py プロジェクト: michaeljbailey/core
 def detach(self, netif):
     PyCoreNet.detach(self, netif)
コード例 #25
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)
コード例 #26
0
ファイル: openvswitch.py プロジェクト: gsomlo/core
    def detach(self, interface):
        if self.up:
            utils.check_cmd([constants.OVS_BIN, "del-port", self.bridge_name, interface.localname])

        PyCoreNet.detach(self, interface)
コード例 #27
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:
コード例 #28
0
ファイル: obj.py プロジェクト: 22beer1bif/core
 def __init__(self, session, objid = None, name = None, verbose = False, 
                     start = True, policy = None):
     PyCoreNet.__init__(self, session, objid, name)
     self.tapbridge = ns.tap_bridge.TapBridgeHelper()
     self._ns3devs = {}
     self._tapdevs = {}
コード例 #29
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:
コード例 #30
0
ファイル: vnet.py プロジェクト: 22beer1bif/core
 def detach(self, netif):
     if self.up:
         pass
     PyCoreNet.detach(self, netif)
コード例 #31
0
 def detach(self, netif):
     if self.up:
         pass
     PyCoreNet.detach(self, netif)