Ejemplo n.º 1
0
    def __init__(self, node):
        NdnApplication.__init__(self, node)

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

        self.confFile = "%s/%s.conf" % (node.homeFolder, node.name)
        self.logFile = "%s/%s.log" % (node.homeFolder, node.name)
        self.sockFile = "/var/run/%s.sock" % node.name
        self.ndnFolder = "%s/.ndn" % node.homeFolder
        self.clientConf = "%s/client.conf" % self.ndnFolder

        # Copy nfd.conf file from /usr/local/etc/mini-ndn to the node's home
        node.cmd("sudo cp /usr/local/etc/mini-ndn/nfd.conf %s" % self.confFile)

        # Set log level
        node.cmd("sudo sed -i \'s|$LOG_LEVEL|%s|g\' %s" % (self.logLevel, self.confFile))

        # Open the conf file and change socket file name
        node.cmd("sudo sed -i 's|nfd.sock|%s.sock|g' %s" % (node.name, self.confFile))

        # Make NDN folder
        node.cmd("sudo mkdir %s" % self.ndnFolder)

        # Copy the client.conf file and change the unix socket
        node.cmd("sudo cp /usr/local/etc/mini-ndn/client.conf.sample %s" % self.clientConf)
        node.cmd("sudo sed -i 's|nfd.sock|%s.sock|g' %s" % (node.name, self.clientConf))

        # Change home folder
        node.cmd("export HOME=%s" % node.homeFolder)
Ejemplo n.º 2
0
    def __init__(self, node):
        NdnApplication.__init__(self, node)

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

        self.confFile = "%s/%s.conf" % (node.homeFolder, node.name)
        self.logFile = "%s/%s.log" % (node.homeFolder, node.name)
        self.sockFile = "/var/run/%s.sock" % node.name
        self.ndnFolder = "%s/.ndn" % node.homeFolder
        self.clientConf = "%s/client.conf" % self.ndnFolder

        # Copy nfd.conf file from /usr/local/etc/mini-ndn to the node's home
        node.cmd("sudo cp /usr/local/etc/mini-ndn/nfd.conf %s" % self.confFile)

        # Set log level
        node.cmd("sudo sed -i \'s|$LOG_LEVEL|%s|g\' %s" %
                 (self.logLevel, self.confFile))

        # Open the conf file and change socket file name
        node.cmd("sudo sed -i 's|nfd.sock|%s.sock|g' %s" %
                 (node.name, self.confFile))

        # Make NDN folder
        node.cmd("sudo mkdir %s" % self.ndnFolder)

        # Copy the client.conf file and change the unix socket
        node.cmd("sudo cp /usr/local/etc/mini-ndn/client.conf.sample %s" %
                 self.clientConf)
        node.cmd("sudo sed -i 's|nfd.sock|%s.sock|g' %s" %
                 (node.name, self.clientConf))

        # Change home folder
        node.cmd("export HOME=%s" % node.homeFolder)
Ejemplo n.º 3
0
    def __init__(self, node):
        NdnApplication.__init__(self, node)
        self.routerName = "/%sC1.Router/cs/%s" % ('%', node.name)
        self.confFile = "%s/nlsr.conf" % node.homeFolder

        # Make directory for log file
        self.logDir = "%s/log" % node.homeFolder
        node.cmd("mkdir %s" % self.logDir)
Ejemplo n.º 4
0
    def __init__(self, node, options):
        NdnApplication.__init__(self, node)
        self.config = NlsrConfigGenerator(node, options)

        self.node = node
        self.routerName = "/{}C1.Router/cs/{}".format('%', node.name)
        self.confFile = "{}/nlsr.conf".format(node.homeFolder)

        # Make directory for log file
        self.logDir = "{}/log".format(node.homeFolder)
        self.node.cmd("mkdir {}".format(self.logDir))
Ejemplo n.º 5
0
    def __init__(self, node):
        NdnApplication.__init__(self, node)
        self.routerName = "/%sC1.Router/cs/%s" % ('%', node.name)
        self.confFile = "%s/nlsr.conf" % node.homeFolder

        # Make directory for log file
        self.logDir = "%s/log" % node.homeFolder
        node.cmd("mkdir %s" % self.logDir)

        # Configure basic router information in nlsr.conf based on host name
        node.cmd("sudo sed -i 's|router .*|router %s|g' %s" % (self.routerName, self.confFile))
        node.cmd("sudo sed -i 's|log-dir .*|log-dir %s|g' %s" % (self.logDir, self.confFile))
        node.cmd("sudo sed -i 's|seq-dir .*|seq-dir %s|g' %s" % (self.logDir, self.confFile))
        node.cmd("sudo sed -i 's|prefix .*netlab|prefix /ndn/edu/%s|g' %s" % (node.name, self.confFile))
Ejemplo n.º 6
0
    def __init__(self, node, neighbors, faceType):
        NdnApplication.__init__(self, node)
        self.node = node
        self.neighbors = neighbors
        self.faceType = faceType
        self.routerName = "/%sC1.Router/cs/%s" % ('%', node.name)
        self.confFile = "%s/nlsr.conf" % node.homeFolder

        # Make directory for log file
        self.logDir = "{}/log".format(node.homeFolder)
        self.node.cmd("mkdir {}".format(self.logDir))

        # Create faces in NFD
        self.createFaces()
Ejemplo n.º 7
0
    def __init__(self, node, csSize):
        NdnApplication.__init__(self, node)

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

        self.confFile = "{}/nfd.conf".format(node.homeFolder)
        self.logFile = "{}/nfd.log".format(node.homeFolder)
        self.sockFile = "/var/run/{}.sock".format(node.name)
        self.ndnFolder = "{}/.ndn".format(node.homeFolder)
        self.clientConf = "{}/client.conf".format(self.ndnFolder)

        # Copy nfd.conf file from /usr/local/etc/ndn to the node's home

        # Use nfd.conf as default configuration for NFD, else use the sample
        if os.path.isfile("/usr/local/etc/ndn/nfd.conf") == True:
            node.cmd("sudo cp /usr/local/etc/ndn/nfd.conf {}".format(
                self.confFile))
        elif os.path.isfile("/usr/local/etc/ndn/nfd.conf.sample") == True:
            node.cmd("sudo cp /usr/local/etc/ndn/nfd.conf.sample {}".format(
                self.confFile))
        else:
            sys.exit(
                "nfd.conf or nfd.conf.sample cannot be found in the expected directory. Exit."
            )

        # 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 /var/run/{}.sock".
                 format(self.confFile, node.name))

        # Set CS size
        node.cmd("infoedit -f {} -s tables.cs_max_packets -v {}".format(
            self.confFile, csSize))

        # Make NDN folder
        node.cmd("sudo mkdir {}".format(self.ndnFolder))

        # Copy the client.conf file and change the unix socket
        node.cmd("sudo cp /usr/local/etc/ndn/client.conf.sample {}".format(
            self.clientConf))

        node.cmd("sudo sed -i 's|nfd.sock|{}.sock|g' {}".format(
            node.name, self.clientConf))

        # Change home folder
        node.cmd("export HOME={}".format(node.homeFolder))
        node.cmd("ndnsec-keygen /localhost/operator | ndnsec-install-cert -")
Ejemplo n.º 8
0
    def __init__(self, node, csSize):
        NdnApplication.__init__(self, node)

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

        self.confFile = "{}/nfd.conf".format(node.homeFolder)
        self.logFile = "{}/nfd.log".format(node.homeFolder)
        self.sockFile = "/var/run/{}.sock".format(node.name)
        self.ndnFolder = "{}/.ndn".format(node.homeFolder)
        self.clientConf = "{}/client.conf".format(self.ndnFolder)

        # Copy nfd.conf file from /usr/local/etc/ndn or /etc/ndn to the node's home directory
        # Use nfd.conf as default configuration for NFD, else use the sample
        possibleConfPaths = [
            "/usr/local/etc/ndn/nfd.conf.sample",
            "/usr/local/etc/ndn/nfd.conf", "/etc/ndn/nfd.conf.sample",
            "/etc/ndn/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 /var/run/{}.sock".
                 format(self.confFile, node.name))

        # Set CS size
        node.cmd("infoedit -f {} -s tables.cs_max_packets -v {}".format(
            self.confFile, csSize))

        # Make NDN folder
        node.cmd("sudo mkdir {}".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|nfd.sock|{}.sock|g' {}".format(
            node.name, self.clientConf))

        # Change home folder
        node.cmd("export HOME={}".format(node.homeFolder))
        node.cmd("ndnsec-keygen /localhost/operator | ndnsec-install-cert -")
Ejemplo n.º 9
0
    def __init__(self, node):
        NdnApplication.__init__(self, node)
        self.routerName = "/%sC1.Router/cs/%s" % ('%', node.name)
        self.confFile = "%s/nlsr.conf" % node.homeFolder

        # Make directory for log file
        self.logDir = "%s/log" % node.homeFolder
        node.cmd("mkdir %s" % self.logDir)

        # Configure basic router information in nlsr.conf based on host name
        node.cmd("sudo sed -i 's|router .*|router %s|g' %s" %
                 (self.routerName, self.confFile))
        node.cmd("sudo sed -i 's|log-dir .*|log-dir %s|g' %s" %
                 (self.logDir, self.confFile))
        node.cmd("sudo sed -i 's|seq-dir .*|seq-dir %s|g' %s" %
                 (self.logDir, self.confFile))
        node.cmd("sudo sed -i 's|prefix .*netlab|prefix /ndn/edu/%s|g' %s" %
                 (node.name, self.confFile))