import threading from socket import AF_INET, AF_INET6 from builtins import range from core import CoreCommandError, utils from core import constants from core.emulator.data import NodeData, LinkData from core.emulator.enumerations import NodeTypes, LinkTypes from core.nodes import client, nodeutils, ipaddress from core.nodes.interface import TunTap, CoreInterface from core.nodes.interface import Veth _DEFAULT_MTU = 1500 utils.check_executables([constants.IP_BIN]) class NodeBase(object): """ Base class for CORE nodes (nodes and networks) """ apitype = None # TODO: appears start has no usage, verify and remove def __init__(self, session, _id=None, name=None, start=True): """ Creates a PyCoreObj instance. :param core.emulator.session.Session session: CORE session object :param int _id: id
from core.emulator.enumerations import LinkTypes from core.emulator.enumerations import NodeTypes from core.emulator.enumerations import RegisterTlvs from core.nodes import ipaddress from core.nodes.interface import GreTap from core.nodes.interface import Veth from core.nodes.network import EbtablesQueue from core.nodes.network import GreTapBridge # a global object because all WLANs share the same queue # cannot have multiple threads invoking the ebtables commnd ebtables_queue = EbtablesQueue() ebtables_lock = threading.Lock() utils.check_executables( [constants.IP_BIN, constants.EBTABLES_BIN, constants.TC_BIN]) def ebtables_commands(call, commands): with ebtables_lock: for command in commands: call(command) class OvsNet(CoreNetworkBase): """ Used to be LxBrNet. Base class for providing Openvswitch functionality to objects that create bridges. """