Exemple #1
0
    def __init__(self,
                 node,
                 logLevel='NONE',
                 csSize=65536,
                 csPolicy='lru',
                 csUnsolicitedPolicy='drop-all'):
        Application.__init__(self, node)

        self.logLevel = node.params['params'].get('nfd-log-level', logLevel)

        self.confFile = '{}/mw-nfd.conf'.format(self.homeDir)
        self.logFile = 'mw-nfd.log'
        self.sockFile = '/run/{}.sock'.format(node.name)
        self.ndnFolder = '{}/.ndn'.format(self.homeDir)
        self.clientConf = '{}/client.conf'.format(self.ndnFolder)

        # Copy mw-nfd.conf file from /usr/local/etc/ndn or /etc/ndn to the node's home directory
        # Use mw-nfd.conf as default configuration for MW-NFD, else use the sample
        possibleConfPaths = [
            '/usr/local/etc/ndn/mw-nfd.conf.sample',
            '/usr/local/mw-etc/ndn/nfd.conf', '/etc/ndn/mw-nfd.conf.sample',
            '/etc/ndn/mw-nfd.conf'
        ]
        copyExistentFile(node, possibleConfPaths, self.confFile)

        # Set log level
        node.cmd('infoedit -f {} -s log.default_level -v {}'.format(
            self.confFile, self.logLevel))
        # Open the conf file and change socket file name
        node.cmd('infoedit -f {} -s face_system.unix.path -v {}'.format(
            self.confFile, self.sockFile))

        # Set CS parameters
        node.cmd('infoedit -f {} -s tables.cs_max_packets -v {}'.format(
            self.confFile, csSize))
        node.cmd('infoedit -f {} -s tables.cs_policy -v {}'.format(
            self.confFile, csPolicy))
        node.cmd('infoedit -f {} -s tables.cs_unsolicited_policy -v {}'.format(
            self.confFile, csUnsolicitedPolicy))

        # Make NDN folder
        node.cmd('mkdir -p {}'.format(self.ndnFolder))

        # Copy client configuration to host
        possibleClientConfPaths = [
            '/usr/local/etc/ndn/client.conf.sample',
            '/etc/ndn/client.conf.sample'
        ]
        copyExistentFile(node, possibleClientConfPaths, self.clientConf)

        # Change the unix socket
        node.cmd('sudo sed -i "s|;transport|transport|g" {}'.format(
            self.clientConf))
        node.cmd('sudo sed -i "s|nfd.sock|{}.sock|g" {}'.format(
            node.name, self.clientConf))

        if not Minindn.ndnSecurityDisabled:
            # Generate key and install cert for /localhost/operator to be used by MW-NFD
            node.cmd(
                'ndnsec-keygen /localhost/operator | ndnsec-install-cert -')
Exemple #2
0
    def __init__(
            self,
            node,
            responsibility,
            logLevel='NONE',
            logFolder="./logs/",
            treeSize=65536,
            traceFile="trace.csv",
            chunkThreshold=200,
            levelDifference=2,
            srcDir="/home/phmoll/Coding/SyncProtocols/QuadTreeSyncEvaluation/"
    ):
        Application.__init__(self, node)

        self.logLevel = node.params['params'].get('nfd-log-level', logLevel)
        self.logFolder = logFolder
        self.traceFile = traceFile
        self.treeSize = treeSize
        self.chunkThreshold = chunkThreshold
        self.levelDifference = levelDifference
        self.srcDir = srcDir

        self.responsibility = responsibility

        # create logfolder folder
        node.cmd('mkdir -p {}'.format(self.logFolder))
Exemple #3
0
 def start(self):
     info(self.node.name + " = " +
          pformat(self.environments[self.node.name]) + "\n")
     Application.start(self,
                       'nfd --config %s' % self.confFile,
                       logfile=self.logFile,
                       envDict=self.environments[self.node.name])
     MyMinindn.sleep(minindn.helpers.nfdc.SLEEP_TIME)
Exemple #4
0
    def __init__(self, node, logFolder="./", singleLogFile=False):
        """
        :param logFolder Folder, where PCAP files are stored.
        :param singleLogFile Single PCAP file per node, or individual PCAP for each interface
        """

        Application.__init__(self, node)

        self.logFolder = logFolder
        self.singleLogFile = singleLogFile

        # Create logfile folder in case it does not exist
        node.cmd('mkdir -p {}'.format(self.logFolder))
Exemple #5
0
    def __init__(self, node, logLevel='NONE', security=False, sync=SYNC_PSYNC,
                 faceType='udp', nFaces=3, routingType=ROUTING_LINK_STATE):
        Application.__init__(self, node)

        self.network = '/ndn/'
        self.node = node
        self.parameters = self.node.params['params']

        if self.parameters.get('nlsr-log-level', None) != None:
            logLevel = self.parameters.get('nlsr-log-level')

        if logLevel in ['NONE', 'WARN', 'INFO', 'DEBUG', 'TRACE']:
            self.envDict = {'NDN_LOG': 'nlsr.*={}'.format(logLevel)}
        else:
            self.envDict = {'NDN_LOG': logLevel}

        self.logFile = 'nlsr.log'
        self.routerName = '/{}C1.Router/cs/{}'.format('%', node.name)
        self.confFile = '{}/nlsr.conf'.format(self.homeDir)
        self.security = security
        self.sync = sync
        self.faceType = faceType
        self.infocmd = 'infoedit -f nlsr.conf'

        self.parameters = self.node.params['params']

        self.nFaces = nFaces
        if routingType == Nlsr.ROUTING_HYPERBOLIC:
            self.hyperbolicState = 'on'
        elif routingType == Nlsr.ROUTING_DRY_RUN:
            self.hyperbolicState = 'dry-run'
        else:
            self.hyperbolicState = 'off'
        self.hyperRadius = self.parameters.get('radius', 0.0)
        self.hyperAngle = self.parameters.get('angle', 0.0)

        if ((self.hyperbolicState == 'on' or self.hyperbolicState == 'dry-run') and
            (self.hyperRadius == 0.0 or self.hyperAngle == 0.0)):
            warn('Hyperbolic coordinates in topology file are either missing or misconfigured.')
            warn('Check that each node has one radius value and one or two angle value(s).')
            sys.exit(1)

        self.neighborIPs = []
        possibleConfPaths = ['/usr/local/etc/ndn/nlsr.conf.sample', '/etc/ndn/nlsr.conf.sample']
        copyExistentFile(node, possibleConfPaths, '{}/nlsr.conf'.format(self.homeDir))

        self.createConfigFile()

        if security and not Minindn.ndnSecurityDisabled:
            self.createKeysAndCertificates()
Exemple #6
0
    def __init__(self,
                 node,
                 responsibility,
                 clientId,
                 logLevel='NONE',
                 logFolder="./logs/",
                 otherPeers=[],
                 serverPort=5000,
                 traceFile="trace.csv",
                 srcDir="/home/phmoll/Coding/SyncProtocols/ZMQSyncPeer/"):
        Application.__init__(self, node)

        self.logLevel = node.params['params'].get('nfd-log-level', logLevel)
        self.logFolder = logFolder
        self.traceFile = traceFile
        self.srcDir = srcDir
        self.clientId = clientId
        self.otherPeers = otherPeers
        self.serverPort = serverPort

        self.responsibility = responsibility

        # create logfolder folder
        node.cmd('mkdir -p {}'.format(self.logFolder))
Exemple #7
0
 def start(self):
     Application.start(self,
                       'mw-nfd --config {}'.format(self.confFile),
                       logfile=self.logFile)
     Minindn.sleep(2)
Exemple #8
0
 def start(self):
     self.createFaces()
     Application.start(self, 'nlsr -f {}'.format(self.confFile), self.logFile, self.envDict)
     Minindn.sleep(1)
Exemple #9
0
    def __init__(self,
                 node,
                 fwThreads=8,
                 logLevel='INFO',
                 csSize=65536,
                 csPolicy='lru'):
        Application.__init__(self, node)

        self.logLevel = node.params['params'].get('nfd-log-level', logLevel)

        self.confFile = '{}/yanfd.toml'.format(self.homeDir)
        self.logFile = 'yanfd.log'
        self.sockFile = '/run/{}.sock'.format(node.name)
        self.ndnFolder = '{}/.ndn'.format(self.homeDir)
        self.clientConf = '{}/client.conf'.format(self.ndnFolder)

        # Copy yanfd.toml file from /usr/local/etc/ndn or /etc/ndn to the node's home directory
        # Use yanfd.toml as default configuration for YaNFD, else use the sample
        possibleConfPaths = [
            '/usr/local/etc/ndn/yanfd.toml', '/etc/ndn/yanfd.toml'
        ]
        copyExistentFile(node, possibleConfPaths, self.confFile)

        # Load TOML config
        config = toml.load(self.confFile)

        # Set number of forwarding threads
        config["fw"]["threads"] = fwThreads

        # Set log level
        config["core"]["log_level"] = self.logLevel
        # Open the conf file and change socket file name
        config["faces"]["unix"]["socket_path"] = self.sockFile

        # Set CS parameters
        config["tables"]["content_store"]["capacity"] = csSize
        config["tables"]["content_store"]["replacement_policy"] = csPolicy
        #node.cmd('infoedit -f {} -s tables.cs_unsolicited_policy -v {}'.format(self.confFile, csUnsolicitedPolicy))

        # Save TOML config
        configOut = open(self.confFile, 'w')
        toml.dump(config, configOut)
        configOut.close()

        # Make NDN folder
        node.cmd('mkdir -p {}'.format(self.ndnFolder))

        # Copy client configuration to host
        possibleClientConfPaths = [
            '/usr/local/etc/ndn/client.conf.sample',
            '/etc/ndn/client.conf.sample'
        ]
        copyExistentFile(node, possibleClientConfPaths, self.clientConf)

        # Change the unix socket
        node.cmd('sudo sed -i "s|;transport|transport|g" {}'.format(
            self.clientConf))
        node.cmd('sudo sed -i "s|nfd.sock|{}.sock|g" {}'.format(
            node.name, self.clientConf))

        if not Minindn.ndnSecurityDisabled:
            # Generate key and install cert for /localhost/operator to be used by NFD
            node.cmd(
                'ndnsec-keygen /localhost/operator | ndnsec-install-cert -')