예제 #1
0
    def __init__(self, api=None):
        if not api:
            api = plcapi.PLCAPI()
        self._api = api

        # Attributes
        self.address = None
        self.netprefix = None
        self.netmask = None

        self.up = None
        self.mtu = None
        self.snat = False
        self.txqueuelen = 1000
        self.pointopoint = None
        self.multicast = False
        self.bwlimit = None

        # Enabled traces
        self.capture = False

        # These get initialized when the iface is connected to its node
        self.node = None

        # These get initialized when the iface is connected to any filter
        self.filter_module = None
        self.multicast_forwarder = None

        # These get initialized when the iface is configured
        self.external_iface = None

        # These get initialized when the iface is configured
        # They're part of the TUN standard attribute set
        self.tun_port = None
        self.tun_addr = None
        self.tun_cipher = "AES"

        # These get initialized when the iface is connected to its peer
        self.peer_iface = None
        self.peer_proto = None
        self.peer_addr = None
        self.peer_port = None
        self.peer_proto_impl = None
        self._delay_recover = False

        # same as peer proto, but for execute-time standard attribute lookups
        self.tun_proto = None

        # Generate an initial random cryptographic key to use for tunnelling
        # Upon connection, both endpoints will agree on a common one based on
        # this one.
        self.tun_key = (''.join(
            map(chr, [
                r.getrandbits(8) for i in xrange(32)
                for r in (random.SystemRandom(), )
            ])).encode("base64").strip())
예제 #2
0
    def __init__(self, api=None, sliceapi=None):
        if not api:
            api = plcapi.PLCAPI()
        self._api = api
        self._sliceapi = sliceapi or api

        # Attributes
        self.hostname = None
        self.architecture = None
        self.operatingSystem = None
        self.pl_distro = None
        self.site = None
        self.city = None
        self.country = None
        self.region = None
        self.minReliability = None
        self.maxReliability = None
        self.minBandwidth = None
        self.maxBandwidth = None
        self.minCpu = None
        self.maxCpu = None
        self.minLoad = None
        self.maxLoad = None
        self.min_num_external_ifaces = None
        self.max_num_external_ifaces = None
        self._timeframe = 'w'

        # Applications and routes add requirements to connected nodes
        self.required_packages = set()
        self.required_vsys = set()
        self.pythonpath = []
        self.rpmFusion = False
        self.env = collections.defaultdict(list)

        # Some special applications - initialized when connected
        self.multicast_forwarder = None

        # Testbed-derived attributes
        self.slicename = None
        self.ident_path = None
        self.server_key = None
        self.home_path = None
        self.enable_proc_cleanup = False
        self.enable_home_cleanup = False

        # Those are filled when an actual node is allocated
        self._node_id = None
        self._yum_dependencies = None
        self._installed = False

        # Logging
        self._logger = logging.getLogger('nepi.testbeds.planetlab')
예제 #3
0
    def __init__(self, api=None):
        if not api:
            api = plcapi.PLCAPI()
        self._api = api

        # Attributes
        self.command = None
        self.sudo = False

        self.build = None
        self.install = None
        self.depends = None
        self.buildDepends = None
        self.sources = None
        self.rpmFusion = False
        self.env = {}

        self.stdin = None
        self.stdout = None
        self.stderr = None
        self.buildlog = None

        self.add_to_path = True

        # Those are filled when the app is configured
        self.home_path = None

        # Those are filled when an actual node is connected
        self.node = None

        # Those are filled when the app is started
        #   Having both pid and ppid makes it harder
        #   for pid rollover to induce tracking mistakes
        self._started = False
        self._setup = False
        self._setuper = None
        self._pid = None
        self._ppid = None

        # Spanning tree deployment
        self._master = None
        self._master_passphrase = None
        self._master_prk = None
        self._master_puk = None
        self._master_token = os.urandom(8).encode("hex")
        self._build_pid = None
        self._build_ppid = None

        # Logging
        self._logger = logging.getLogger('nepi.testbeds.planetlab')
예제 #4
0
    def __init__(self, api=None):
        if not api:
            api = plcapi.PLCAPI()
        self._api = api

        # Attributes
        self.module = None
        self.args = None

        # These get initialised when the filter is connected
        self.peer_guid = None
        self.peer_proto = None
        self.iface_guid = None
        self.peer = None
        self.iface = None
예제 #5
0
    def __init__(self, api=None):
        if not api:
            api = plcapi.PLCAPI()
        self._api = api

        # Attributes
        self.mode = None
        self.addrList = None
        self.portList = None

        self.plrIn = None
        self.bwIn = None
        self.delayIn = None

        self.plrOut = None
        self.bwOut = None
        self.delayOut = None

        # These get initialized when the pipe is connected to its node
        self.node = None
        self.configured = False
예제 #6
0
    def __init__(self, api=None):
        if not api:
            api = plcapi.PLCAPI()
        self._api = api

        # Attributes
        self.primary = True

        # These get initialized at configuration time
        self.address = None
        self.lladdr = None
        self.netprefix = None
        self.netmask = None
        self.broadcast = True
        self._interface_id = None

        # These get initialized when the iface is connected to its node
        self.node = None

        # These get initialized when the iface is connected to the internet
        self.has_internet = False
예제 #7
0
 def __init__(self, api=None):
     if not api:
         api = plcapi.PLCAPI()
     self._api = api
예제 #8
0
파일: util.py 프로젝트: nfvproject/nepi
def getAPI(user, pass_, **kw):
    import plcapi
    return plcapi.PLCAPI(username=user, password=pass_, **kw)