コード例 #1
0
for road in setup_roads:
    road_num = road[0]
    side_a = road[1]
    side_b = road[2]
    for i in range(x_len):
        #n = random.randint(min_road_device_num, max_road_device_num)

        for j in range(n):
            d_name = "d{0}{1:05}".format(road_num, d_num)
            d = Device(name=d_name)
            d.startup_time = 0
            #偏り有り

            #n1 = random.randint(1, d_random_num)
            if dnum == 13:
                d.append_app(Application(name="1", use_resource=random.randint(min_use_resource, max_use_resource)))
                da_num[2] += 1
                dnum = 1
            elif dnum % 2 == 0:
                d.append_app(Application(name="2", use_resource=random.randint(min_use_resource, max_use_resource)))
                da_num[0] += 1
            else:
                d.append_app(Application(name="3", use_resource=random.randint(min_use_resource, max_use_resource)))
                da_num[1] += 1
            dnum += 1

            # 偏りなし ap
            """
            n1 = random.randint(1, 3)
            if n1 == c_sur[0]:
                d.append_app(app1)
コード例 #2
0
 def test_can_append_device_03(self):
     d2 = Device(name="d2")
     d2.append_app(Application(name="a2", use_resource=1))
     self.assertTrue(self.cloudlet.can_append_device(d2))
コード例 #3
0
 def test_can_append_device_04(self):
     d2 = Device(name="d2")
     d2.append_app(Application(name="a2", use_resource=1))
     self.assertFalse(self.cloudlet.can_append_device(d2, app_check=True))
コード例 #4
0
 """
 n1 = random.randint(1, d_random_num)
 if n1 % d_sur[0] == 0:
     d.append_app(app1)
     da_num[0] += 1
 elif n1 % d_sur[1] == 0:
     d.append_app(app2)
     da_num[1] += 1
 else:
     d.append_app(app3)
     da_num[2] += 1
 """
 #偏りなし
 n1 = random.randint(1, 3)
 if n1 == c_sur[0]:
     d.append_app(app1)
     da_num[0] += 1
 elif n1 == c_sur[1]:
     d.append_app(app2)
     da_num[1] += 1
 else:
     d.append_app(app3)
     da_num[2] += 1
 """
 #app 4
 elif n1 % d_sur[2] == 0:
     d.append_app(app4)
 #app5
 elif n1 % d_sur[3] == 0:
     d.append_app(app5)
     """