Skip to content

Commit

Permalink
Start implmenting #1143
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed May 21, 2021
1 parent ea1af74 commit ceb4325
Show file tree
Hide file tree
Showing 3 changed files with 372 additions and 10 deletions.
363 changes: 363 additions & 0 deletions IM/InfrastructureInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import time
from uuid import uuid1
import json
from random import randint

import IM.ConfManager
from datetime import datetime, timedelta
Expand Down Expand Up @@ -119,6 +120,8 @@ def __init__(self):
"""Flag to specify that this Inf is deleting resources """
self.creation_date = int(time.time())
""" Creation time of this Inf. """
self.name = self.generate_random_name()
""" Human readable name (unique id). """

def serialize(self):
with self._lock:
Expand Down Expand Up @@ -149,6 +152,7 @@ def serialize(self):
@staticmethod
def deserialize(str_data):
newinf = InfrastructureInfo()
newinf.name = None
newinf.creation_date = None
dic = json.loads(str_data)
vm_list = dic['vm_list']
Expand Down Expand Up @@ -272,6 +276,12 @@ def get_cont_out(self):
"""
return self.cont_out

def get_name(self):
"""
Returns the infrastructure name (if avaliable)
"""
return self.name if self.name else self.id

def add_vm(self, vm):
"""
Add, and assigns a new VM ID to the infrastructure
Expand Down Expand Up @@ -741,3 +751,356 @@ def set_adding(self, value=True):
self.add_cont_msg("Infrastructure deleted. Do not add resources.")
raise Exception("Infrastructure deleted. Do not add resources.")
self.adding = value

@staticmethod
def generate_random_name():
left = [
"admiring",
"adoring",
"affectionate",
"agitated",
"amazing",
"angry",
"awesome",
"beautiful",
"blissful",
"bold",
"boring",
"brave",
"busy",
"charming",
"clever",
"cool",
"compassionate",
"competent",
"condescending",
"confident",
"cranky",
"crazy",
"dazzling",
"determined",
"distracted",
"dreamy",
"eager",
"ecstatic",
"elastic",
"elated",
"elegant",
"eloquent",
"epic",
"exciting",
"fervent",
"festive",
"flamboyant",
"focused",
"friendly",
"frosty",
"funny",
"gallant",
"gifted",
"goofy",
"gracious",
"great",
"happy",
"hardcore",
"heuristic",
"hopeful",
"hungry",
"infallible",
"inspiring",
"interesting",
"intelligent",
"jolly",
"jovial",
"keen",
"kind",
"laughing",
"loving",
"lucid",
"magical",
"mystifying",
"modest",
"musing",
"naughty",
"nervous",
"nice",
"nifty",
"nostalgic",
"objective",
"optimistic",
"peaceful",
"pedantic",
"pensive",
"practical",
"priceless",
"quirky",
"quizzical",
"recursing",
"relaxed",
"reverent",
"romantic",
"sad",
"serene",
"sharp",
"silly",
"sleepy",
"stoic",
"strange",
"stupefied",
"suspicious",
"sweet",
"tender",
"thirsty",
"trusting",
"unruffled",
"upbeat",
"vibrant",
"vigilant",
"vigorous",
"wizardly",
"wonderful",
"xenodochial",
"youthful",
"zealous",
"zen"
]
rigth = [
"albattani",
"allen",
"almeida",
"antonelli",
"agnesi",
"archimedes",
"ardinghelli",
"aryabhata",
"austin",
"babbage",
"banach",
"banzai",
"bardeen",
"bartik",
"bassi",
"beaver",
"bell",
"benz",
"bhabha",
"bhaskara",
"black",
"blackburn",
"blackwell",
"bohr",
"booth",
"borg",
"bose",
"bouman",
"boyd",
"brahmagupta",
"brattain",
"brown",
"buck",
"burnell",
"cannon",
"carson",
"cartwright",
"carver",
"cerf",
"chandrasekhar",
"chaplygin",
"chatelet",
"chatterjee",
"chebyshev",
"cohen",
"chaum",
"clarke",
"colden",
"cori",
"cray",
"curran",
"curie",
"darwin",
"davinci",
"dewdney",
"dhawan",
"diffie",
"dijkstra",
"dirac",
"driscoll",
"dubinsky",
"easley",
"edison",
"einstein",
"elbakyan",
"elgamal",
"elion",
"ellis",
"engelbart",
"euclid",
"euler",
"faraday",
"feistel",
"fermat",
"fermi",
"feynman",
"franklin",
"gagarin",
"galileo",
"galois",
"ganguly",
"gates",
"gauss",
"germain",
"goldberg",
"goldstine",
"goldwasser",
"golick",
"goodall",
"gould",
"greider",
"grothendieck",
"haibt",
"hamilton",
"haslett",
"hawking",
"hellman",
"heisenberg",
"hermann",
"herschel",
"hertz",
"heyrovsky",
"hodgkin",
"hofstadter",
"hoover",
"hopper",
"hugle",
"hypatia",
"ishizaka",
"jackson",
"jang",
"jemison",
"jennings",
"jepsen",
"johnson",
"joliot",
"jones",
"kalam",
"kapitsa",
"kare",
"keldysh",
"keller",
"kepler",
"khayyam",
"khorana",
"kilby",
"kirch",
"knuth",
"kowalevski",
"lalande",
"lamarr",
"lamport",
"leakey",
"leavitt",
"lederberg",
"lehmann",
"lewin",
"lichterman",
"liskov",
"lovelace",
"lumiere",
"mahavira",
"margulis",
"matsumoto",
"maxwell",
"mayer",
"mccarthy",
"mcclintock",
"mclaren",
"mclean",
"mcnulty",
"mendel",
"mendeleev",
"meitner",
"meninsky",
"merkle",
"mestorf",
"mirzakhani",
"montalcini",
"moore",
"morse",
"murdock",
"moser",
"napier",
"nash",
"neumann",
"newton",
"nightingale",
"nobel",
"noether",
"northcutt",
"noyce",
"panini",
"pare",
"pascal",
"pasteur",
"payne",
"perlman",
"pike",
"poincare",
"poitras",
"proskuriakova",
"ptolemy",
"raman",
"ramanujan",
"ride",
"ritchie",
"rhodes",
"robinson",
"roentgen",
"rosalind",
"rubin",
"saha",
"sammet",
"sanderson",
"satoshi",
"shamir",
"shannon",
"shaw",
"shirley",
"shockley",
"shtern",
"sinoussi",
"snyder",
"solomon",
"spence",
"stonebraker",
"sutherland",
"swanson",
"swartz",
"swirles",
"taussig",
"tereshkova",
"tesla",
"tharp",
"thompson",
"torvalds",
"tu",
"turing",
"varahamihira",
"vaughan",
"visvesvaraya",
"volhard",
"villani",
"wescoff",
"wilbur",
"wiles",
"williams",
"williamson",
"wilson",
"wing",
"wozniak",
"wright",
"wu",
"yalow",
"yonath",
"zhukovsky"
]
return "%s-%s%d" % (left[randint(0, len(left) - 1)], rigth[randint(0, len(rigth) - 1)], randint(0, 9))
Loading

0 comments on commit ceb4325

Please sign in to comment.