def setUp(self): optparser = BaseOptions() optparser.parseOptions([ 'dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower() ]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) self.defaults.get('global', 'dns_domain_name') xmldata = """ <project name="test" code="qtree"> <site name="sitea" type="primary" location="testlab"> <filer name="testfiler1" type="filer"> <vfiler name="vfiler01" rootaggr="aggr0"> <aggregate name="aggr01"> <volume name="testvol1"/> </aggregate> </vfiler> </filer> </site> </project> """ node = etree.fromstring(xmldata) self.proj = Project() self.proj.configure_from_node(node, self.defaults, None) self.volume = self.proj.get_volumes()[0]
def setUp(self): optparser = BaseOptions() optparser.parseOptions(['dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower()]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) self.outfile = StringIO()
def setUp(self): optparser = BaseOptions() optparser.parseOptions([ 'dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower() ]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) xmldata = """ <project name="testproj" code="01"> <site name="sitea" type="primary" location="testlab"> <filer name="filer1" type="filer"> <vfiler name="vftest01"> <aggregate type="root" name="aggr0"/> <aggregate name="aggr01"> <volume name="blah"> </volume> </aggregate> </vfiler> </filer> </site> </project> """ node = etree.fromstring(xmldata) self.project = Project() self.project.configure_from_node(node, self.defaults, None)
def setUp(self): optparser = BaseOptions() optparser.parseOptions(["dummyfile.xml", "--debug=%s" % logging._levelNames[log.level].lower()]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) self.defaults.get("global", "dns_domain_name") xmldata = """ <project name="test" code="qtree"> <site name="sitea" type="primary" location="testlab"> <filer name="testfiler1" type="filer"> <vfiler name="vfiler01" rootaggr="aggr0"> <aggregate name="aggr01"> <volume name="testvol1"/> </aggregate> </vfiler> </filer> </site> </project> """ node = etree.fromstring(xmldata) self.proj = Project() self.proj.configure_from_node(node, self.defaults, None) self.volume = self.proj.get_volumes()[0]
def setUp(self): optparser = BaseOptions() optparser.parseOptions(['dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower()]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) xmldata = """ <project name="testproj" code="01"> <site name="sitea" type="primary" location="testlab"> <host name="sitea_host01" operatingsystem="linux" /> <host name="sitea_host02" operatingsystem="windows" /> <host name="sitea_host03" operatingsystem="solaris" /> <vlan type="project" number="3001"> <network number="10.20.30.1/26" gateway="10.20.30.254"/> </vlan> <filer name="filer1" type="filer"> <vfiler name="vftest01" rootaggr="aggr0"> <ipaddress type="primary" ip="10.20.30.1"/> <aggregate name="aggr01"/> </vfiler> </filer> </site> </project> """ node = etree.fromstring(xmldata) self.project = Project() self.project.configure_from_node(node, self.defaults, None) self.sitea = self.project.get_sites()[0] self.filer1 = self.sitea.get_filers()[0] self.vfiler1 = self.filer1.get_vfilers()[0] self.aggr1 = self.vfiler1.get_aggregates()[0]
def setUp(self): optparser = BaseOptions() optparser.parseOptions(['dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower()]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) xmldata = """ <project name="testproj" code="01"> <site name="sitea" type="primary" location="testlab"> <filer name="filer1" type="filer"> <vfiler name="vftest01"> <aggregate type="root" name="aggr0"/> <aggregate name="aggr01"/> </vfiler> </filer> </site> </project> """ node = etree.fromstring(xmldata) self.project = Project() self.project.configure_from_node(node, self.defaults, None) self.sitea = self.project.get_sites()[0] self.filer1 = self.sitea.get_filers()[0] self.vfiler1 = self.filer1.get_vfilers()[0] self.aggr1 = self.vfiler1.get_aggregates()[0]
def setUp(self): optparser = BaseOptions() optparser.parseOptions(['dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower()]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) xmldata = """<project name="testproj1" code="01" title="Test Project 1"/> """ self.project = Project()
def setUp(self): optparser = BaseOptions() optparser.parseOptions(["dummyfile.xml", "--debug=%s" % logging._levelNames[log.level].lower()]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) self.site = Site() self.site.name = "sitea" self.site.type = "primary" self.site.location = "testlab" pass
def setUp(self): optparser = BaseOptions() optparser.parseOptions(['dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower()]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) self.site = Site() self.site.name = 'sitea' self.site.type = 'primary' self.site.location = 'testlab' pass
def setUp(self): """ Prepare for a configuration parse test """ optparser = BaseOptions() optparser.parseOptions(["dummyfile.xml", "--debug=%s" % logging._levelNames[log.level].lower()]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) self.project = Project()
def setUp(self): optparser = BaseOptions() optparser.parseOptions([ 'dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower() ]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) xmldata = """ <project name="testproj" code="01"> <site name="testprimary" type="primary"> <vlan type="project" number="3003"> <network number="10.240.4.0/26" gateway="10.240.4.254"/> </vlan> <filer type="filer" name="filer01"> <vfiler> <ipaddress type="primary" ip="10.240.4.1"/> <aggregate name="aggr01" type="root"/> <aggregate name="aggr02"> <volume> <setref type="snapvault" name="default_primary"/> </volume> </aggregate> </vfiler> </filer> <filer type="nearstore" name="nearstore01"> </filer> </site> <snapvaultset name="default_primary" targetfiler="nearstore01" targetaggregate="aggr02"> <snapvaultdef basename="sv_daily"> <snapschedule>1@1</snapschedule> <snapvaultschedule>8@2</snapvaultschedule> </snapvaultdef> <snapvaultdef basename="sv_weekly"> <snapvaultschedule>13@sun@3</snapvaultschedule> </snapvaultdef> </snapvaultset> </project> """ node = etree.fromstring(xmldata) self.project = Project() self.project.configure_from_node(node, self.defaults, None) self.docgen = NetAppCommandsGenerator(self.project, self.defaults)
def setUp(self): optparser = BaseOptions() optparser.parseOptions([ 'dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower() ]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) xmldata = """<project name="testproj1" code="01" title="Test Project 1"/> """ self.project = Project()
def setUp(self): optparser = BaseOptions() optparser.parseOptions(['dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower()]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) xmldata = """ <project name="testproj" code="01"> </project> """ node = etree.fromstring(xmldata) self.project = Project() self.project.configure_from_node(node, self.defaults, None)
def setUp(self): """ Load testing XML into a config instance. """ optparser = BaseOptions() optparser.parseOptions(['dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower()]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) xmlfile = os.path.join(XML_FILE_LOCATION, "drhostexport_test.xml") tree = etree.parse(xmlfile) self.project = Project() self.project.configure_from_node(tree.getroot(), self.defaults, None)
def setUp(self): optparser = BaseOptions() optparser.parseOptions(['dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower()]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) self.defaults.get('global', 'dns_domain_name') if len(configfiles) == 0: raise ValueError("Cannot load configuration file: %s" % optparser.options.configfile) self.sitea = Site() self.sitea.name = 'sitea' self.sitea.type = 'primary' self.sitea.location = 'testlab'
def setUp(self): """ Prepare for a configuration parse test """ optparser = BaseOptions() optparser.parseOptions([ 'dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower() ]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) self.project = Project()
def setUp(self): optparser = BaseOptions() optparser.parseOptions(['dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower()]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) xmldata = """ <project name="testproj" code="01"> <site name="testprimary" type="primary"> <vlan type="project" number="3003"> <network number="10.240.4.0/26" gateway="10.240.4.254"/> </vlan> <filer type="filer" name="filer01"> <vfiler> <ipaddress type="primary" ip="10.240.4.1"/> <aggregate name="aggr01" type="root"/> <aggregate name="aggr02"> <volume> <setref type="snapvault" name="default_primary"/> </volume> </aggregate> </vfiler> </filer> <filer type="nearstore" name="nearstore01"> </filer> </site> <snapvaultset name="default_primary" targetfiler="nearstore01" targetaggregate="aggr02"> <snapvaultdef basename="sv_daily"> <snapschedule>1@1</snapschedule> <snapvaultschedule>8@2</snapvaultschedule> </snapvaultdef> <snapvaultdef basename="sv_weekly"> <snapvaultschedule>13@sun@3</snapvaultschedule> </snapvaultdef> </snapvaultset> </project> """ node = etree.fromstring(xmldata) self.project = Project() self.project.configure_from_node(node, self.defaults, None) self.docgen = NetAppCommandsGenerator(self.project, self.defaults)
def setUp(self): optparser = BaseOptions() optparser.parseOptions([ 'dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower() ]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) xmldata = """ <project name="testproj" code="01"> </project> """ node = etree.fromstring(xmldata) self.project = Project() self.project.configure_from_node(node, self.defaults, None)
def setUp(self): """ Load testing XML into a config instance. """ optparser = BaseOptions() optparser.parseOptions([ 'dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower() ]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) xmlfile = os.path.join(XML_FILE_LOCATION, "drhostexport_test.xml") tree = etree.parse(xmlfile) self.project = Project() self.project.configure_from_node(tree.getroot(), self.defaults, None)
def setUp(self): optparser = BaseOptions() optparser.parseOptions([ 'dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower() ]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) self.defaults.get('global', 'dns_domain_name') if len(configfiles) == 0: raise ValueError("Cannot load configuration file: %s" % optparser.options.configfile) self.sitea = Site() self.sitea.name = 'sitea' self.sitea.type = 'primary' self.sitea.location = 'testlab'
def setUp(self): optparser = BaseOptions() optparser.parseOptions(['dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower()]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) xmldata = """ <site name="primary" type="prod" location="testlab"> <vlan number="1453" type="storage"/> <vlan number="100" type="storage"/> <vlan number="300" type="storage"/> <host name="fred" platform="intel" operatingsystem="linux"/> </site> """ node = etree.fromstring(xmldata) self.site = Site() self.site.configure_from_node(node, self.defaults, None) self.host = self.site.get_hosts()[0]
def setUp(self): optparser = BaseOptions() optparser.parseOptions(['dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower()]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) xmldata = """ <project name="demo" code="3"> <site name="one" type="primary" location="somewhere"> <vlan number="3001" type="project"/> <filer name="testfiler1" type="filer"> </filer> </site> </project> """ node = etree.fromstring(xmldata) self.project = Project() self.project.configure_from_node(node, self.defaults, None) self.site = self.project.get_sites()[0] self.filer = self.site.get_filers()[0]
def setUp(self): optparser = BaseOptions() optparser.parseOptions([ 'dummyfile.xml', '--debug=%s' % logging._levelNames[log.level].lower() ]) self.defaults = RawConfigParser() configfiles = self.defaults.read(TESTCONF) xmldata = """ <project name="testproj" code="01"> <site name="sitea" type="primary" location="testlab"> <host name="sitea_host01" operatingsystem="linux" /> <host name="sitea_host02" operatingsystem="windows" /> <host name="sitea_host03" operatingsystem="solaris" /> <vlan type="project" number="3001"> <network number="10.20.30.1/26" gateway="10.20.30.254"/> </vlan> <filer name="filer1" type="filer"> <vfiler name="vftest01" rootaggr="aggr0"> <ipaddress type="primary" ip="10.20.30.1"/> <aggregate name="aggr01"/> </vfiler> </filer> </site> </project> """ node = etree.fromstring(xmldata) self.project = Project() self.project.configure_from_node(node, self.defaults, None) self.sitea = self.project.get_sites()[0] self.filer1 = self.sitea.get_filers()[0] self.vfiler1 = self.filer1.get_vfilers()[0] self.aggr1 = self.vfiler1.get_aggregates()[0]
from docgen.project import Project #from docgen.config import ProjectConfig, ConfigInvalid from docgen.options import BaseOptions import logging import docgen.debug log = logging.getLogger('docgen') if __name__ == '__main__': usage = "create_document.py [options] <definition_file.xml>" optparser = BaseOptions(usage=usage) optparser.parseOptions() # Dynamic namespace information that is passed into document generators ns = {} # Load configuration file defaults = RawConfigParser() parsedfiles = defaults.read(optparser.options.configfile) if len(parsedfiles) == 0: raise ValueError("Cannot load configuration file: %s" % optparser.options.configfile) # Load the document generation plugins doc_plugins = load_doc_plugins(defaults) try: # load the configuration from a config file
from docgen.project import Project #from docgen.config import ProjectConfig, ConfigInvalid from docgen.options import BaseOptions import logging import docgen.debug log = logging.getLogger('docgen') if __name__ == '__main__': usage = "create_document.py [options] <definition_file.xml>" optparser = BaseOptions(usage=usage) optparser.parseOptions() # Dynamic namespace information that is passed into document generators ns = {} # Load configuration file defaults = RawConfigParser() parsedfiles = defaults.read(optparser.options.configfile) if len(parsedfiles) == 0: raise ValueError("Cannot load configuration file: %s" % optparser.options.configfile) # Load the document generation plugins doc_plugins = load_doc_plugins(defaults) try: