Example #1
0
    def __init__(self, node, isSecurityEnabled, faceType):
        self.node = node
        self.isSecurityEnabled = isSecurityEnabled
        self.faceType = faceType
        self.infocmd = "infoedit -f nlsr.conf"

        parameters = node.nlsrParameters

        self.nFaces = parameters.get("max-faces-per-prefix", 3)
        self.hyperbolicState = parameters.get("hyperbolic-state", "off")
        self.hyperRadius = parameters.get("radius", 0.0)
        self.hyperAngle = parameters.get("angle", 0.0)
        self.neighborIPs = []
        possibleConfPaths = ["/usr/local/etc/ndn/nlsr.conf.sample", "/etc/ndn/nlsr.conf.sample"]
        copyExistentFile(node, possibleConfPaths, "{}/nlsr.conf".format(self.node.homeFolder))
Example #2
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 -")
Example #3
0
    def __init__(self, node, options):
        self.node = node
        self.isSecurityEnabled = options.nlsrSecurity
        self.faceType = options.faceType
        self.infocmd = "infoedit -f nlsr.conf"

        parameters = node.params["params"]

        self.nFaces = options.nFaces
        if options.routingType == "hr":
            self.hyperbolicState = "on"
        elif options.routingType == "dry":
            self.hyperbolicState = "dry-run"
        else:
            self.hyperbolicState = "off"
        self.hyperRadius = parameters.get("radius", 0.0)
        self.hyperAngle = parameters.get("angle", 0.0)

        if ((self.hyperbolicState == "on" or self.hyperbolicState == "dry-run")
                and (self.hyperRadius == 0.0 or self.hyperAngle == 0.0)):
            info(
                'Hyperbolic coordinates in topology file are either missing or misconfigured.'
            )
            info(
                '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.node.homeFolder))

        self.createConfigFile()