Пример #1
0
def main():
    chassis_name = cfg.CONF.host
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    init_ryu_config()
    nb_api = api_nb.NbApi.get_instance(False)
    controller = DfLocalController(chassis_name, nb_api)
    DfLocalController.instance = controller
    ryu_base_app.RyuDFAdapter.call_on_datapath_set = DfLocalController.on_datapath_set
    ryu_base_app.RyuDFAdapter.ctrl = controller
    service.register_service('df-local-controller', nb_api, controller)
    controller.run()
def main():
    # if len(sys.argv) > 1:
    #     value = sys.argv.pop()
    #     option = sys.argv.pop()
    #     if option == '-ctl-port':
    #         port = value
    #
    #         ryu_cfg.CONF.ofp_tcp_listen_port = port
    #     else:
    #         print "unkown option {}".format(option)
    #         exit(1)
    # try:
    #     port = str(input("Specify controller port. Empty is default\nController listens to Port:"))
    # except Exception:
    #     port = ""

    # sys.argv.append('--config-file')
    # sys.argv.append('/home/vagrant/dragonflow/etc/neutron.conf')
    sys.argv.append('--config-file')
    sys.argv.append('../../../etc/dragonflow.ini')
    # sys.argv.append('ws_topology.py')
    sys.argv.append('l2_app_concept2.py')
    sys.argv.append('l3_app_concept2.py')
    # sys.argv.append('/home/vagrant/dragonflow/dragonflow/controller/ryu_base_app.py')
    # sys.argv.append('/home/vagrant/dragonflow/dragonflow/controller/apps/l2.py')
    sys.argv.append('--verbose')
    sys.argv.append('--observe-links')

    common_config.init(sys.argv[1:3])
    common_config.setup_logging()

    # if port is not "":
    #     print "Setting Port {}".format(port)
    #     sys.argv.append('--ofp-tcp-listen-port')
    #     sys.argv.append(port)

    # ipv6 listen host
    sys.argv.append('--ofp-listen-host')
    sys.argv.append('::')
    # sys.argv.append('--enable-debugger')

    # set controller load to 0
    override_load_file(0)

    try:
        manager.main()
    except KeyboardInterrupt:
        override_load_file(0)
        print "Exiting because keyboard interrupt was received."
Пример #3
0
    def __init__(self, *args, **kwargs):
        super(SimpleSwitch13, self).__init__(*args, **kwargs)
        # self.mac_to_port = {}
        db_store._instance = None
        self.fake_lswitch_default_subnets = [
            l2.Subnet(dhcp_ip="192.168.123.0",
                      name="private-subnet",
                      enable_dhcp=True,
                      topic="fake_tenant1",
                      gateway_ip="192.168.123.1",
                      cidr="192.168.123.0/24",
                      id="fake_subnet1")
        ]
        print(self.fake_lswitch_default_subnets[0].dhcp_ip)
        common_config.init(sys.argv[1:3])
        common_config.setup_logging()
        self.nb_api = api_nb.NbApi.get_instance(False)

        self.controller = controller_concept.DfStandaloneController(
            'df_standalone', self.nb_api)
        self.db_store = db_store.get_instance()