示例#1
0
    def newTask(self):

        taskpoolinstance = TaskPool()
        Peer_Table = {('10.108.90.1', '10.108.91.0/24'): Table.return_src_and_dst_dpid('10.108.90.1', '10.108.91.0/24'),
                      ('10.108.91.1', '10.108.90.0/24'): Table.return_src_and_dst_dpid('10.108.91.1', '10.108.90.0/24')}

        SC = self.SuperController
        peer_table = copy.copy(Peer_Table)
        #self.sleep = 120
        #hub.sleep(self.sleep)

        for s_d in peer_table.keys():
            if s_d:
                req = {SRC_SWITCH: peer_table[s_d][0],
                       DST_SWITCH: peer_table[s_d][2],
                       LAST_OUTPORT_NUM: peer_table[s_d][3],
                       SRC_IP: s_d[0], DST_IP: s_d[1],
                       LOCAL_MAC: peer_table[s_d][4],
                       NEXT_MAC: peer_table[s_d][5],
                       BANDWIDTH: {"peak": 50000000, "guranted": 20000000},
                       TASK_ID: taskpoolinstance.get_taskid()}
                REQ_LIST.append(req)

                SC.taskAssign(self, req)
                self.logger.info("Build a path from %0x16 to %0x16" % (SRC_SWITCH, DST_SWITCH))
示例#2
0
    def newTask(self, req):

        SC = self.SuperController
        body = req.body
        rest = eval(body)
        assert TYPE in rest
        type = rest.get(TYPE, None)
        if not type:
            self.logger.fatal("Not type in rest")
            return
        self.TaskPool = TaskPool()
        self.TaskPool.initTaskPool()
        Peer_Table = {
            ("10.108.92.1", "10.108.91.0/24"): (
                0x7E92486E73020308,
                4,
                0x2674486E73020311,
                6,
                "48:6e:73:02:03:10",
                "00:10:01:08:00:03",
            ),
            ("10.108.91.1", "10.108.92.0/24"): (
                0x2674486E73020311,
                6,
                0x7E92486E73020308,
                4,
                "48:6e:73:02:03:07",
                "f4:4e:05:9a:e0:c0",
            ),
        }
        # Peer_Table = {('10.108.90.1', '10.108.91.0/24'): Table.return_src_and_dst_dpid('10.108.90.1', '10.108.91.0/24'),
        #               ('10.108.91.1', '10.108.90.0/24'): Table.return_src_and_dst_dpid('10.108.91.1', '10.108.90.0/24')}
        # curl -X PUT -d '{TYPE: "newtask"}' http://127.0.0.1:8080/super/newtask
        peer_table = copy.deepcopy(Peer_Table)
        # self.sleep = 120
        # hub.sleep(self.sleep)

        for s_d in peer_table.keys():
            if s_d:
                request = {
                    SRC_SWITCH: peer_table[s_d][0],
                    DST_SWITCH: peer_table[s_d][2],
                    LAST_OUTPORT_NUM: peer_table[s_d][3],
                    SRC_IP: s_d[0],
                    DST_IP: s_d[1],
                    LOCAL_MAC: peer_table[s_d][4],
                    NEXT_MAC: peer_table[s_d][5],
                    BANDWIDTH: {"peak": 5000000, "guranted": 2000000},
                    TASK_ID: self.TaskPool.get_taskid(),
                }
                REQ_LIST.append(request)

                self.taskAssign(str(request))
                self.logger.info("Build a path from %0x16 to %0x16" % (request[SRC_SWITCH], request[DST_SWITCH]))
示例#3
0
    def makeTaskAssign(self, peer_table1=None, peer_table2=None):
        if peer_table1 is not None:
            for s_d in peer_table1.keys():
                if s_d:
                    request = {SRC_SWITCH: peer_table1[s_d][0],
                           DST_SWITCH: peer_table1[s_d][1],
                           LAST_OUTPORT_NUM: peer_table1[s_d][2],
                           SRC_IP: s_d[0], DST_IP: s_d[1],
                           LOCAL_MAC: '00:00:00:00:00:00',
                           NEXT_MAC: peer_table1[s_d][3],
                           NEXTHOP: peer_table1[s_d][4],
                           BANDWIDTH: {"peak": 1000000000, "guranted": 10000000},
                           TASK_ID: self.TaskPool.get_taskid(),
                           DOMAINTYPE: 'L3'}

                    REQ_LIST.append(request)

                    self.taskAssign(str(request))
                    self.logger.info("Build a path in L3 domain from %s to %s" %
                                     (request[SRC_SWITCH], request[DST_SWITCH]))

        if peer_table2 is not None:
            for s_d in peer_table2.keys():
                if s_d:
                    request = {SRC_SWITCH: peer_table2[s_d][0],
                           DST_SWITCH: peer_table2[s_d][1],
                           LAST_OUTPORT_NUM: peer_table2[s_d][2],
                           SRC_MAC: s_d[0], DST_MAC: s_d[1],
                           LOCAL_MAC: None,
                           NEXT_MAC: None,
                           NEXTHOP: None,
                           BANDWIDTH: {"peak": 1000000000, "guranted": 10000000},
                           TASK_ID: self.TaskPool.get_taskid(),
                           DOMAINTYPE: 'L2'}

                    REQ_LIST.append(request)

                    self.taskAssign(str(request))
                    self.logger.info("Build a path in L2 domain from %s to %s" %
                                     (request[SRC_SWITCH], request[DST_SWITCH]))
示例#4
0
    def newTask(self):

        taskpoolinstance = TaskPool()
        Peer_Table = {
            ('10.108.90.1', '10.108.91.0/24'):
            Table.return_src_and_dst_dpid('10.108.90.1', '10.108.91.0/24'),
            ('10.108.91.1', '10.108.90.0/24'):
            Table.return_src_and_dst_dpid('10.108.91.1', '10.108.90.0/24')
        }

        SC = self.SuperController
        peer_table = copy.copy(Peer_Table)
        #self.sleep = 120
        #hub.sleep(self.sleep)

        for s_d in peer_table.keys():
            if s_d:
                req = {
                    SRC_SWITCH: peer_table[s_d][0],
                    DST_SWITCH: peer_table[s_d][2],
                    LAST_OUTPORT_NUM: peer_table[s_d][3],
                    SRC_IP: s_d[0],
                    DST_IP: s_d[1],
                    LOCAL_MAC: peer_table[s_d][4],
                    NEXT_MAC: peer_table[s_d][5],
                    BANDWIDTH: {
                        "peak": 50000000,
                        "guranted": 20000000
                    },
                    TASK_ID: taskpoolinstance.get_taskid()
                }
                REQ_LIST.append(req)

                SC.taskAssign(self, req)
                self.logger.info("Build a path from %0x16 to %0x16" %
                                 (SRC_SWITCH, DST_SWITCH))
示例#5
0
    def newTask(self, req):

        SC = self.SuperController
        body = req.body
        rest = eval(body)
        assert TYPE in rest
        type = rest.get(TYPE, None)
        if not type:
            self.logger.fatal("Not type in msgbody")
            return
        # typee = rest[TYPEE]
        # taskpoolinstance = TaskPool()
        self.TaskPool = TaskPool()
        self.TaskPool.initTaskPool()

        Peer_Table_ip = {
            (('10.108.92.0', '255.255.255.0'), ('10.108.93.0', '255.255.255.0')):
            self.SuperController.table.ip_return_src_and_dst_dpid(
                '10.108.92.0/24', '10.108.93.0/24'),
            (('10.108.93.0', '255.255.255.0'), ('10.108.92.0', '255.255.255.0')):
            self.SuperController.table.ip_return_src_and_dst_dpid(
                '10.108.93.0/24', '10.108.92.0/24')
        }
        #src_dpid,dst_dpid,dst_port,dst_mac
        # Peer_Table_ip = {(('10.108.92.0','255.255.255.0'), ('10.108.93.0','255.255.255.0')): (513,518,34,'40:8d:5c:37:1f:b5'),
        #               (('10.108.93.0','255.255.255.0'), ('10.108.92.0','255.255.255.0')): (518,513,4,'f4:4e:05:9a:e0:c0')}
        # print Peer_Table_ip
        peer_table_mac = {
            ('c8:9c:dc:7a:6d:7a', '00:00:00:00:00:01'):
            self.SuperController.table.mac_to_src_dst_dpid(
                'c8:9c:dc:7a:6d:7a', '00:00:00:00:00:01'),
            ('00:00:00:00:00:01', 'c8:9c:dc:7a:6d:7a'):
            self.SuperController.table.mac_to_src_dst_dpid(
                '00:00:00:00:00:01', 'c8:9c:dc:7a:6d:7a')
        }
        # print peer_table_mac
        #src_dpid,dst_dpid,dst_port
        # peer_table_mac = {('c8:9c:dc:7a:6d:7a','00:00:00:00:00:01'): (769,773,25),
        #                   ('00:00:00:00:00:01','c8:9c:dc:7a:6d:7a'): (773,769,4)}

        #curl -X PUT -d '{TYPE: "newtask"}' http://0.0.0.0:8080/super/newtask

        peer_table1 = copy.copy(Peer_Table_ip)
        peer_table2 = copy.copy(peer_table_mac)
        #self.sleep = 120
        #hub.sleep(self.sleep)

        #two paths and two task_assign
        for s_d in peer_table1.keys():
            if s_d:
                request = {
                    SRC_SWITCH: peer_table1[s_d][0],
                    DST_SWITCH: peer_table1[s_d][1],
                    LAST_OUTPORT_NUM: peer_table1[s_d][2],
                    SRC_IP: s_d[0],
                    DST_IP: s_d[1],
                    LOCAL_MAC: '00:00:00:00:00:00',
                    NEXT_MAC: peer_table1[s_d][3],
                    BANDWIDTH: {
                        "peak": 5000000,
                        "guranted": 2000000
                    },
                    TASK_ID: self.TaskPool.get_taskid(),
                    DOMAINTYPE: 'L3'
                }

                REQ_LIST.append(request)

                self.taskAssign(str(request))
                self.logger.info("Build a path in L3 domain from %s to %s" %
                                 (request[SRC_SWITCH], request[DST_SWITCH]))

        for s_d in peer_table2.keys():
            if s_d:
                request = {
                    SRC_SWITCH: peer_table2[s_d][0],
                    DST_SWITCH: peer_table2[s_d][1],
                    LAST_OUTPORT_NUM: peer_table2[s_d][2],
                    SRC_MAC: s_d[0],
                    DST_MAC: s_d[1],
                    LOCAL_MAC: None,
                    NEXT_MAC: None,
                    BANDWIDTH: {
                        "peak": 5000000,
                        "guranted": 2000000
                    },
                    TASK_ID: self.TaskPool.get_taskid(),
                    DOMAINTYPE: 'L2'
                }

                REQ_LIST.append(request)

                self.taskAssign(str(request))
                self.logger.info("Build a path in L2 domain from %s to %s" %
                                 (request[SRC_SWITCH], request[DST_SWITCH]))
示例#6
0
    def newTask(self, req):

        SC = self.SuperController
        body = req.body
        rest = eval(body)
        assert TYPE in rest
        type = rest.get(TYPE, None)
        if not type:
            self.logger.fatal("Not type in msgbody")
            return
        # typee = rest[TYPEE]
        # taskpoolinstance = TaskPool()
        self.TaskPool = TaskPool()
        self.TaskPool.initTaskPool()

        Peer_Table_ip = {(('10.108.92.0','255.255.255.0'), ('10.108.93.0','255.255.255.0')): self.SuperController.
            table.ip_return_src_and_dst_dpid('10.108.92.0/24','10.108.93.0/24'),
                         (('10.108.93.0','255.255.255.0'), ('10.108.92.0','255.255.255.0')): self.SuperController.
            table.ip_return_src_and_dst_dpid('10.108.93.0/24','10.108.92.0/24')}
                                                                #src_dpid,dst_dpid,dst_port,dst_mac
        # Peer_Table_ip = {(('10.108.92.0','255.255.255.0'), ('10.108.93.0','255.255.255.0')): (513,518,34,'40:8d:5c:37:1f:b5'),
        #               (('10.108.93.0','255.255.255.0'), ('10.108.92.0','255.255.255.0')): (518,513,4,'f4:4e:05:9a:e0:c0')}
        # print Peer_Table_ip
        peer_table_mac = {('c8:9c:dc:7a:6d:7a','00:00:00:00:00:01'):self.SuperController.
            table.mac_to_src_dst_dpid('c8:9c:dc:7a:6d:7a','00:00:00:00:00:01'),
                          ('00:00:00:00:00:01','c8:9c:dc:7a:6d:7a'):self.SuperController.
            table.mac_to_src_dst_dpid('00:00:00:00:00:01','c8:9c:dc:7a:6d:7a')}
        # print peer_table_mac
                                                                    #src_dpid,dst_dpid,dst_port
        # peer_table_mac = {('c8:9c:dc:7a:6d:7a','00:00:00:00:00:01'): (769,773,25),
        #                   ('00:00:00:00:00:01','c8:9c:dc:7a:6d:7a'): (773,769,4)}


        #curl -X PUT -d '{TYPE: "newtask"}' http://0.0.0.0:8080/super/newtask


        peer_table1 = copy.copy(Peer_Table_ip)
        peer_table2 = copy.copy(peer_table_mac)
        #self.sleep = 120
        #hub.sleep(self.sleep)


        #two paths and two task_assign
        for s_d in peer_table1.keys():
            if s_d:
                request = {SRC_SWITCH: peer_table1[s_d][0],
                       DST_SWITCH: peer_table1[s_d][1],
                       LAST_OUTPORT_NUM: peer_table1[s_d][2],
                       SRC_IP: s_d[0], DST_IP: s_d[1],
                       LOCAL_MAC: '00:00:00:00:00:00',
                       NEXT_MAC: peer_table1[s_d][3],
                       BANDWIDTH: {"peak": 5000000, "guranted": 2000000},
                       TASK_ID: self.TaskPool.get_taskid(),
                       DOMAINTYPE: 'L3'}

                REQ_LIST.append(request)

                self.taskAssign(str(request))
                self.logger.info("Build a path in L3 domain from %s to %s" %
                                 (request[SRC_SWITCH], request[DST_SWITCH]))

        for s_d in peer_table2.keys():
            if s_d:
                request = {SRC_SWITCH: peer_table2[s_d][0],
                       DST_SWITCH: peer_table2[s_d][1],
                       LAST_OUTPORT_NUM: peer_table2[s_d][2],
                       SRC_MAC: s_d[0], DST_MAC: s_d[1],
                       LOCAL_MAC: None,
                       NEXT_MAC: None,
                       BANDWIDTH: {"peak": 5000000, "guranted": 2000000},
                       TASK_ID: self.TaskPool.get_taskid(),
                       DOMAINTYPE: 'L2'}

                REQ_LIST.append(request)

                self.taskAssign(str(request))
                self.logger.info("Build a path in L2 domain from %s to %s" %
                                 (request[SRC_SWITCH], request[DST_SWITCH]))