def __init__(self, configfile, islconffile):
        self.shell = {}
        self.rftable = RFTable()
        self.isltable = RFISLTable()
        self.config = RFConfig(configfile, 0)
        self.islconf = RFISLConf(islconffile)
        self.configured_rfvs = []
        self.switch = {}
        self.link = {}
        self.linkname = {}
        self.ent = 0
        # Logging
        self.log = logging.getLogger("rfserver")
        self.log.setLevel(logging.INFO)
        ch = logging.StreamHandler()
        ch.setLevel(logging.INFO)
        ch.setFormatter(logging.Formatter(logging.BASIC_FORMAT))
        self.log.addHandler(ch)

        self.ipc = MongoIPC.MongoIPCMessageService(MONGO_ADDRESS,
                                                   MONGO_DB_NAME, RFSERVER_ID,
                                                   threading.Thread,
                                                   time.sleep)

        self.ipc.listen(RFCLIENT_RFSERVER_CHANNEL, self, self, False)
        self.ipc.listen(RFSERVER_RFPROXY_CHANNEL, self, self, False)
        filename = "rftest/CONF_FILE"
        f = open(filename, 'w')
        f.write("vm_id,vm_port,ct_id,dp_id,dp_port")
        f.close()
Пример #2
0
    def __init__(self, configfile, islconffile):
        self.rftable = RFTable()
        self.isltable = RFISLTable()
        self.config = RFConfig(configfile)
        self.islconf = RFISLConf(islconffile)
        self.configured_rfvs = []
        # Logging
        self.log = logging.getLogger("rfserver")
        self.log.setLevel(logging.INFO)
        ch = logging.StreamHandler()
        ch.setLevel(logging.INFO)
        ch.setFormatter(logging.Formatter(logging.BASIC_FORMAT))
        self.log.addHandler(ch)

        self.ipc = MongoIPC.MongoIPCMessageService(MONGO_ADDRESS,
                                                   MONGO_DB_NAME, RFSERVER_ID,
                                                   threading.Thread,
                                                   time.sleep)
        self.log.info(
            "11111111111111111111111111111111111111111111111111111111111")
        self.ipc.listen(RFCLIENT_RFSERVER_CHANNEL, self, self, False)
        self.log.info(
            "2222222222222222222222222222222222222222222222222222222222")
        self.ipc.listen(RFSERVER_RFPROXY_CHANNEL, self, self, True)
        self.log.info(
            "33333333333333333333333333333333333333333333333333333333333")
Пример #3
0
    def __init__(self, *args, **kwargs):
        super(RFProxy, self).__init__(*args, **kwargs)

        ID = 0
        self.ipc = MongoIPC.MongoIPCMessageService(MONGO_ADDRESS,
                                                   MONGO_DB_NAME, str(ID),
                                                   hub_thread_wrapper,
                                                   hub.sleep)
        self.ipc.listen(RFSERVER_RFPROXY_CHANNEL, RFProtocolFactory(),
                        RFProcessor(), False)
        log.info("RFProxy running.")
Пример #4
0
    def __init__(self, configfile):
        self.rftable = RFTable()
        self.config = RFConfig(configfile)
        self.configured_rfvs = False
        # Logging
        self.log = logging.getLogger("rfserver")
        self.log.setLevel(logging.INFO)
        ch = logging.StreamHandler()
        ch.setLevel(logging.INFO)
        ch.setFormatter(logging.Formatter(logging.BASIC_FORMAT))
        self.log.addHandler(ch)

        self.ipc = MongoIPC.MongoIPCMessageService(MONGO_ADDRESS,
                                                   MONGO_DB_NAME, RFSERVER_ID)
        self.ipc.listen(RFCLIENT_RFSERVER_CHANNEL, self, self, False)
        self.ipc.listen(RFSERVER_RFPROXY_CHANNEL, self, self, True)
Пример #5
0
 def __init__(self, *arg, **kwargs):
     self.controllers = dict()
     self.monitors = dict()
     self.eligible_masters = dict()
     self.controllerLock = threading.Lock()
     self.ipc = MongoIPC.MongoIPCMessageService(MONGO_ADDRESS,
                                                MONGO_DB_NAME, RFMONITOR_ID,
                                                threading.Thread,
                                                time.sleep)
     self.ipc.listen(RFMONITOR_RFPROXY_CHANNEL, self, self, False)
     self.log = logging.getLogger("rfmonitor")
     self.log.setLevel(logging.INFO)
     ch = logging.StreamHandler()
     ch.setLevel(logging.INFO)
     ch.setFormatter(logging.Formatter(logging.BASIC_FORMAT))
     self.log.addHandler(ch)
     self.test_controllers()
Пример #6
0
        for key in self.vs_to_dp.keys():
            id_, port = self.vs_to_dp[key]
            if id_ == dp_id:
                del self.vs_to_dp[key]

    # We're not considering the case of this table becoming invalid when a
    # datapath goes down. When the datapath comes back, the server recreates
    # the association, forcing new map messages to be generated, overriding the
    # previous mapping.
    # If a packet comes and matches the invalid mapping, it can be redirected
    # to the wrong places. We have to fix this.


netmask_prefix = lambda a: sum(
    [bin(int(x)).count("1") for x in a.split(".", 4)])
ipc = MongoIPC.MongoIPCMessageService(MONGO_ADDRESS, MONGO_DB_NAME, RFPROXY_ID)
table = Table()

# Logging
log = core.getLogger("rfproxy")


# Base methods
def send_of_msg(dp_id, ofmsg):
    topology = core.components['topology']
    switch = topology.getEntityByID(dp_id)
    if switch is not None and switch.connected:
        try:
            switch.send(ofmsg)
        except:
            return FAILURE
Пример #7
0
                del self.vs_to_dp[key]

    # We're not considering the case of this table becoming invalid when a
    # datapath goes down. When the datapath comes back, the server recreates
    # the association, forcing new map messages to be generated, overriding the
    # previous mapping.
    # If a packet comes and matches the invalid mapping, it can be redirected
    # to the wrong places. We have to fix this.


netmask_prefix = lambda a: sum(
    [bin(int(x)).count("1") for x in a.split(".", 4)])

# TODO: add proper support for ID
ID = 0
ipc = MongoIPC.MongoIPCMessageService(MONGO_ADDRESS, MONGO_DB_NAME, str(ID),
                                      threading.Thread, time.sleep)
table = Table()

# Logging
log = core.getLogger("rfproxy")


# Base methods
def send_of_msg(dp_id, ofmsg):
    topology = core.components['topology']
    switch = topology.getEntityByID(dp_id)
    if switch is not None and switch.connected:
        try:
            switch.send(ofmsg)
        except:
            return FAILURE
Пример #8
0
 def __define_ipc(self):
     self.ipc = MongoIPC.MongoIPCMessageService(MONGO_ADDRESS,
                                                MONGO_DB_NAME, RFSERVER_ID,
                                                threading.Thread,
                                                time.sleep)