def post(self, request, tcid): dbrow = get_testcase(tcid) data = request.POST if data.get("completed") == "0": # yes if data.get("passfail") == "0": # yes result = webhelpers.PASSED else: result = webhelpers.FAILED else: result = webhelpers.INCOMPLETE username = request.session["username"] tester = models.User.get_by_username(webhelpers.dbsession, username) build=webhelpers.resolve_build(data.get("build")) rr = models.create(models.TestResult, objecttype=webhelpers.RUNNER, testcase=None, environment=webhelpers.resolve_environment(data.get("environment")), build=build, tester=tester, testversion=None, parent=None, starttime=data.get("starttime"), endtime=str(models.tables.time_now()), arguments=None, result=result, diagnostic=None, note=None, valid=True, ) webhelpers.dbsession.add(rr) tr = models.create(models.TestResult, objecttype=webhelpers.TEST, testcase=dbrow, environment=None, build=build, tester=tester, testversion=None, parent=rr, starttime=data.get("starttime"), endtime=str(models.tables.time_now()), arguments=None, result=result, diagnostic=IF(result != webhelpers.PASSED, data.get("note")), note=IF(result == webhelpers.PASSED, data.get("note")), valid=True, ) webhelpers.dbsession.add(tr) try: webhelpers.dbsession.commit() except (DataError, IntegrityError), err: webhelpers.dbsession.rollback() title = "Test runner error" resp = framework.ResponseDocument(request, testcase_run_constructor, title=title) resp.doc.new_para(err, class_="error") resp.doc.new_para("There was an error recording this test. Please try again.") return resp.finalize()
def do_config(session): rn = models.create(models.Config, name="root", user=None, parent=None, value=aid.NULL) session.add(rn) flags = models.create(models.Config, name="flags", user=None, container=rn, value=aid.NULL) session.add(flags) session.commit() root = config.Container(session, rn) flags = config.Container(session, flags) flags.VERBOSE = 0 # levels of verbosity flags.DEBUG = 0 # levels of debugging flags.INTERACTIVE = False # Don't run interactive tests also, by default root["logbasename"] = "testrun.log" root["logfiledir"] = "/var/tmp" root["reportbasename"] = "-" root["resultsdirbase"] = '/var/www/localhost/htdocs/testresults' root["documentroot"] = "/var/www/localhost" # this one, at least, will have to be changed by installer. root["baseurl"] = "http://localhost" ui = root.add_container("userinterfaces") ui.default = ("UI.UserInterface", "IO.ConsoleIO", "UI.DefaultTheme") ui.console = ("UI.UserInterface", "IO.ConsoleIO", "UI.DefaultTheme") reports = root.add_container("reports") reports.default = ("StandardReport", "-", "text/ansi") reports.ansi = ("StandardReport", "-", "text/ansi; charset=utf8") reports.database = ("pycopia.reports.database.DatabaseReport", ) reports.email = ("pycopia.reports.Email.EmailReport", "text/html", None) reports.html = ("StandardReport", "$username-$runnertimestamp", "text/html") reports.full = [("StandardReport", "-", "text/ansi; charset=utf8"), ("StandardReport", "$username-$runnertimestamp", "text/html")] reports.production = [ ("StandardReport", "-", "text/ansi; charset=utf8"), ("StandardReport", "$username-$runnertimestamp", "text/html"), ("pycopia.reports.database.DatabaseReport", ), ] controllers = root.add_container("controllers") selenium = root.add_container("selenium") selenium.host = "localhost" selenium.port = 4444 selenium.browser = "firefox" session.commit()
def get_or_create_TestSuite(**kwargs): try: testsuite = _dbsession.query(models.TestSuite).filter(models.TestSuite.name==kwargs["name"]).one() except models.NoResultFound: testsuite = models.create(models.TestSuite, **kwargs) _dbsession.add(testsuite) _dbsession.commit() else: if _FORCE: _dbsession.delete(testsuite) _dbsession.commit() testsuite = models.create(models.TestSuite, **kwargs) _dbsession.add(testsuite) _dbsession.commit() return testsuite
def do_attribute_types(session): for name, vtype, desc in ( ("isbase", 5, "Is a base item (don't follow fallback)."), ("fallback", 1, "Name of fallback item for more attributes, if any."), ("login", 1, "Username to access, if needed by accessmethod."), ("password",1, "Password for login, if needed by accessmethod."), ("accessmethod",1, 'Method of device access supported by Configurator constructor.'), ("initialaccessmethod",1, 'Initial access method to perform basic configure. e.g. "console"'), ("snmp_ro_community",1, "SNMP community string for RO access."), ("snmp_rw_community",1, "SNMP community string for RW access."), ("console_server",0, "Consoler server '(host, port)', if any."), ("power_controller",0, "Power controller '(name, socket)', if any."), ("monitor_port",0, "Etherswitch port that mirrors primary data interface."), ("admin_interface",1, "Name of administrative interface, if any."), ("data_interfaces",0, "Comma separated list of data/test interfaces."), ("phonenumber",1, "Assigned phone number, if a phone."), ("useragent", 1, "If a browser, the user agent."), ("wireless", 5, "Is a wireless communication device."), ("webenabled", 5, "Is a WWW enabled device."), ("url",1, "base URL to access device, if required."), ("serviceport", 1, "TCP/UDP/IP service port in the form 'tcp/80'."), ("servicepath", 1, "Path part of a URL pointing to service location."), ("serviceprotocol", 1, "Protocol part of a URL pointing to service location."), ("protocol", 1, "Internet protocol a software implements."), ("hostname", 1, "Name to use as host name. Overrides base name."), ("state", 1, "The current state of the device. Arbitrary string used by test framework."), ): session.add(models.create(models.AttributeType, name=name, value_type=vtype, description=desc)) session.commit()
def do_env_attribute_types(session): for name, vtype, desc in ( ("state", 1, "The current state of the environment. Test defined string."), ): session.add(models.create(models.EnvironmentAttributeType, name=name, value_type=vtype, description=desc)) session.commit()
def add_interface(session, attribs): """Add new interface, don't duplicate existing one. Also try connecting to equipment if possible. """ network = attribs.get("network") ipaddr = attribs["ipaddr"] attribs["interface_type"] = get_interface_type(session) q = session.query(models.Interface).filter( models.and_(models.Interface.network == network, models.Interface.ipaddr == ipaddr)) # try to find equipment by matching name. hostname = attribs.get("description") if hostname: eq = get_equipment(session, hostname) del attribs["description"] else: eq = None attribs["equipment"] = eq try: intf = q.one() except models.NoResultFound: intf = models.create(models.Interface, **attribs) session.add(intf) session.commit() else: models.update(intf, **attribs) session.commit()
def do_capability_groups(session): for name in ( "CPU", "system", ): session.add(models.create(models.CapabilityGroup, name=name)) session.commit()
def do_software_category(session): for name, desc in ( ("OS", "An operating system."), ("spreadsheet", "A spreadsheet."), ("wordprocessor", "A wordprocessor."), ("texteditor", "A plain text editor."), ("proxy", "A type of network protocol proxy."), ("browser", "Can render web content."), ("webserver", "Serves web pages and content."), ("selenium", "A Selenium server."), ("mua", "A mail user agent (e.g. pine, thunderbird, or claws-mail)."), ("mta", "A Mail transfer agent or SMTP server (e.g. sendmail, courier)."), ("dnsserver", "Responds to DNS queries."), ("database", "A database server."), ("remoteshell", "Provides some remote command shell."), ("remotedesktop", "Provides a remote desktop."), ("dhcpserver", "Provides DHCP services."), ("tftpserver", "Provides TFTP server, usually for network booting."), ("cupsserver", "A CUPS printer server."), ("nfsserver", "An NFS server."), ("nfsclient", "An NFS client."), ("iscsiserver", "A iSCSI target (server)."), ("iscsi_initiator", "A iSCSI initiator (client)."), ("ntp", "Provides network time sync service."), ("ftpserver", "Provides an FTP server."), ("vixclient", "A VMware VIX client."), ("hypervisor", "A hypervisor (e.g. VMware ESX)."), ): session.add(models.create(models.SoftwareCategory, name=name, description=desc)) session.commit()
def set(self, argv): """set [-t <type>] <name> <value> Sets the named attribute to a new value. The value will be converted into a likely suspect, but you can specify a type with the -t flag. """ tval = CLI.clieval optlist, longoptdict, args = self.getopt(argv, "t:") for opt, optarg in optlist: if opt == "-t": tval = eval(optarg, {}, {}) if type(tval) is not type: self._ui.error("Bad type.") return try: value = tval(*tuple(args[1:])) except TypeError as terr: self._ui.error(terr) return name = args[0] row = self._get(name) if row is None: myself = self._obj newrow = models.create(models.Config, name=name, value=value, container=myself, user=myself.user, testcase=myself.testcase, testsuite=myself.testsuite, ) _session.add(newrow) self._print("Added %r with value %r." % (name, value)) else: row.value = value self._print("Set %r to %r." % (name, value)) _session.commit()
def do_riskcategory(session): for name, desc, in ( ("Capability", " Can it perform the required functions?"), ("Reliability", " Will it work well and resist failure in all required situations?"), ("Usability", " How easy is it for a real user to use the product?"), ("Performance", " How speedy and responsive is it?"), ("Installability", " How easily can it be installed onto its target platform?"), ("Compatibility", " How well does it work with external components & configurations?"), ("Supportability", " How economical will it be to provide support to users of the product?" ), ("Testability", " How effectively can the product be tested?"), ("Maintainability", " How economical will it be to build, fix or enhance the product?"), ("Portability", " How economical will it be to port or reuse the technology elsewhere?" ), ("Localizability", " How economical will it be to publish the product in another language?" ), ): session.add( models.create(models.RiskCategory, name=name, description=desc)) session.commit()
def add_interface(session, attribs): """Add new interface, don't duplicate existing one. Also try connecting to equipment if possible. """ network = attribs.get("network") ipaddr = attribs["ipaddr"] attribs["interface_type"] = get_interface_type(session) q = session.query(models.Interface).filter(models.and_( models.Interface.network==network, models.Interface.ipaddr==ipaddr) ) # try to find equipment by matching name. hostname = attribs.get("description") if hostname: eq = get_equipment(session, hostname) del attribs["description"] else: eq = None attribs["equipment"] = eq try: intf = q.one() except models.NoResultFound: intf = models.create(models.Interface, **attribs) session.add(intf) session.commit() else: models.update(intf, **attribs) session.commit()
def resolve_build(self, dbsession): buildstring = self._data.get("build") if buildstring is None: return mo = PROJECT_RE.search(buildstring) if mo: try: pname, major, minor, sub, build = mo.groups() major = int(major); minor = int(minor); sub = int(sub); build = int(build) except ValueError: self._data["build"] = None return try: proj = dbsession.query(models.Project).filter(models.Project.name==pname).one() except NoResultFound: self._data["build"] = None return try: projectversion = dbsession.query(models.ProjectVersion).filter(and_( models.ProjectVersion.project==proj, models.ProjectVersion.valid==True, models.ProjectVersion.major==major, models.ProjectVersion.minor==minor, models.ProjectVersion.subminor==sub, models.ProjectVersion.build==build) ).one() except NoResultFound: projectversion = models.create( models.ProjectVersion, project=proj, valid=True, major=major, minor=minor, subminor=sub, build=build) dbsession.add(projectversion) dbsession.commit() self._data["build"] = projectversion else: self._data["build"] = None
def add(self, argv): """add [--first_name=<firstname> --last_name=<lastname>] <username> Add a new user to the database.""" args, kwargs = CLI.breakout_args(argv[1:], self._environ) username = args[0] try: pwent = passwd.getpwnam(username) except KeyError: pass else: models.create_user(_session, pwent) return grp = _session.query(models.Group).filter(models.Group.name=="testers").one() kwargs["username"] = username kwargs["authservice"] = "local" kwargs.setdefault("is_staff", True) kwargs.setdefault("is_active", True) kwargs.setdefault("is_superuser", False) if "first_name" not in kwargs: kwargs["first_name"] = self._user_input("First Name? ") if "last_name" not in kwargs: kwargs["last_name"] = self._user_input("Last Name? ") user = models.create(models.User, **kwargs) user.groups = [grp] _session.add(user) _session.commit()
def do_language(session): for code, name in iso639a.LANGUAGECODES.items(): session.add( models.create(models.Language, name=name.encode("utf-8"), isocode=code.strip())) session.commit()
def do_config(session): rn = models.create(models.Config, name="root", user=None, parent=None, value=aid.NULL) session.add(rn) flags = models.create(models.Config, name="flags", user=None, container=rn, value=aid.NULL) session.add(flags) session.commit() root = config.Container(session, rn) flags = config.Container(session, flags) flags.VERBOSE = 0 # levels of verbosity flags.DEBUG = 0 # levels of debugging flags.INTERACTIVE = False # Don't run interactive tests also, by default root["logbasename"] = "testrun.log" root["logfiledir"] = "/var/tmp" root["reportbasename"] = "-" root["resultsdirbase"] = '/var/www/localhost/htdocs/testresults' root["documentroot"] = "/var/www/localhost" # this one, at least, will have to be changed by installer. root["baseurl"] = "http://localhost" ui = root.add_container("userinterfaces") ui.default = ("UI.UserInterface", "IO.ConsoleIO", "UI.DefaultTheme") ui.console = ("UI.UserInterface", "IO.ConsoleIO", "UI.DefaultTheme") reports = root.add_container("reports") reports.default = ("StandardReport", "-", "text/ansi") reports.ansi = ("StandardReport", "-", "text/ansi; charset=utf8") reports.database = ("pycopia.reports.database.DatabaseReport",) reports.email = ("pycopia.reports.Email.EmailReport", "text/html", None) reports.html = ("StandardReport", "$username-$runnertimestamp", "text/html") reports.full = [ ("StandardReport", "-", "text/ansi; charset=utf8"), ("StandardReport", "$username-$runnertimestamp", "text/html") ] reports.production = [ ("StandardReport", "-", "text/ansi; charset=utf8"), ("StandardReport", "$username-$runnertimestamp", "text/html"), ("pycopia.reports.database.DatabaseReport",), ] controllers = root.add_container("controllers") selenium = root.add_container("selenium") selenium.host = "localhost" selenium.port = 4444 selenium.browser = "firefox" session.commit()
def do_capability_types(session): for name, desc, group_id, type in ( ("vmtechnology", "Virtualization support in hardware.", 1, 5), ("sleep", "Can be put in low power state (sleep).", 2, 5), ): session.add(models.create(models.CapabilityType, name=name, description=desc, group_id=group_id, value_type=type)) session.commit()
def resolve_data(self, dbsession, testrecord): dp = self._datapoints if dp: tdl = [models.create(models.TestResultData, data=hldr.data, note=hldr.note, testresult=testrecord) for hldr in dp] for tr in tdl: dbsession.add(tr) testrecord.data = tdl self._datapoints = None
def get_unknown_equipment(session, hostname): model = get_unknown_equipment_model(session) eq = models.create(models.Equipment, name=hostname, model=model, comment="Added by nmap importer.") session.add(eq) session.commit() return eq
def create(self): """Create and save new TestCase with data collected so far. """ dbcase = models.create(models.TestCase, **self._data) _dbsession.add(dbcase) for key, value in self._many2many.items(): setattr(dbcase, key, value) _dbsession.commit() return dbcase
def resolve_reference(self): if self._data["reference"]: refname = self._data["reference"] try: ref = _dbsession.query(models.Requirement).filter(models.Requirement.uri == refname).one() except models.NoResultFound: ref = models.create(models.Requirement, uri=refname) self._data["reference"] = ref else: self._data["reference"] = None
def create(modelclass, ui): data = {} for metadata in sorted(models.get_metadata(modelclass)): ctor = _CREATORS.get(metadata.coltype) if ctor: data[metadata.colname] = ctor(ui, modelclass, metadata) else: ui.error("No user interface for %r of type %r." % (metadata.colname, metadata.coltype)) dbrow = models.create(modelclass) return update_row(modelclass, dbrow, data)
def get_network(session, ipnet): """Returns a Network model object. Creates one if necessary.""" q = session.query(models.Network).filter(models.Network.ipnetwork==ipnet.CIDR) try: net = q.one() except models.NoResultFound: args = dict(name=ipnet.CIDR, ipnetwork=ipnet.CIDR, layer=3) net = models.create(models.Network, **args) session.add(net) session.commit() return net
def get_network(session, ipnet): """Returns a Network model object. Creates one if necessary.""" q = session.query( models.Network).filter(models.Network.ipnetwork == ipnet.CIDR) try: net = q.one() except models.NoResultFound: args = dict(name=ipnet.CIDR, ipnetwork=ipnet.CIDR, layer=3) net = models.create(models.Network, **args) session.add(net) session.commit() return net
def do_schedules(session): for name, m, h, dom, mon, dow in ( ("Minutely", "*", "*", "*", "*", "*"), ("Hourly", "15", "*", "*", "*", "*"), ("Daily", "30", "4", "*", "*", "*"), ("TwiceADay", "40", "5,17", "*", "*", "*"), ("Weekly", "45", "4", "*", "*", "6"), ("BiWeekly", "45", "3", "*", "*", "3,6"), ("Monthly", "45", "5", "1", "*", "*"), ("Yearly", "55", "6", "1", "12", "*"), ): session.add(models.create(models.Schedule, name=name, minute=m, hour=h, day_of_month=dom, month=mon, day_of_week=dow)) session.commit()
def commit(self, dbsession, parentrecord=None): self._data["parent"] = parentrecord if self._data["objecttype"] == TEST: self.resolve_testcase(dbsession) if self._data["objecttype"] == SUITE: self.resolve_testsuite(dbsession) self.resolve_build(dbsession) tr = models.create(models.TestResult, **self._data) dbsession.add(tr) if self._data["objecttype"] == TEST: self.resolve_data(dbsession, tr) for child in self._children: child.commit(dbsession, tr)
def __setitem__(self, name, value): try: item = self.session.query(Config).filter(and_(Config.parent_id==self.node.id, Config.name==name)).one() except NoResultFound: me = self.node item = models.create(Config, name=name, value=value, container=me, user=self._user) self.session.add(item) self.session.commit() else: item.value = value self.session.add(item) self.session.commit()
def get_unknown_equipment_model(session): cat = session.query(models.EquipmentCategory).filter(models.EquipmentCategory.name=="unknown").one() q = session.query(models.EquipmentModel).filter(models.and_( models.EquipmentModel.name=="Unknown", models.EquipmentModel.category==cat) ) try: model = q.one() except models.NoResultFound: manu = session.query(models.Corporation).filter(models.Corporation.name=="Custom").one() model = models.create(models.EquipmentModel, name="Unknown", category=cat, manufacturer=manu) session.add(model) session.commit() return model
def do_riskcategory(session): for name, desc, in ( ("Capability", " Can it perform the required functions?"), ("Reliability", " Will it work well and resist failure in all required situations?"), ("Usability", " How easy is it for a real user to use the product?"), ("Performance", " How speedy and responsive is it?"), ("Installability", " How easily can it be installed onto its target platform?"), ("Compatibility", " How well does it work with external components & configurations?"), ("Supportability", " How economical will it be to provide support to users of the product?"), ("Testability", " How effectively can the product be tested?"), ("Maintainability", " How economical will it be to build, fix or enhance the product?"), ("Portability", " How economical will it be to port or reuse the technology elsewhere?"), ("Localizability", " How economical will it be to publish the product in another language?"), ): session.add(models.create(models.RiskCategory, name=name, description=desc)) session.commit()
def do_equipment_category(session): for name in ( "other", "unknown", "chassis", "backplane", "container", # chassis slot or daughter-card holder "powerSupply", "fan", "sensor", "module", # plug-in card or daughter-card "port", "stack", # stack of multiple chassis entities "cpu"): session.add(models.create(models.EquipmentCategory, name=name)) session.commit()
def add_container(self, name): me = self.node if me.value is NULL: new = models.create(Config, name=name, value=NULL, container=me, user=self._get_user(), testcase=self._testcase or me.testcase, testsuite=self._testsuite or me.testsuite) try: self.session.add(new) self.session.commit() except IntegrityError as err: self.session.rollback() raise ConfigError(str(err)) return Container(self.session, new, user=self._user, testcase=self._testcase, testsuite=self._testsuite) else: raise ConfigError("Cannot add container to value pair.")
def get_unknown_equipment_model(session): cat = session.query(models.EquipmentCategory).filter( models.EquipmentCategory.name == "unknown").one() q = session.query(models.EquipmentModel).filter( models.and_(models.EquipmentModel.name == "Unknown", models.EquipmentModel.category == cat)) try: model = q.one() except models.NoResultFound: manu = session.query(models.Corporation).filter( models.Corporation.name == "Custom").one() model = models.create(models.EquipmentModel, name="Unknown", category=cat, manufacturer=manu) session.add(model) session.commit() return model
def do_functional_areas(session): for name, desc in ( ("computing", "Basic computing, such as operating system."), ("UI", "Any user interface"), ("GUI", "Graphical user interface"), ("TUI", "Text user interface"), ("webUI", "Browser based user interface"), ("Documentation", "Documentation of something."), ("Networking", "Routing, bridging, etc."), ("telephony", "Telephony service."), ("datacom", "Data communications service"), ("repair", "Repair service"), ("cloud", "Cloud computing."), ("AAA", "Authentication, authorization, and accounting."), ("CA", "Certificate authority."), ): session.add(models.create(models.FunctionalArea, name=name, description=desc)) session.commit()
def __setitem__(self, name, value): try: item = self.session.query(Config).filter( and_(Config.parent_id == self.node.id, Config.name == name)).one() except NoResultFound: me = self.node item = models.create(Config, name=name, value=value, container=me, user=self._user) self.session.add(item) self.session.commit() else: item.value = value self.session.add(item) self.session.commit()
def do_corporations(session): for name, desc, in ( ("AMD", ""), ("Dell", "Dell computers."), ("Hewlett Packard", "The HP PC company."), ("Agilent", "Maker of test and measurement equipment (was HP)."), ("Intel", ""), ("IBM", ""), ("Sun", ""), ("Oracle", ""), ("Cisco", ""), ("Foundry", ""), ("Nvidia", ""), ("Sonicwall", ""), ("Comcast", ""), ("Aberdeen", ""), ("AT&T", ""), ("T-mobile", ""), ("American Power Conversion", "APC"), ("Belkin", "Maker of console switchers"), ("Supermicro", ""), ("Apple", ""), ("Google", ""), ("Microsoft", ""), ("Netgear", ""), ("Asus", "Maker of PC motherboards."), ("Biostar", "Maker of PC motherboards."), ("Antec", "Maker of PC cases."), ("Tyan", ""), ("Newegg", ""), ("Amazon", ""), ("Central Computer", "PC component reseller."), ("Vmware", "Purveyor of virtualization software."), ("Mozilla", "The Mozilla foundation."), ("Community", "a pseudo-corporation that represents the open-source community."), ("Custom", "A psuedo-corporation that represents a custom built thing."), ): session.add(models.create(models.Corporation, name=name, notes=desc)) session.commit()
def do_corporations(session): for name, desc, in ( ("AMD", ""), ("Dell", "Dell computers."), ("Hewlett Packard", "The HP PC company."), ("Agilent", "Maker of test and measurement equipment (was HP)."), ("Intel", ""), ("IBM", ""), ("Sun", ""), ("Oracle", ""), ("Cisco", ""), ("Foundry", ""), ("Nvidia", ""), ("Sonicwall", ""), ("Comcast", ""), ("Aberdeen", ""), ("AT&T", ""), ("T-mobile", ""), ("American Power Conversion", "APC"), ("Belkin", "Maker of console switchers"), ("Supermicro", ""), ("Apple", ""), ("Google", ""), ("Microsoft", ""), ("Netgear", ""), ("Asus", "Maker of PC motherboards."), ("Biostar", "Maker of PC motherboards."), ("Antec", "Maker of PC cases."), ("Tyan", ""), ("Newegg", ""), ("Amazon", ""), ("Central Computer", "PC component reseller."), ("Vmware", "Purveyor of virtualization software."), ("Mozilla", "The Mozilla foundation."), ("Community","a pseudo-corporation that represents the open-source community."), ("Custom", "A psuedo-corporation that represents a custom built thing."), ): session.add(models.create(models.Corporation, name=name, notes=desc)) session.commit()
def resolve_build(buildstring): if buildstring is None: return mo = PROJECT_RE.search(buildstring) if mo: try: pname, major, minor, sub, build = mo.groups() major = int(major) minor = int(minor) sub = int(sub) build = int(build) except ValueError: return None try: proj = dbsession.query( models.Project).filter(models.Project.name == pname).one() except NoResultFound: return None try: projectversion = dbsession.query(models.ProjectVersion).filter( and_(models.ProjectVersion.project == proj, models.ProjectVersion.valid == True, models.ProjectVersion.major == major, models.ProjectVersion.minor == minor, models.ProjectVersion.subminor == sub, models.ProjectVersion.build == build)).one() except NoResultFound: projectversion = models.create(models.ProjectVersion, project=proj, valid=True, major=major, minor=minor, subminor=sub, build=build) dbsession.add(projectversion) return projectversion else: return None
def create(self): dbcase = models.create(models.UseCase, **self._data) _dbsession.add(dbcase) _dbsession.commit() return dbcase
def do_default_group(session): session.add(models.create(models.Group, name="testers")) session.commit()
def do_language(session): for code, name in iso639a.LANGUAGECODES.items(): session.add(models.create(models.Language, name=name.encode("utf-8"), isocode=code.strip())) session.commit()
def do_country(session): for code, name in iso3166.COUNTRYCODES.items(): name = unicode(name, "ISO-8859-1").title() session.add(models.create(models.Country, name=name, isocode=code.strip())) session.commit()
def do_interface_types(session): for name, enumeration in ( ("other", 1), # none of the following ("regular1822", 2), ("hdh1822", 3), ("ddnX25", 4), ("rfc877x25", 5), ("ethernetCsmacd", 6), # for all ethernet-like interfaces, regardless of speed, as per RFC3635 ("iso88024TokenBus", 8), ("iso88025TokenRing", 9), ("iso88026Man", 10), ("proteon10Mbit", 12), ("proteon80Mbit", 13), ("hyperchannel", 14), ("fddi", 15), ("lapb", 16), ("sdlc", 17), ("ds1", 18), # DS1-MIB ("propPointToPointSerial", 22), # proprietary serial ("ppp", 23), ("softwareLoopback", 24), ("eon", 25), # CLNP over IP ("ethernet3Mbit", 26), ("nsip", 27), # XNS over IP ("slip", 28), # generic SLIP ("ultra", 29), # ULTRA technologies ("ds3", 30), # DS3-MIB ("sip", 31), # SMDS, coffee ("frameRelay", 32), # DTE only. ("rs232", 33), ("para", 34), # parallel-port ("arcnet", 35), # arcnet ("arcnetPlus", 36), # arcnet plus ("atm", 37), # ATM cells ("miox25", 38), ("sonet", 39), # SONET or SDH ("x25ple", 40), ("iso88022llc", 41), ("localTalk", 42), ("smdsDxi", 43), ("frameRelayService", 44), # FRNETSERV-MIB ("v35", 45), ("hssi", 46), ("hippi", 47), ("modem", 48), # Generic modem ("aal5", 49), # AAL5 over ATM ("sonetPath", 50), ("sonetVT", 51), ("smdsIcip", 52), # SMDS InterCarrier Interface ("propVirtual", 53), # proprietary virtual/internal ("propMultiplexor", 54),# proprietary multiplexing ("ieee80212", 55), # 100BaseVG ("fibreChannel", 56), # Fibre Channel ("hippiInterface", 57), # HIPPI interfaces ("aflane8023", 59), # ATM Emulated LAN for 802.3 ("aflane8025", 60), # ATM Emulated LAN for 802.5 ("cctEmul", 61), # ATM Emulated circuit ("isdn", 63), # ISDN and X.25 ("v11", 64), # CCITT V.11/X.21 ("v36", 65), # CCITT V.36 ("g703at64k", 66), # CCITT G703 at 64Kbps ("qllc", 68), # SNA QLLC ("channel", 70), # channel ("ieee80211", 71), # radio spread spectrum ("ibm370parChan", 72), # IBM System 360/370 OEMI Channel ("escon", 73), # IBM Enterprise Systems Connection ("dlsw", 74), # Data Link Switching ("isdns", 75), # ISDN S/T interface ("isdnu", 76), # ISDN U interface ("lapd", 77), # Link Access Protocol D ("ipSwitch", 78), # IP Switching Objects ("rsrb", 79), # Remote Source Route Bridging ("atmLogical", 80), # ATM Logical Port ("ds0", 81), # Digital Signal Level 0 ("ds0Bundle", 82), # group of ds0s on the same ds1 ("bsc", 83), # Bisynchronous Protocol ("async", 84), # Asynchronous Protocol ("cnr", 85), # Combat Net Radio ("iso88025Dtr", 86), # ISO 802.5r DTR ("eplrs", 87), # Ext Pos Loc Report Sys ("arap", 88), # Appletalk Remote Access Protocol ("propCnls", 89), # Proprietary Connectionless Protocol ("hostPad", 90), # CCITT-ITU X.29 PAD Protocol ("termPad", 91), # CCITT-ITU X.3 PAD Facility ("frameRelayMPI", 92), # Multiproto Interconnect over FR ("x213", 93), # CCITT-ITU X213 ("adsl", 94), # Asymmetric Digital Subscriber Loop ("radsl", 95), # Rate-Adapt. Digital Subscriber Loop ("sdsl", 96), # Symmetric Digital Subscriber Loop ("vdsl", 97), # Very H-Speed Digital Subscrib. Loop ("iso88025CRFPInt", 98), # ISO 802.5 CRFP ("myrinet", 99), # Myricom Myrinet ("voiceEM", 100), # voice recEive and transMit ("voiceFXO", 101), # voice Foreign Exchange Office ("voiceFXS", 102), # voice Foreign Exchange Station ("voiceEncap", 103), # voice encapsulation ("voiceOverIp", 104), # voice over IP encapsulation ("atmDxi", 105), # ATM DXI ("atmFuni", 106), # ATM FUNI ("atmIma", 107), # ATM IMA ("pppMultilinkBundle", 108), # PPP Multilink Bundle ("ipOverCdlc", 109), # IBM ipOverCdlc ("ipOverClaw", 110), # IBM Common Link Access to Workstn ("stackToStack", 111), # IBM stackToStack ("virtualIpAddress", 112), # IBM VIPA ("mpc", 113), # IBM multi-protocol channel support ("ipOverAtm", 114), # IBM ipOverAtm ("iso88025Fiber", 115), # ISO 802.5j Fiber Token Ring ("tdlc", 116), # IBM twinaxial data link control ("hdlc", 118), # HDLC ("lapf", 119), # LAP F ("v37", 120), # V.37 ("x25mlp", 121), # Multi-Link Protocol ("x25huntGroup", 122), # X25 Hunt Group ("trasnpHdlc", 123), # Transp HDLC ("interleave", 124), # Interleave channel ("fast", 125), # Fast channel ("ip", 126), # IP (for APPN HPR in IP networks) ("docsCableMaclayer", 127), # CATV Mac Layer ("docsCableDownstream", 128), # CATV Downstream interface ("docsCableUpstream", 129), # CATV Upstream interface ("a12MppSwitch", 130), # Avalon Parallel Processor ("tunnel", 131), # Encapsulation interface ("coffee", 132), # coffee pot ("ces", 133), # Circuit Emulation Service ("atmSubInterface", 134), # ATM Sub Interface ("l2vlan", 135), # Layer 2 Virtual LAN using 802.1Q ("l3ipvlan", 136), # Layer 3 Virtual LAN using IP ("l3ipxvlan", 137), # Layer 3 Virtual LAN using IPX ("digitalPowerline", 138), # IP over Power Lines ("mediaMailOverIp", 139), # Multimedia Mail over IP ("dtm", 140), # Dynamic syncronous Transfer Mode ("dcn", 141), # Data Communications Network ("ipForward", 142), # IP Forwarding Interface ("msdsl", 143), # Multi-rate Symmetric DSL ("ieee1394", 144), # IEEE1394 High Performance Serial Bus ("if-gsn", 145), # HIPPI-6400 ("dvbRccMacLayer", 146), # DVB-RCC MAC Layer ("dvbRccDownstream", 147), # DVB-RCC Downstream Channel ("dvbRccUpstream", 148), # DVB-RCC Upstream Channel ("atmVirtual", 149), # ATM Virtual Interface ("mplsTunnel", 150), # MPLS Tunnel Virtual Interface ("srp", 151), # Spatial Reuse Protocol ("voiceOverAtm", 152), # Voice Over ATM ("voiceOverFrameRelay", 153), # Voice Over Frame Relay ("idsl", 154), # Digital Subscriber Loop over ISDN ("compositeLink", 155), # Avici Composite Link Interface ("ss7SigLink", 156), # SS7 Signaling Link ("propWirelessP2P", 157), # Prop. P2P wireless interface ("frForward", 158), # Frame Forward Interface ("rfc1483", 159), # Multiprotocol over ATM AAL5 ("usb", 160), # USB Interface ("ieee8023adLag", 161), # IEEE 802.3ad Link Aggregate ("bgppolicyaccounting", 162), # BGP Policy Accounting ("frf16MfrBundle", 163), # FRF .16 Multilink Frame Relay ("h323Gatekeeper", 164), # H323 Gatekeeper ("h323Proxy", 165), # H323 Voice and Video Proxy ("mpls", 166), # MPLS ("mfSigLink", 167), # Multi-frequency signaling link ("hdsl2", 168), # High Bit-Rate DSL - 2nd generation ("shdsl", 169), # Multirate HDSL2 ("ds1FDL", 170), # Facility Data Link 4Kbps on a DS1 ("pos", 171), # Packet over SONET/SDH Interface ("dvbAsiIn", 172), # DVB-ASI Input ("dvbAsiOut", 173), # DVB-ASI Output ("plc", 174), # Power Line Communtications ("nfas", 175), # Non Facility Associated Signaling ("tr008", 176), # TR008 ("gr303RDT", 177), # Remote Digital Terminal ("gr303IDT", 178), # Integrated Digital Terminal ("isup", 179), # ISUP ("propDocsWirelessMaclayer", 180), # Cisco proprietary Maclayer ("propDocsWirelessDownstream", 181), # Cisco proprietary Downstream ("propDocsWirelessUpstream", 182), # Cisco proprietary Upstream ("hiperlan2", 183), # HIPERLAN Type 2 Radio Interface ("sonetOverheadChannel", 185), # SONET Overhead Channel ("digitalWrapperOverheadChannel", 186), # Digital Wrapper ("aal2", 187), # ATM adaptation layer 2 ("radioMAC", 188), # MAC layer over radio links ("atmRadio", 189), # ATM over radio links ("imt", 190), # Inter Machine Trunks ("mvl", 191), # Multiple Virtual Lines DSL ("reachDSL", 192), # Long Reach DSL ("frDlciEndPt", 193), # Frame Relay DLCI End Point ("atmVciEndPt", 194), # ATM VCI End Point ("opticalChannel", 195), # Optical Channel ("opticalTransport", 196), # Optical Transport ("propAtm", 197), # Proprietary ATM ("voiceOverCable", 198), # Voice Over Cable Interface ("infiniband", 199), # Infiniband ("teLink", 200), # TE Link ("q2931", 201), # Q.2931 ("virtualTg", 202), # Virtual Trunk Group ("sipTg", 203), # SIP Trunk Group ("sipSig", 204), # SIP Signaling ("docsCableUpstreamChannel", 205), # CATV Upstream Channel ("econet", 206), # Acorn Econet ("pon155", 207), # FSAN 155Mb Symetrical PON interface ("pon622", 208), # FSAN622Mb Symetrical PON interface ("bridge", 209), # Transparent bridge interface ("linegroup", 210), # Interface common to multiple lines ("voiceEMFGD", 211), # voice E&M Feature Group D ("voiceFGDEANA", 212), # voice FGD Exchange Access North American ("voiceDID", 213), # voice Direct Inward Dialing ("mpegTransport", 214), # MPEG transport interface ("gtp", 216), # GTP(GPRS Tunneling Protocol) ("pdnEtherLoop1", 217), # Paradyne EtherLoop 1 ("pdnEtherLoop2", 218), # Paradyne EtherLoop 2 ("opticalChannelGroup", 219), # Optical Channel Group ("homepna", 220), # HomePNA ITU-T G.989 ("gfp", 221), # Generic Framing Procedure(GFP) ("ciscoISLvlan", 222), # Layer 2 Virtual LAN using Cisco ISL ("actelisMetaLOOP", 223), # Acteleis proprietary MetaLOOP High Speed Link ("fcipLink", 224), # FCIP Link ("rpr", 225), # Resilient Packet Ring Interface Type ("qam", 226), # RF Qam Interface ("lmp", 227), # Link Management Protocol ("cblVectaStar", 228), # Cambridge Broadband Networks Limited VectaStar ("docsCableMCmtsDownstream", 229), # CATV Modular CMTS Downstream Interface ("macSecControlledIF", 231), # MACSecControlled ("macSecUncontrolledIF", 232), # MACSecUncontrolled ("aviciOpticalEther", 233), # Avici Optical Ethernet Aggregate ("atmbond", 234), # atmbond ("voiceFGDOS", 235), # voice FGD Operator Services ("mocaVersion1", 236), # MultiMedia over Coax Alliance(MoCA) Interface as documented in information provided privately to IANA ("ieee80216WMAN", 237), # IEEE 802.16 WMAN interface ("adsl2plus", 238), # Asymmetric Digital Subscriber Loop Version 2, Version 2 Plus and all variants ("dvbRcsMacLayer", 239), # DVB-RCS MAC Layer ("dvbTdm", 240), # DVB Satellite TDM ("dvbRcsTdma", 241), # DVB-RCS TDMA ("x86Laps", 242), # LAPS based on ITU-T X.86/Y.1323 ("wwanPP", 243), # 3GPP WWAN ("wwanPP2", 244), # 3GPP2 WWAN ): session.add(models.create(models.InterfaceType, name=name, enumeration=enumeration)) session.commit()
def do_default_environment(session): session.add(models.create(models.Environment, name="default")) session.commit()