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)
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
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)
def detach(self, interface): if self.up: utils.check_cmd([ constants.OVS_BIN, "del-port", self.bridge_name, interface.localname ]) PyCoreNet.detach(self, interface)
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)
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)
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)
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 = {}
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)
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)
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)
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)
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)
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)
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)
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)
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()
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)
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)
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()
def detach(self, netif): PyCoreNet.detach(self, netif)
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)
def detach(self, interface): if self.up: utils.check_cmd([constants.OVS_BIN, "del-port", self.bridge_name, interface.localname]) PyCoreNet.detach(self, interface)
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:
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 = {}
def detach(self, netif): if self.up: pass PyCoreNet.detach(self, netif)