imalse / experiments /


It demos the process of loading a predefined topology file. It only works with
networks that are formed by point to point links.


import settings

from core.ns3.util.topology import ManualTopologyNet
from experiments import TopoExperiment
from util import Namespace
from import cidr_to_subnet_mask

class ManualTopoExperiment(TopoExperiment):
    """In Manual Topo Experiment,  You can specify and ip address for each indexing"""
    def initparser(self, parser):
        TopoExperiment.initparser(self, parser)

        parser.add_option('--net_settings', dest="net_settings",
                help='net settings file',

    def load_net_settings(self):
        s = {}
        execfile(settings.ROOT + '/' + self.options.net_settings, s)
        return Namespace(s)

    def load_exper_settings(self, ns):
        # botnet related configuration
        self.server_id_set = ns.server_id_set
        self.botmaster_id_set = ns.botmaster_id_set
        self.client_id_set = ns.client_id_set       
        self.target_id = ns.target_id
        if len(ns.server_addr) == 0:
            self.SERVER_ADDR = ''
            self.NETWORK_BASE = ''
            self.IP_MASK = ''
            self.SERVER_ADDR, self.NETWORK_BASE, self.IP_MASK = cidr_to_subnet_mask(ns.server_addr[0]);

    def setup(self):
        net_settings = self.load_net_settings()        
        self.load_exper_settings(net_settings) = ManualTopologyNet(
                # os.path.abspath(self.options.topology_file),
                settings.ROOT + '/' + self.options.topology_file,

        self.install_cmds(srv_addr = self.SERVER_ADDR)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.